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

    r35560 r35768  
    129129    float q2 = NAN;
    130130    if (nParam == PM_PAR_SXY) {
    131         float f1 = 1.0 / PS_SQR(params[PM_PAR_SYY]) + 1.0 / PS_SQR(params[PM_PAR_SXX]);
    132         float f2 = 1.0 / PS_SQR(params[PM_PAR_SYY]) - 1.0 / PS_SQR(params[PM_PAR_SXX]);
     131        // NOTE: the factor of 2 is needed to convert par[SXX,SYY] to shape.sx,sy
     132        float f1 = 2.0 / PS_SQR(params[PM_PAR_SYY]) + 2.0 / PS_SQR(params[PM_PAR_SXX]);
     133        float f2 = 2.0 / PS_SQR(params[PM_PAR_SYY]) - 2.0 / PS_SQR(params[PM_PAR_SXX]);
    133134        float q1 = PS_SQR(f1)*AR_RATIO - PS_SQR(f2);
    134135        q1 = (q1 < 0.0) ? 0.0 : q1;
     
    201202
    202203    // set the shape parameters
    203     if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     204    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) {
    204205      return false;
    205206    }
     
    222223{
    223224    float z, norm;
    224     psEllipseShape shape;
    225225
    226226    psF32 *PAR = params->data.F32;
    227227
    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);
     228    psEllipseAxes axes;
     229    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
     230
    233231    float AspectRatio = axes.minor / axes.major;
    234232
     
    262260{
    263261    psF64 z;
    264     psEllipseShape shape;
    265262
    266263    psF32 *PAR = params->data.F32;
     
    273270        return (1.0);
    274271
    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);
     272    psEllipseAxes axes;
     273    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
     274
    281275    psF64 sigma = axes.major;
    282276
     
    347341    }
    348342
    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 
    352343    // the 2D PSF model fits polarization terms (E0,E1,E2)
    353344    // convert to shape terms (SXX,SYY,SXY)
    354     if (!pmPSF_FitToModel (out, 0.1)) {
     345    bool useReff = pmModelUseReff (modelPSF->type);
     346    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    355347        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    356348        return false;
     
    403395    // the 2D PSF model fits polarization terms (E0,E1,E2)
    404396    // convert to shape terms (SXX,SYY,SXY)
    405     // XXX user-defined value for limit?
    406     if (!pmPSF_FitToModel (PAR, 0.1)) {
     397    bool useReff = pmModelUseReff (model->type);
     398    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    407399        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    408400        return false;
Note: See TracChangeset for help on using the changeset viewer.