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

    r35560 r35644  
    200200
    201201    // set the shape parameters
    202     if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     202    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) {
    203203      return false;
    204204    }
     
    219219psF64 PM_MODEL_FLUX (const psVector *params)
    220220{
    221 
    222     psEllipseShape shape;
    223 
    224221    psF32 *PAR = params->data.F32;
    225222
    226     shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
    227     shape.sy  = PAR[PM_PAR_SYY] / M_SQRT2;
    228     shape.sxy = PAR[PM_PAR_SXY];
     223    psEllipseAxes axes;
     224    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
    229225
    230226    // Area is equivalent to 2 pi sigma^2
    231     // axes ratio < 20
    232     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
    233227    psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
    234228
     
    242236psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux)
    243237{
    244     psEllipseShape shape;
    245 
    246238    psF32 *PAR = params->data.F32;
    247239
     
    253245        return (1.0);
    254246
    255     shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
    256     shape.sy  = PAR[PM_PAR_SYY] / M_SQRT2;
    257     shape.sxy = PAR[PM_PAR_SXY];
    258 
    259     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     247    psEllipseAxes axes;
     248    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
     249
    260250    psF64 radius = axes.major * sqrt (2.0 * log(PAR[PM_PAR_I0] / flux));
    261251    psAssert (isfinite(radius), "fix this code: radius should not be nan for Io = %f, flux = %f, major = %f (%f, %f, %f)",
     
    285275    }
    286276
    287     // the OLD 2D model for SXY actually fitted SXY / (SXX^-2 + SYY^-2); correct here
    288     // out[PM_PAR_SXY] = pmPSF_SXYtoModel (out);
    289 
    290277    // the 2D PSF model fits polarization terms (E0,E1,E2)
    291278    // convert to shape terms (SXX,SYY,SXY)
    292     // XXX user-defined value for limit?
    293     if (!pmPSF_FitToModel (out, 0.1)) {
    294         // psError(PM_ERR_PSF, false, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     279    bool useReff = pmModelUseReff (modelPSF->type);
     280    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    295281        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    296282        return false;
     
    343329    // the 2D PSF model fits polarization terms (E0,E1,E2)
    344330    // convert to shape terms (SXX,SYY,SXY)
    345     // XXX user-defined value for limit?
    346     if (!pmPSF_FitToModel (PAR, 0.1)) {
     331    bool useReff = pmModelUseReff (model->type);
     332    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    347333        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    348334        return false;
Note: See TracChangeset for help on using the changeset viewer.