IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32241


Ignore:
Timestamp:
Aug 31, 2011, 12:44:09 PM (15 years ago)
Author:
eugene
Message:

remove moments recalculation (we now trust the kron mag analysis)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/psphot/src/psphotSourceFits.c

    r32157 r32241  
    217217    pmModel *EXT = NULL;
    218218    psArray *DBL = NULL;
    219     pmMoments psfMoments;
     219    // pmMoments psfMoments;
    220220
    221221    // skip the source if we don't think it is extended
     
    225225    if (source->type == PM_SOURCE_TYPE_SATURATED) return false;
    226226
    227 # define TEST_X -540.0
    228 # define TEST_Y 540.0
     227# define TEST_X -420.0
     228# define TEST_Y 300.0
    229229   
    230230    if ((fabs(source->peak->xf - TEST_X) < 5) && (fabs(source->peak->yf - TEST_Y) < 5)) {
     
    238238    if (!psphotSetRadiusMoments(&fitRadius, &windowRadius, readout, source, markVal)) return false;
    239239    // fprintf (stderr, "rad: %6.1f %6.1f  | %5.2f %5.2f %5.2f  ", source->peak->xf, source->peak->yf, source->moments->Mrf, fitRadius, windowRadius);
    240 
    241     // XXX note that this changes the source moments that are published...
    242     // XXX all published moments should use the same measurement
    243     // recalculate the source moments using the larger extended-source moments radius
    244     // at this stage, skip Gaussian windowing, and do not clip pixels by S/N
    245     // this uses the footprint to judge both radius and aperture?
    246     // XXX save the psf-based moments for output
    247     // XXX do not limit to pixels in the marked circle
    248     psfMoments = *source->moments;
    249     if (!pmSourceMoments (source, windowRadius, 0.0, 0.5, 0.0, maskVal & PS_NOT_IMAGE_MASK(markVal))) {
    250       *source->moments = psfMoments;
    251       fprintf (stderr, "skip (bad moments)\n");
    252       return false;
    253     }
    254     // fprintf (stderr, "r1: %f\n", source->moments->Mrf);
    255 
    256     // XXX note that we do not re-try to measure the moments if the resulting Mrf is large compared
    257     // to the initial value
    258240
    259241    psTrace ("psphot", 5, "trying blob...\n");
     
    312294
    313295    if (okEXT && okDBL) {
    314         psTrace ("psphot", 5, "blob chisq: %f vs %f\n", chiEXT, chiDBL);
    315296        // XXX EAM : a bogus bias: need to examine this better
    316297        if (3*chiEXT > chiDBL) goto keepDBL;
     
    321302    if (!okEXT && okDBL) goto keepDBL;
    322303
     304    psTrace ("psphot", 4, "both failed: blob chisq: %f vs %f for %f,%f\n", chiEXT, chiDBL, source->peak->xf, source->peak->yf);
     305
    323306    // both models failed; reject them both
    324307    // XXX -- change type flags to psf in this case, and make sure we subtract it?
    325308    // reset the psf moments
    326     *source->moments = psfMoments;
     309    // XXX *source->moments = psfMoments;
    327310
    328311    psFree (EXT);
     
    331314
    332315keepEXT:
     316    psTrace ("psphot", 4, "goto EXT : blob chisq: %f vs %f for %f,%f\n", chiEXT, chiDBL, source->peak->xf, source->peak->yf);
    333317    // sub EXT
    334318    psFree (DBL);
     
    356340
    357341    // reset the psf moments
    358     *source->moments = psfMoments;
     342    // XXX *source->moments = psfMoments;
    359343    return true;
    360344
    361345keepDBL:
     346    psTrace ("psphot", 4, "goto DBL : blob chisq: %f vs %f for %f,%f\n", chiEXT, chiDBL, source->peak->xf, source->peak->yf);
    362347    // sub DLB
    363348    psFree (EXT);
     
    390375            psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, source->modelPSF->params->data.F32[i], source->modelPSF->dparams->data.F32[i]);
    391376        }
    392         psphotVisualShowResidualImage (readout, false);
    393377    }
    394378# endif
    395 
    396     // reset the (original) psf moments
    397     *source->moments = psfMoments;
    398     *newSrc->moments = psfMoments;
    399379
    400380    psArrayAdd (newSources, 100, newSrc);
     
    404384
    405385escape:
    406     // reset the psf moments
    407     *source->moments = psfMoments;
    408386    psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
    409387    psFree (tmpSrc);
     
    506484    pmSourceFitModel (source, model, &options, maskVal);
    507485    // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);
    508 
    509486    // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);
     487
    510488    return (model);
    511489}
Note: See TracChangeset for help on using the changeset viewer.