IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 11, 2013, 9:15:36 AM (13 years ago)
Author:
eugene
Message:

replace code which converts the PAR[SXX,SXY,SYY] values to shape and then axes with calls to pmModelParamsToAxes : the relationship depends on the model type. placing the code in a single function avoids inconsistent conversions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_EXP.c

    r35560 r35644  
    115115
    116116        // first, use Rmajor and index to find the central pixel flux (fraction of total flux)
    117         psEllipseShape shape;
    118 
    119         shape.sx  = PAR[PM_PAR_SXX];
    120         shape.sy  = PAR[PM_PAR_SYY];
    121         shape.sxy = PAR[PM_PAR_SXY];
    122 
    123         // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio
    124         psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     117        psEllipseAxes axes;
     118        pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    125119
    126120        // get the central pixel flux from the lookup table
     
    295289
    296290    // set the shape parameters
    297     // XXX adjust this?
    298     if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     291    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, true)) {
    299292      return false;
    300293    }
     
    316309psF64 PM_MODEL_FLUX (const psVector *params)
    317310{
    318     psEllipseShape shape;
    319 
    320311    psF32 *PAR = params->data.F32;
    321312
    322     shape.sx  = PAR[PM_PAR_SXX];
    323     shape.sy  = PAR[PM_PAR_SYY];
    324     shape.sxy = PAR[PM_PAR_SXY];
    325 
    326     // for a non-circular Exponential, the flux of the Rmajor equivalent is scaled by the AspectRatio
    327     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     313    psEllipseAxes axes;
     314    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    328315    float AspectRatio = axes.minor / axes.major;
    329316
     
    345332psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux)
    346333{
    347     psEllipseShape shape;
    348 
    349334    psF32 *PAR = params->data.F32;
    350335
     
    356341        return (1.0);
    357342
    358     shape.sx  = PAR[PM_PAR_SXX];
    359     shape.sy  = PAR[PM_PAR_SYY];
    360     shape.sxy = PAR[PM_PAR_SXY];
    361 
    362     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     343    psEllipseAxes axes;
     344    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true);
    363345
    364346    // f = Io exp(-sqrt(z)) -> sqrt(z) = ln(Io/f)
     
    392374    // the 2D PSF model fits polarization terms (E0,E1,E2)
    393375    // convert to shape terms (SXX,SYY,SXY)
    394     if (!pmPSF_FitToModel (out, 0.1)) {
     376    bool useReff = pmModelUseReff (modelPSF->type);
     377    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    395378        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    396379        return false;
     
    445428    // convert to shape terms (SXX,SYY,SXY)
    446429    // XXX user-defined value for limit?
    447     if (!pmPSF_FitToModel (PAR, 0.1)) {
     430    bool useReff = pmModelUseReff (model->type);
     431    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    448432        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    449433        return false;
Note: See TracChangeset for help on using the changeset viewer.