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_SERSIC.c

    r35560 r35768  
    125125
    126126        // first, use Rmajor and index to find the central pixel flux (fraction of total flux)
    127         psEllipseShape shape;
    128 
    129         shape.sx  = PAR[PM_PAR_SXX];
    130         shape.sy  = PAR[PM_PAR_SYY];
    131         shape.sxy = PAR[PM_PAR_SXY];
    132 
    133         // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio
    134         psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     127        psEllipseAxes axes;
     128        pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    135129
    136130        // get the central pixel flux from the lookup table
     
    250244        // if q1 < 0.0, f2 ~ f1, we have a very large axis ratio near 45deg..  Saturate at that
    251245        // angle and let f2,f1 fight it out
    252         q2 = 0.5*sqrtf(q1);
     246        // NOTE: the factor of 2 is needed to convert par[SXX,SYY] to shape.sx,sy
     247        q2 = 2.0*0.5*sqrtf(q1);
    253248    }
    254249
     
    347342    axes.major = Rmajor;
    348343    axes.minor = Rminor;
    349     psEllipseShape shape = psEllipseAxesToShape (axes);
    350 
    351     if (!isfinite(shape.sx))  return false;
    352     if (!isfinite(shape.sy))  return false;
    353     if (!isfinite(shape.sxy)) return false;
     344
     345    pmModelAxesToParams (&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], axes, true);
    354346
    355347    float bn = 1.9992*index - 0.3271;
     
    357349    float Io = exp(0.5*bn);
    358350
    359     float Sxx = PS_MAX(0.5, shape.sx);
    360     float Syy = PS_MAX(0.5, shape.sy);
    361 
    362     PAR[PM_PAR_SXX]  = Sxx;
    363     PAR[PM_PAR_SYY]  = Syy;
    364     PAR[PM_PAR_SXY]  = shape.sxy;
    365 
    366351    // set the model normalization (adjust for Sersic best guess)
    367352    if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
     
    381366psF64 PM_MODEL_FLUX (const psVector *params)
    382367{
    383     psEllipseShape shape;
    384 
    385368    psF32 *PAR = params->data.F32;
    386369
    387     shape.sx  = PAR[PM_PAR_SXX];
    388     shape.sy  = PAR[PM_PAR_SYY];
    389     shape.sxy = PAR[PM_PAR_SXY];
    390 
    391     // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio
    392     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     370    psEllipseAxes axes;
     371    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    393372    float AspectRatio = axes.minor / axes.major;
    394373
     
    410389psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux)
    411390{
    412     psEllipseShape shape;
    413 
    414391    psF32 *PAR = params->data.F32;
    415392
     
    421398        return (1.0);
    422399
    423     shape.sx  = PAR[PM_PAR_SXX];
    424     shape.sy  = PAR[PM_PAR_SYY];
    425     shape.sxy = PAR[PM_PAR_SXY];
    426 
    427     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     400    psEllipseAxes axes;
     401    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    428402
    429403    // f = Io exp(-z^n) -> z^n = ln(Io/f)
     
    457431    // the 2D PSF model fits polarization terms (E0,E1,E2)
    458432    // convert to shape terms (SXX,SYY,SXY)
    459     if (!pmPSF_FitToModel (out, 0.1)) {
     433    bool useReff = pmModelUseReff (modelPSF->type);
     434    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    460435        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    461436        return false;
     
    510485    // convert to shape terms (SXX,SYY,SXY)
    511486    // XXX user-defined value for limit?
    512     if (!pmPSF_FitToModel (PAR, 0.1)) {
     487    bool useReff = pmModelUseReff (model->type);
     488    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    513489        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    514490        return false;
Note: See TracChangeset for help on using the changeset viewer.