IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 17, 2009, 2:26:32 PM (17 years ago)
Author:
eugene
Message:

change radius for extended sources to use footprint; clean up some of the visualizations; plug some leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psphot/src/psphotRadiusChecks.c

    r21183 r25433  
    8686
    8787// call this function whenever you (re)-define the EXT model
     88float psphotSetRadiusEXT (pmReadout *readout, pmSource *source, psImageMaskType markVal) {
     89
     90    psAssert (source, "source not defined??");
     91    psAssert (source->peak, "peak not defined??");
     92
     93    pmPeak *peak = source->peak;
     94
     95    // set the radius based on the footprint:
     96    if (!peak->footprint) goto escape;
     97    pmFootprint *footprint = peak->footprint;
     98    if (!footprint->spans) goto escape;
     99    if (footprint->spans->n < 1) goto escape;
     100
     101    // find the max radius
     102    float radius = 0.0;
     103    for (int j = 0; j < footprint->spans->n; j++) {
     104        pmSpan *span = footprint->spans->data[j];
     105
     106        float dY  = span->y  - peak->yf;
     107        float dX0 = span->x0 - peak->xf;
     108        float dX1 = span->x1 - peak->xf;
     109
     110        radius = PS_MAX (radius, hypot(dY, dX0));
     111        radius = PS_MAX (radius, hypot(dY, dX1));
     112    }
     113
     114    radius += EXT_FIT_PADDING;
     115    if (isnan(radius)) psAbort("error in radius");
     116
     117    // redefine the pixels if needed
     118    pmSourceRedefinePixels (source, readout, peak->xf, peak->yf, radius);
     119
     120    // set the mask to flag the excluded pixels
     121    psImageKeepCircle (source->maskObj, peak->xf, peak->yf, radius, "OR", markVal);
     122    return radius;
     123
     124escape:
     125    return NAN;
     126    // bool result = psphotCheckRadiusEXT_old (readout, source, model, markVal);
     127    // return result;
     128}
     129
     130// call this function whenever you (re)-define the EXT model
    88131bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model, psImageMaskType markVal) {
     132
     133    psAbort ("do not use this function");
    89134
    90135    psF32 *PAR = model->params->data.F32;
Note: See TracChangeset for help on using the changeset viewer.