IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 3, 2013, 2:37:22 PM (13 years ago)
Author:
eugene
Message:

deprecate KiiOpen,KiiClose (now KapaOpen,etc); major rework of psEllipse translations : use common functions pmModelAxesToParams and pmModelParamsToAxes ; use new convergence method in pmPCM_MinimizeChisq; add convergence crerition options to psMinimization; threaded versions of pmPSFtryFitEXT and pmPSFtryFitPSF

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

  • trunk/psModules/src/objects/models/pmModel_DEV.c

    r35560 r35768  
    123123
    124124        // first, use Rmajor and index to find the central pixel flux (fraction of total flux)
    125         psEllipseShape shape;
    126 
    127         shape.sx  = PAR[PM_PAR_SXX];
    128         shape.sy  = PAR[PM_PAR_SYY];
    129         shape.sxy = PAR[PM_PAR_SXY];
    130 
    131         // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio
    132         psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     125        psEllipseAxes axes;
     126        pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    133127
    134128        // get the central pixel flux from the lookup table
     
    238232        // if q1 < 0.0, f2 ~ f1, we have a very large axis ratio near 45deg..  Saturate at that
    239233        // angle and let f2,f1 fight it out
    240         q2 = 0.5*sqrtf(q1);
     234        // NOTE: the factor of 2 is needed to convert par[SXX,SYY] to shape.sx,sy
     235        q2 = 2.0*0.5*sqrtf(q1);
    241236    }
    242237
     
    303298
    304299    // set the shape parameters
    305     // XXX adjust this?
    306     if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     300    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, true)) {
    307301      return false;
    308302    }
     
    330324psF64 PM_MODEL_FLUX (const psVector *params)
    331325{
    332     psEllipseShape shape;
    333 
    334326    psF32 *PAR = params->data.F32;
    335327
    336     shape.sx  = PAR[PM_PAR_SXX];
    337     shape.sy  = PAR[PM_PAR_SYY];
    338     shape.sxy = PAR[PM_PAR_SXY];
    339 
    340     // for a non-circular DeVaucouleur, the flux of the Rmajor equivalent is scaled by the AspectRatio
    341     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     328    psEllipseAxes axes;
     329    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    342330    float AspectRatio = axes.minor / axes.major;
    343331
     
    359347psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux)
    360348{
    361     psEllipseShape shape;
    362 
    363349    psF32 *PAR = params->data.F32;
    364350
     
    370356        return (1.0);
    371357
    372     shape.sx  = PAR[PM_PAR_SXX];
    373     shape.sy  = PAR[PM_PAR_SYY];
    374     shape.sxy = PAR[PM_PAR_SXY];
    375 
    376     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     358    psEllipseAxes axes;
     359    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    377360
    378361    // f = Io exp(-z^n) -> z^n = ln(Io/f)
     
    382365    psAssert (isfinite(radius), "fix this code: radius should not be nan for Io = %f, flux = %f, major = %f (%f, %f, %f)",
    383366              PAR[PM_PAR_I0], flux, axes.major, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY]);
    384 
    385367    return (radius);
    386368}
     
    407389    // the 2D PSF model fits polarization terms (E0,E1,E2)
    408390    // convert to shape terms (SXX,SYY,SXY)
    409     if (!pmPSF_FitToModel (out, 0.1)) {
     391    bool useReff = pmModelUseReff (modelPSF->type);
     392    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    410393        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    411394        return false;
     
    460443    // convert to shape terms (SXX,SYY,SXY)
    461444    // XXX user-defined value for limit?
    462     if (!pmPSF_FitToModel (PAR, 0.1)) {
     445    bool useReff = pmModelUseReff (model->type);
     446    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    463447        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    464448        return false;
Note: See TracChangeset for help on using the changeset viewer.