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

    r35560 r35644  
    201201
    202202    // set the shape parameters
    203     if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     203    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) {
    204204      return false;
    205205    }
     
    222222{
    223223    float z, norm;
    224     psEllipseShape shape;
    225224
    226225    psF32 *PAR = params->data.F32;
    227226
    228     shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
    229     shape.sy  = PAR[PM_PAR_SYY] / M_SQRT2;
    230     shape.sxy = PAR[PM_PAR_SXY];
    231 
    232     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     227    psEllipseAxes axes;
     228    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
     229
    233230    float AspectRatio = axes.minor / axes.major;
    234231
     
    262259{
    263260    psF64 z;
    264     psEllipseShape shape;
    265261
    266262    psF32 *PAR = params->data.F32;
     
    273269        return (1.0);
    274270
    275     shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
    276     shape.sy  = PAR[PM_PAR_SYY] / M_SQRT2;
    277     shape.sxy = PAR[PM_PAR_SXY];
    278 
    279     // this estimates the radius assuming f(z) is roughly exp(-z)
    280     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     271    psEllipseAxes axes;
     272    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
     273
    281274    psF64 sigma = axes.major;
    282275
     
    347340    }
    348341
    349     // the OLD 2D model for SXY actually fitted SXY / (SXX^-2 + SYY^-2); correct here
    350     // out[PM_PAR_SXY] = pmPSF_SXYtoModel (out);
    351 
    352342    // the 2D PSF model fits polarization terms (E0,E1,E2)
    353343    // convert to shape terms (SXX,SYY,SXY)
    354     if (!pmPSF_FitToModel (out, 0.1)) {
     344    bool useReff = pmModelUseReff (modelPSF->type);
     345    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    355346        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    356347        return false;
     
    403394    // the 2D PSF model fits polarization terms (E0,E1,E2)
    404395    // convert to shape terms (SXX,SYY,SXY)
    405     // XXX user-defined value for limit?
    406     if (!pmPSF_FitToModel (PAR, 0.1)) {
     396    bool useReff = pmModelUseReff (model->type);
     397    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    407398        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    408399        return false;
Note: See TracChangeset for help on using the changeset viewer.