- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ppStack/src (modified) (1 prop)
-
ppStack/src/ppStackReject.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ppStack/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppStackVersionDefinitions.h 12 ppStackErrorCodes.c 13 ppStackErrorCodes.h
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/ppStack/src/ppStackReject.c
r23573 r27840 9 9 #include "ppStack.h" 10 10 #include "ppStackLoop.h" 11 12 // #define TESTING 11 13 12 14 bool ppStackReject(ppStackOptions *options, pmConfig *config) … … 21 23 22 24 int num = options->num; // Number of inputs 23 options->rejected = psArrayAlloc(num);24 25 25 26 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe … … 30 31 31 32 float threshold = psMetadataLookupF32(NULL, recipe, "THRESHOLD.MASK"); // Threshold for mask deconvolution 32 float poorFrac = psMetadataLookupF32(NULL, recipe, "POOR.FRACTION"); // Fraction for "poor"33 33 float imageRej = psMetadataLookupF32(NULL, recipe, "IMAGE.REJ"); // Maximum fraction of image to reject 34 34 // before rejecting entire image … … 51 51 psThreadJob *job = psThreadJobAlloc("PPSTACK_INSPECT"); // Job to start 52 52 psArrayAdd(job->args, 1, options->inspect); 53 psArrayAdd(job->args, 1, options->rejected); 53 54 PS_ARRAY_ADD_SCALAR(job->args, i, PS_TYPE_S32); 54 55 if (!psThreadJobAddPending(job)) { … … 59 60 } 60 61 if (!psThreadPoolWait(true)) { 61 psError( PS_ERR_UNKNOWN, false, "Unable to concatenate inspection lists.");62 psError(psErrorCodeLast(), false, "Unable to concatenate inspection lists."); 62 63 return false; 63 64 } … … 90 91 #endif 91 92 92 psPixels *reject = pmStackReject(options->inspect->data[i], options->numCols, options->numRows,93 threshold, poorFrac, stride, options->regions->data[i],94 options->kernels->data[i]); // Rejected pixels95 96 93 #ifdef TESTING 97 94 { 98 psImage *mask = psPixelsToMask(NULL, reject,95 psImage *mask = psPixelsToMask(NULL, options->rejected->data[i], 99 96 psRegionSet(0, options->numCols - 1, 0, options->numRows - 1), 100 97 0xff); // Mask image 101 98 psString name = NULL; // Name of image 102 psStringAppend(&name, " reject_%03d.fits", i);99 psStringAppend(&name, "pre_reject_%03d.fits", i); 103 100 pmStackVisualPlotTestImage(mask, name); 104 101 psFits *fits = psFitsOpen(name, "w"); … … 109 106 } 110 107 #endif 108 109 psPixels *reject = pmStackReject(options->inspect->data[i], options->numCols, options->numRows, 110 threshold, stride, options->regions->data[i], 111 options->kernels->data[i]); // Rejected pixels 111 112 112 113 psFree(options->inspect->data[i]); … … 125 126 "exceeds limit (%.3f)", i, frac, imageRej); 126 127 psFree(reject); 127 // reject == NULL means reject image completely128 128 reject = NULL; 129 129 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_BAD; 130 130 numRejected++; 131 } else { 132 // Add to list of pixels already rejected 133 reject = psPixelsConcatenate(reject, options->rejected->data[i]); 134 options->rejected->data[i] = psPixelsDuplicates(options->rejected->data[i], reject); 131 135 } 132 136 } 133 137 134 // Images without a list of rejected pixels (the list may be empty) are rejected completely 135 options->rejected->data[i] = reject; 138 #ifdef TESTING 139 { 140 psImage *mask = psPixelsToMask(NULL, options->rejected->data[i], 141 psRegionSet(0, options->numCols - 1, 0, options->numRows - 1), 142 0xff); // Mask image 143 psString name = NULL; // Name of image 144 psStringAppend(&name, "reject_%03d.fits", i); 145 pmStackVisualPlotTestImage(mask, name); 146 psFits *fits = psFitsOpen(name, "w"); 147 psFree(name); 148 psFitsWriteImage(fits, NULL, mask, 0, NULL); 149 psFree(mask); 150 psFitsClose(fits); 151 } 152 #endif 136 153 137 154 if (options->stats) { … … 141 158 "Number of pixels rejected", reject ? reject->n : 0); 142 159 } 160 161 psFree(reject); 143 162 psLogMsg("ppStack", PS_LOG_INFO, "Time to perform rejection on image %d: %f sec", i, 144 163 psTimerClear("PPSTACK_REJECT")); … … 146 165 147 166 psFree(options->inspect); options->inspect = NULL; 148 psFree(options->kernels); options->kernels = NULL;149 psFree(options->regions); options->regions = NULL;150 167 151 if (numRejected >= num - 1) {152 psError(P S_ERR_UNKNOWN, true, "All inputs completely rejected; unable to proceed.");168 if (numRejected >= num) { 169 psError(PPSTACK_ERR_REJECTED, true, "All inputs completely rejected; unable to proceed."); 153 170 return false; 154 171 }
Note:
See TracChangeset
for help on using the changeset viewer.
