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

    r31031 r31034  
    217217bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
    218218{
    219     pmMoments *moments = source->moments;
    220     pmPeak    *peak    = source->peak;
    221     psF32     *PAR  = model->params->data.F32;
    222 
    223     psEllipseMoments emoments;
    224     emoments.x2 = moments->Mxx;
    225     emoments.xy = moments->Mxy;
    226     emoments.y2 = moments->Myy;
    227 
    228     // force the axis ratio to be < 20.0
    229     psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0);
    230 
    231     if (!isfinite(axes.major)) return false;
    232     if (!isfinite(axes.minor)) return false;
    233     if (!isfinite(axes.theta)) return false;
    234 
    235     psEllipseShape shape = psEllipseAxesToShape (axes);
    236 
    237     if (!isfinite(shape.sx))  return false;
    238     if (!isfinite(shape.sy))  return false;
    239     if (!isfinite(shape.sxy)) return false;
    240 
    241     // the other parameters depend on the guess for PAR_7
     219    psF32 *PAR  = model->params->data.F32;
     220
     221    // sky is set to 0.0
     222    PAR[PM_PAR_SKY]  = 0.0;
     223
     224    // set the shape parameters
     225    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     226      return false;
     227    }
     228
     229    // the normalization is modified by the slope
    242230    float index = 0.5 / ALPHA;
    243231    float bn = 1.9992*index - 0.3271;
    244     // float fR = 1.0 / (sqrt(2.0) * pow (bn, index));
    245232    float Io = exp(0.5*bn);
    246233
    247     float Sxx = PS_MAX(0.5, shape.sx);
    248     float Syy = PS_MAX(0.5, shape.sy);
    249 
    250     PAR[PM_PAR_SKY]  = 0.0;
    251     PAR[PM_PAR_I0]   = peak->rawFlux / Io;
    252     PAR[PM_PAR_XPOS] = peak->xf;
    253     PAR[PM_PAR_YPOS] = peak->yf;
    254     // PAR[PM_PAR_SXX]  = Sxx * fR;
    255     // PAR[PM_PAR_SYY]  = Syy * fR;
    256     PAR[PM_PAR_SXX]  = Sxx;
    257     PAR[PM_PAR_SYY]  = Syy;
    258     PAR[PM_PAR_SXY]  = shape.sxy;
     234    // set the model normalization
     235    if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
     236      return false;
     237    }
     238    PAR[PM_PAR_I0] /= Io;
     239
     240    // set the model position
     241    if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) {
     242      return false;
     243    }
    259244
    260245    return(true);
Note: See TracChangeset for help on using the changeset viewer.