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

    r17516 r18555  
    1010// the analysis is performed wrt the simulated pixel values
    1111
    12 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER);
     12static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psMaskType markVal);
    1313
    1414bool psphotFitSourcesLinear (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, bool final) {
     
    2222    psTimerStart ("psphot");
    2323
    24     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
    25     psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
     24    // bit-masks to test for good/bad pixels
     25    psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT");
    2626    assert (maskVal);
     27
     28    // bit-mask to mark pixels not used in analysis
     29    psMaskType markVal = psMetadataLookupU8(&status, recipe, "MARK.PSPHOT");
     30    assert (markVal);
     31
     32    // maskVal is used to test for rejected pixels, and must include markVal
     33    maskVal |= markVal;
    2734
    2835    // source analysis is done in spatial order
     
    157164
    158165    // set the sky, sky_x, sky_y components of border matrix
    159     SetBorderMatrixElements (border, readout, fitSources, CONSTANT_PHOTOMETRIC_WEIGHTS, SKY_FIT_ORDER);
     166    SetBorderMatrixElements (border, readout, fitSources, CONSTANT_PHOTOMETRIC_WEIGHTS, SKY_FIT_ORDER, markVal);
    160167    psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "set border: %f (%d elements)\n", psTimerMark ("psphot"), sparse->Nelem);
    161168
     
    221228// on the pixels which correspond to all of the sources of interest.  These elements fill in
    222229// the border matrix components in the sparse matrix equation.
    223 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER) {
     230static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psMaskType markVal) {
    224231
    225232    // generate the image-wide weight terms
     
    227234    psRegion fullArray = psRegionSet (0, 0, 0, 0);
    228235    fullArray = psRegionForImage (readout->mask, fullArray);
    229     psImageMaskRegion (readout->mask, fullArray, "OR", PM_MASK_MARK);
     236    psImageMaskRegion (readout->mask, fullArray, "OR", markVal);
    230237    psLogMsg ("psphot.ensemble", PS_LOG_INFO, "step 1: %f sec\n", psTimerMark ("psphot"));
    231238
     
    237244        float x = model->params->data.F32[PM_PAR_XPOS];
    238245        float y = model->params->data.F32[PM_PAR_YPOS];
    239         psImageMaskCircle (source->maskView, x, y, model->radiusFit, "AND", PS_NOT_U8(PM_MASK_MARK));
     246        psImageMaskCircle (source->maskView, x, y, model->radiusFit, "AND", PS_NOT_U8(markVal));
    240247    }
    241248    psLogMsg ("psphot.ensemble", PS_LOG_INFO, "step 2: %f sec\n", psTimerMark ("psphot"));
     
    279286
    280287    // turn off MARK for all image pixels
    281     psImageMaskRegion (readout->mask, fullArray, "AND", PS_NOT_U8(PM_MASK_MARK));
     288    psImageMaskRegion (readout->mask, fullArray, "AND", PS_NOT_U8(markVal));
    282289    psLogMsg ("psphot.ensemble", PS_LOG_INFO, "step 4: %f sec\n", psTimerMark ("psphot"));
    283290
Note: See TracChangeset for help on using the changeset viewer.