Changeset 15910
- Timestamp:
- Dec 24, 2007, 11:10:28 AM (18 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 2 edited
-
pmMaskBadPixels.c (modified) (2 diffs)
-
pmMaskBadPixels.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmMaskBadPixels.c
r15865 r15910 82 82 83 83 psImage *pmMaskFlagSuspectPixels(psImage *out, const pmReadout *readout, float rej, 84 psMaskType maskVal , float frac, psRandom *rng)84 psMaskType maskVal) 85 85 { 86 86 PS_ASSERT_PTR_NON_NULL(readout, NULL); 87 87 PS_ASSERT_FLOAT_LARGER_THAN(rej, 0.0, NULL); 88 PS_ASSERT_FLOAT_WITHIN_RANGE(frac, 0.0, 1.0, NULL);89 88 PS_ASSERT_IMAGE_NON_NULL(readout->image, NULL); 90 89 PS_ASSERT_IMAGE_NON_EMPTY(readout->image, NULL); … … 101 100 } 102 101 102 bool status; 103 103 psImage *image = readout->image; // Image of interest 104 104 psImage *mask = readout->mask; // Corresponding mask 105 105 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 } 127 117 128 118 psTrace ("psModules.detrend", 3, "suspect: %f +/- %f\n", median, stdev); -
trunk/psModules/src/detrend/pmMaskBadPixels.h
r15865 r15910 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.1 4$ $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 $ 9 9 * Copyright 2004 Institute for Astronomy, University of Hawaii 10 10 */ … … 42 42 /// 43 43 /// 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 47 49 psImage *pmMaskFlagSuspectPixels(psImage *out, ///< Suspected bad pixels image, or NULL 48 50 const pmReadout *readout, ///< Readout to inspect 49 51 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 53 53 ); 54 54
Note:
See TracChangeset
for help on using the changeset viewer.
