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

    r31031 r31034  
    203203bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
    204204{
    205     pmMoments *moments = source->moments;
    206     pmPeak    *peak    = source->peak;
    207     psF32     *PAR  = model->params->data.F32;
    208 
    209     psEllipseMoments emoments;
    210     emoments.x2 = moments->Mxx;
    211     emoments.xy = moments->Mxy;
    212     emoments.y2 = moments->Myy;
    213 
    214     // force the axis ratio to be < 20.0
    215     psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0);
    216 
    217     if (!isfinite(axes.major)) return false;
    218     if (!isfinite(axes.minor)) return false;
    219     if (!isfinite(axes.theta)) return false;
    220 
    221     psEllipseShape shape = psEllipseAxesToShape (axes);
    222 
    223     if (!isfinite(shape.sx))  return false;
    224     if (!isfinite(shape.sy))  return false;
    225     if (!isfinite(shape.sxy)) return false;
    226 
     205    psF32 *PAR  = model->params->data.F32;
     206
     207    // sky is set to 0.0
    227208    PAR[PM_PAR_SKY]  = 0.0;
    228     PAR[PM_PAR_I0]   = peak->rawFlux;
    229     PAR[PM_PAR_XPOS] = peak->xf;
    230     PAR[PM_PAR_YPOS] = peak->yf;
    231     PAR[PM_PAR_SXX]  = PS_MAX(0.5, shape.sx);
    232     PAR[PM_PAR_SYY]  = PS_MAX(0.5, shape.sy);
    233     PAR[PM_PAR_SXY]  = shape.sxy;
     209
     210    // set the shape parameters
     211    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     212      return false;
     213    }
     214
     215    // set the model normalization
     216    if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
     217      return false;
     218    }
     219
     220    // set the model position
     221    if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) {
     222      return false;
     223    }
     224
     225    // extra parameter
    234226    PAR[PM_PAR_7]    = 1.5;
    235227
Note: See TracChangeset for help on using the changeset viewer.