IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 24, 2011, 11:39:04 AM (15 years ago)
Author:
eugene
Message:

unify code for model guesses (Io; Xo,Yo; Sxx,Sxy,Syy); use the moment peak if the peak flux is nan; skip sources without a valid Io guess

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_QGAUSS.c

    r31031 r31034  
    214214bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
    215215{
    216     pmMoments *moments = source->moments;
    217     pmPeak    *peak    = source->peak;
    218     psF32     *PAR  = model->params->data.F32;
    219 
    220     psEllipseMoments emoments;
    221     emoments.x2 = moments->Mxx;
    222     emoments.xy = moments->Mxy;
    223     emoments.y2 = moments->Myy;
    224 
    225     // force the axis ratio to be < 20.0
    226     psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0);
    227 
    228     if (!isfinite(axes.major)) return false;
    229     if (!isfinite(axes.minor)) return false;
    230     if (!isfinite(axes.theta)) return false;
    231 
    232     psEllipseShape shape = psEllipseAxesToShape (axes);
    233 
    234     if (!isfinite(shape.sx))  return false;
    235     if (!isfinite(shape.sy))  return false;
    236     if (!isfinite(shape.sxy)) return false;
    237 
     216    psF32 *PAR  = model->params->data.F32;
     217
     218    // sky is set to 0.0
    238219    PAR[PM_PAR_SKY]  = 0.0;
    239     PAR[PM_PAR_I0]   = peak->rawFlux;
    240     PAR[PM_PAR_XPOS] = peak->xf;
    241     PAR[PM_PAR_YPOS] = peak->yf;
    242     PAR[PM_PAR_SXX]  = PS_MAX(0.5, M_SQRT2*shape.sx);
    243     PAR[PM_PAR_SYY]  = PS_MAX(0.5, M_SQRT2*shape.sy);
    244     PAR[PM_PAR_SXY]  = shape.sxy;
     220
     221    // set the shape parameters
     222    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     223      return false;
     224    }
     225
     226    // set the model normalization
     227    if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
     228      return false;
     229    }
     230
     231    // set the model position
     232    if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) {
     233      return false;
     234    }
     235
     236    // extra parameter
    245237    PAR[PM_PAR_7]    = 1.0;
    246238
Note: See TracChangeset for help on using the changeset viewer.