IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 24, 2007, 11:10:28 AM (18 years ago)
Author:
eugene
Message:

removed stats calculation from pmMaskFlagSuspectPixels; now requires stats in the readout->analysis metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmMaskBadPixels.c

    r15865 r15910  
    8282
    8383psImage *pmMaskFlagSuspectPixels(psImage *out, const pmReadout *readout, float rej,
    84                                  psMaskType maskVal, float frac, psRandom *rng)
     84                                 psMaskType maskVal)
    8585{
    8686    PS_ASSERT_PTR_NON_NULL(readout, NULL);
    8787    PS_ASSERT_FLOAT_LARGER_THAN(rej, 0.0, NULL);
    88     PS_ASSERT_FLOAT_WITHIN_RANGE(frac, 0.0, 1.0, NULL);
    8988    PS_ASSERT_IMAGE_NON_NULL(readout->image, NULL);
    9089    PS_ASSERT_IMAGE_NON_EMPTY(readout->image, NULL);
     
    101100    }
    102101
     102    bool status;
    103103    psImage *image = readout->image;    // Image of interest
    104104    psImage *mask = readout->mask;      // Corresponding mask
    105105
    106     if (rng) {
    107         psMemIncrRefCounter(rng);
    108     } else {
    109         rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
    110     }
    111 
    112     // XXX note that this now will accept any of several stats options
    113     psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
    114     stats->nSubsample = frac * image->numCols * image->numRows;
    115     if (!psImageBackground(stats, NULL, image, mask, maskVal, rng) ||
    116             !isfinite(stats->robustMedian) || !isfinite(stats->robustUQ) || !isfinite(stats->robustLQ)) {
    117         psError(PS_ERR_UNKNOWN, false, "Unable to measure image statistics.\n");
    118         psFree(stats);
    119         psFree(rng);
    120         return NULL;
    121     }
    122     psFree(rng);
    123 
    124     float median = stats->robustMedian; // Median value
    125     float stdev = stats->robustStdev; // Estimate of the standard deviation
    126     psFree(stats);
     106    float median = psMetadataLookupF32 (&status, readout->analysis, "READOUT.MEDIAN");
     107    if (!status) {
     108        psError(PS_ERR_PROGRAMMING, true, "Missing READOUT.MEDIAN from readout analysis data");
     109        return NULL;
     110    }
     111
     112    float stdev  = psMetadataLookupF32 (&status, readout->analysis, "READOUT.STDEV");
     113    if (!status) {
     114        psError(PS_ERR_PROGRAMMING, true, "Missing READOUT.STDEV from readout analysis data");
     115        return NULL;
     116    }
    127117
    128118    psTrace ("psModules.detrend", 3, "suspect: %f +/- %f\n", median, stdev);
Note: See TracChangeset for help on using the changeset viewer.