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/pmModelUtils.c

    r29004 r31034  
    107107    return true;
    108108}
     109
     110bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments) {
     111
     112    psEllipseMoments emoments;
     113    emoments.x2 = moments->Mxx;
     114    emoments.xy = moments->Mxy;
     115    emoments.y2 = moments->Myy;
     116
     117    // force the axis ratio to be < 20.0
     118    psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0);
     119
     120    if (!isfinite(axes.major)) return false;
     121    if (!isfinite(axes.minor)) return false;
     122    if (!isfinite(axes.theta)) return false;
     123
     124    psEllipseShape shape = psEllipseAxesToShape (axes);
     125
     126    if (!isfinite(shape.sx))  return false;
     127    if (!isfinite(shape.sy))  return false;
     128    if (!isfinite(shape.sxy)) return false;
     129
     130    // set the shape parameters
     131    *Sxx  = PS_MAX(0.5, M_SQRT2*shape.sx);
     132    *Syy  = PS_MAX(0.5, M_SQRT2*shape.sy);
     133    *Sxy  = shape.sxy;
     134
     135    return true;
     136}
     137
     138bool pmModelSetNorm (float *Io, pmSource *source) {
     139
     140    *Io = source->peak->rawFlux;
     141    if (!isfinite(*Io) && !source->moments) return false;
     142
     143    *Io = source->moments->Peak;
     144    if (!isfinite(*Io)) return false;
     145
     146    return true;
     147}
     148
     149bool pmModelSetPosition (float *Xo, float *Yo, pmSource *source) {
     150
     151    bool useMoments = pmSourcePositionUseMoments(source);
     152   
     153    if (useMoments) {
     154        *Xo = source->moments->Mx;
     155        *Yo = source->moments->My;
     156    } else {
     157        *Xo = source->peak->xf;
     158        *Yo = source->peak->yf;
     159    }
     160
     161    return true;
     162}
Note: See TracChangeset for help on using the changeset viewer.