IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15910


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

Location:
trunk/psModules/src/detrend
Files:
2 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);
  • trunk/psModules/src/detrend/pmMaskBadPixels.h

    r15865 r15910  
    55 * @author Eugene Magnier, IfA
    66 *
    7  * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-12-16 22:22:06 $
     7 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-12-24 21:10:28 $
    99 * Copyright 2004 Institute for Astronomy, University of Hawaii
    1010 */
     
    4242///
    4343/// Pixels more than "rej" standard deviations from the background level (in flat-fielded,
    44 /// background-subtracted images) have the corresponding pixel in the "suspect pixels" image incremented.
    45 /// After accumulating over a suitable sample of images, bad pixels should have a high value in the suspect
    46 /// pixels image, allowing them to be identified.  The suspect pixels image is of type S32.
     44/// background-subtracted images) have the corresponding pixel in the "suspect pixels" image
     45/// incremented.  After accumulating over a suitable sample of images, bad pixels should have a
     46/// high value in the suspect pixels image, allowing them to be identified.  The suspect pixels
     47/// image is of type S32.  The relevant median and standard deviation must be supplied in the
     48/// readout->analysis metadata as READOUT.MEDIAN, READOUT.STDEVe
    4749psImage *pmMaskFlagSuspectPixels(psImage *out, ///< Suspected bad pixels image, or NULL
    4850                                 const pmReadout *readout, ///< Readout to inspect
    4951                                 float rej, ///< Rejection threshold (standard deviations)
    50                                  psMaskType maskVal, ///< Mask value for statistics
    51                                  float frac, ///< Fraction of pixels to consider
    52                                  psRandom *rng ///< Random number generator
     52                                 psMaskType maskVal ///< Mask value for statistics
    5353                                );
    5454
Note: See TracChangeset for help on using the changeset viewer.