IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 15, 2008, 10:25:50 AM (18 years ago)
Author:
eugene
Message:

re-org and cleanup of the mask bits to make it consistent with the pmConfigMaskSetBits concepts; ensure mark and mask are correctly used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotSourceFits.c

    r17396 r18555  
    2121}
    2222
    23 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal) {
     23bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal) {
    2424
    2525    float x, y, dR;
     26
     27    // maskVal is used to test for rejected pixels, and must include markVal
     28    maskVal |= markVal;
    2629
    2730    // if this source is not a possible blend, just fit as PSF
    2831    if ((source->blends == NULL) || (source->mode & PM_SOURCE_MODE_SATSTAR)) {
    29         bool status = psphotFitPSF (readout, source, psf, maskVal);
     32        bool status = psphotFitPSF (readout, source, psf, maskVal, markVal);
    3033        return status;
    3134    }
     
    8083
    8184    // extend source radius as needed
    82     psphotCheckRadiusPSFBlend (readout, source, PSF, dR);
     85    psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, dR);
    8386
    8487    // fit PSF model (set/unset the pixel mask)
     
    139142}
    140143
    141 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal) {
     144bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal) {
    142145
    143146    double chiTrend;
     147
     148    // maskVal is used to test for rejected pixels, and must include markVal
     149    maskVal |= markVal;
    144150
    145151    NfitPSF ++;
     
    150156
    151157    // extend source radius as needed
    152     psphotCheckRadiusPSF (readout, source, PSF);
     158    psphotCheckRadiusPSF (readout, source, PSF, markVal);
    153159
    154160    // fit PSF model (set/unset the pixel mask)
     
    197203}
    198204
    199 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal) {
     205bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal, psMaskType markVal) {
    200206
    201207    bool okEXT, okDBL;
     
    215221    psTrace ("psphot", 5, "trying blob...\n");
    216222
    217     // psTraceSetLevel("psModules.objects.pmSourceFitSet", 5);
     223    // maskVal is used to test for rejected pixels, and must include markVal
     224    maskVal |= markVal;
    218225
    219226    // this temporary source is used as a place-holder by the psphotEval functions below
    220227    pmSource *tmpSrc = pmSourceAlloc ();
    221228
    222     pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal);
     229    pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal);
    223230    okEXT = psphotEvalEXT (tmpSrc, EXT);
    224231    chiEXT = EXT->chisq / EXT->nDOF;
    225232
    226     psArray *DBL = psphotFitDBL (readout, source, maskVal);
     233    psArray *DBL = psphotFitDBL (readout, source, maskVal, markVal);
    227234    okDBL  = psphotEvalDBL (tmpSrc, DBL->data[0]);
    228235    okDBL &= psphotEvalDBL (tmpSrc, DBL->data[1]);
     
    306313
    307314// fit a double PSF source to an extended blob
    308 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal) {
     315psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal, psMaskType markVal) {
    309316
    310317    float dx, dy;
     
    317324    NfitDBL ++;
    318325
     326    // maskVal is used to test for rejected pixels, and must include markVal
     327    maskVal |= markVal;
     328
    319329    // make a guess at the position of the two sources
    320330    moments.x2 = source->moments->Sx;
     
    329339    // save the PSF model from the Ensemble fit
    330340    PSF = source->modelPSF;
    331     psphotCheckRadiusPSFBlend (readout, source, PSF, 8.0);
     341    psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0);
    332342    if (isnan(PSF->params->data.F32[1])) psAbort("nan in dbl fit");
    333343
     
    351361}
    352362
    353 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal) {
     363pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, psMaskType markVal) {
    354364
    355365    NfitEXT ++;
     366
     367    // maskVal is used to test for rejected pixels, and must include markVal
     368    maskVal |= markVal;
    356369
    357370    // use the source moments, etc to guess basic model parameters
     
    361374    // if (isnan(EXT->params->data.F32[1])) psAbort("nan in ext fit");
    362375
    363     psphotCheckRadiusEXT (readout, source, EXT);
     376    psphotCheckRadiusEXT (readout, source, EXT, markVal);
    364377
    365378    if ((source->moments->Sx < 1e-3) || (source->moments->Sx < 1e-3)) {
Note: See TracChangeset for help on using the changeset viewer.