Changeset 24899
- Timestamp:
- Jul 22, 2009, 3:12:36 PM (17 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 2 edited
-
pmPattern.c (modified) (2 diffs)
-
pmPattern.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmPattern.c
r24891 r24899 7 7 8 8 9 // Mask a row as bad 10 static void patternMaskRow(pmReadout *ro, // Readout to mask 11 int y, // Row to mask 12 psImageMaskType bad // Mask value to give 13 ) 14 { 15 psImage *image = ro->image; // Image to mask 16 psAssert(image, "Require image"); 17 psAssert(y < image->numRows, "Row not in image"); 18 19 int numCols = image->numCols; // Size of image 20 for (int x = 0; x < numCols; x++) { 21 image->data.F32[y][x] = NAN; 22 } 23 if (ro->mask) { 24 psImage *mask = ro->mask; // Mask image to mask 25 for (int x = 0; x < numCols; x++) { 26 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= bad; 27 } 28 } 29 return; 30 } 31 9 32 bool pmPatternRow(pmReadout *ro, int order, int iter, float rej, 10 psStatsOptions clipMean, psStatsOptions clipStdev) 33 psStatsOptions clipMean, psStatsOptions clipStdev, 34 psImageMaskType maskBad) 11 35 { 12 36 PM_ASSERT_READOUT_NON_NULL(ro, false); … … 47 71 if (num < order + 1) { 48 72 // Not enough points to fit 73 patternMaskRow(ro, y, maskBad); 49 74 continue; 50 75 } 51 76 if (!psVectorClipFitPolynomial1D(poly, clip, mask, 0xFF, data, NULL, indices)) { 52 psError(PS_ERR_UNKNOWN, false, "Unable to fit polynomial to row %d", y); 53 psFree(indices); 54 psFree(clip); 55 psFree(mask); 56 psFree(poly); 57 psFree(data); 58 return false; 77 psWarning("Unable to fit polynomial to row %d", y); 78 psErrorClear(); 79 patternMaskRow(ro, y, maskBad); 80 continue; 59 81 } 60 82 psVector *solution = psPolynomial1DEvalVector(poly, indices); // Solution vector 61 83 if (!solution) { 62 psError(PS_ERR_UNKNOWN, false, "Unable to evaluate polynomial for row %d", y); 63 psFree(indices); 64 psFree(clip); 65 psFree(mask); 66 psFree(poly); 67 psFree(data); 68 return false; 84 psWarning("Unable to evaluate polynomial for row %d", y); 85 psErrorClear(); 86 patternMaskRow(ro, y, maskBad); 87 continue; 69 88 } 70 89 -
trunk/psModules/src/detrend/pmPattern.h
r24891 r24899 24 24 int iter, ///< Number of clipping iterations 25 25 float rej, ///< Rejection threshold for clipping 26 psStatsOptions clipMean, ///< Statistic to use for mean 27 psStatsOptions clipStdev ///< Statistic to use for standard deviation 26 psStatsOptions clipMean, ///< Statistic to use for mean 27 psStatsOptions clipStdev, ///< Statistic to use for standard deviation 28 psImageMaskType maskBad ///< Mask value to give bad pixels 28 29 ); 29 30
Note:
See TracChangeset
for help on using the changeset viewer.
