Changeset 18591
- Timestamp:
- Jul 16, 2008, 5:36:56 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
ppStack/src/ppStackLoop.c (modified) (3 diffs)
-
ppStack/src/ppStackMatch.c (modified) (6 diffs)
-
ppStack/src/ppStackReadout.c (modified) (6 diffs)
-
ppSub/src/ppSubLoop.c (modified) (3 diffs)
-
ppSub/src/ppSubReadout.c (modified) (8 diffs)
-
ppSub/test/fake.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackLoop.c
r18508 r18591 204 204 205 205 bool mdok; // Status of MD lookup 206 psMaskType maskBlank = psMetadataLookupU8(NULL, config->arguments, "MASK.BLANK"); // Mask for blank reg.207 206 bool tempDelete = psMetadataLookupBool(&mdok, config->arguments, "TEMP.DELETE"); // Delete temporary files? 208 207 const char *tempImage = psMetadataLookupStr(NULL, config->arguments, "TEMP.IMAGE"); // Suffix for temporary images … … 242 241 psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe 243 242 int overlap = 2 * psMetadataLookupS32(NULL, ppsub, "KERNEL.SIZE"); // Overlap by kernel size between consecutive scans 243 244 if (!pmConfigMaskSetBits(NULL, NULL, config)) { 245 psError(PS_ERR_UNKNOWN, false, "Unable to determine mask value."); 246 return false; 247 } 244 248 245 249 memDump("start"); … … 790 794 if (stats) { 791 795 psTrace("ppStack", 1, "Gathering statistics on stacked image....\n"); 792 ppStatsFPA(stats, outCell->parent->parent, view, maskBlank, config);796 ppStatsFPA(stats, outCell->parent->parent, view, pmConfigMaskGet("BLANK", config), config); 793 797 } 794 798 -
trunk/ppStack/src/ppStackMatch.c
r18559 r18591 30 30 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe 31 31 int size = psMetadataLookupS32(NULL, recipe, "KERNEL.SIZE"); // Kernel half-size 32 psMaskType maskBad = pmConfigMaskGet(psMetadataLookupStr(NULL, recipe, "MASK.BAD"), config); // Value to mask 32 33 psMaskType maskIn = pmConfigMaskGet("MASK.VALUE", config); // Bits to mask going in to pmSubtractionMatch 34 psMaskType maskOut = pmConfigMaskGet("BLANK", config); // Bits to mask after pmSubtractionMatch 35 33 36 bool mdok; // Status of MD lookup 34 37 bool renorm = psMetadataLookupBool(&mdok, config->arguments, "RENORM"); // Renormalise variances? … … 41 44 float penalty = psMetadataLookupF32(NULL, config->arguments, "PENALTY"); // Penalty for wideness 42 45 43 if (!pmReadoutMaskNonfinite(readout, mask Bad)) {46 if (!pmReadoutMaskNonfinite(readout, maskIn)) { 44 47 psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in readout."); 45 48 return false; … … 64 67 int ringsOrder = psMetadataLookupS32(NULL, recipe, "RINGS.ORDER"); // RINGS polynomial order 65 68 int binning = psMetadataLookupS32(NULL, recipe, "SPAM.BINNING"); // Binning for SPAM kernel 66 psMaskType maskBlank = pmConfigMaskGet(psMetadataLookupStr(NULL, recipe, "MASK.BLANK"),67 config); // Mask for blank reg.68 69 float badFrac = psMetadataLookupF32(NULL, recipe, "BADFRAC"); // Maximum bad fraction 69 70 bool optimum = psMetadataLookupBool(&mdok, recipe, "OPTIMUM"); // Derive optimum parameters? … … 114 115 sources, stampsName, type, size, order, widths, orders, inner, ringsOrder, 115 116 binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, 116 mask Bad, maskBlank, badFrac, PM_SUBTRACTION_MODE_1)) {117 maskIn, maskOut, badFrac, PM_SUBTRACTION_MODE_1)) { 117 118 psError(PS_ERR_UNKNOWN, false, "Unable to match images."); 118 119 psFree(fake); … … 200 201 if (renorm) { 201 202 psLogMsg("ppStack", PS_LOG_INFO, "Renormalising variance map."); 202 if (!pmReadoutWeightRenorm(readout, mask Bad, renormMean, renormStdev, renormWidth, rng)) {203 if (!pmReadoutWeightRenorm(readout, maskOut, renormMean, renormStdev, renormWidth, rng)) { 203 204 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances."); 204 205 psFree(output); … … 209 210 // Ensure the background value is zero 210 211 psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for background 211 if (!psImageBackground(bg, NULL, readout->image, readout->mask, mask Bad, rng)) {212 if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskOut, rng)) { 212 213 psWarning("Can't measure background for image."); 213 214 psErrorClear(); -
trunk/ppStack/src/ppStackReadout.c
r18435 r18591 32 32 int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); // Rejection iterations 33 33 float combineRej = psMetadataLookupF32(NULL, config->arguments, "COMBINE.REJ"); // Combination threshold 34 psMaskType maskBad = psMetadataLookupU8(NULL, config->arguments, "MASK.BAD"); // Value to mask 35 psMaskType maskBlank = psMetadataLookupU8(NULL, config->arguments, "MASK.BLANK"); // Mask for blank reg. 36 // float threshold = psMetadataLookupF32(NULL, config->arguments, "THRESHOLD.MASK"); // Threshold for mask deconvolution 34 psMaskType maskVal = pmConfigMaskGet("BLANK", config); // Value to mask 37 35 bool useVariance = psMetadataLookupBool(&mdok, config->arguments, "VARIANCE"); // Use variance for rejection? 38 36 bool safe = psMetadataLookupBool(&mdok, config->arguments, "SAFE"); // Play safe when combining small numbers of pixels? … … 67 65 } 68 66 69 if (!pmStackCombine(outRO, stack, mask Bad, maskBlank, kernelSize, iter, combineRej, true,67 if (!pmStackCombine(outRO, stack, maskVal, maskVal, kernelSize, iter, combineRej, true, 70 68 useVariance, safe)) { 71 69 psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection."); … … 93 91 psRegionSet(0, outRO->image->numCols - 1, 94 92 0, outRO->image->numRows - 1), 95 mask Blank);93 maskVal); 96 94 psString name = NULL; // Name of image 97 95 psStringAppend(&name, "inspect_%03d_%03d.fits", sectionNum, i); … … 140 138 // Get the recipe values 141 139 bool mdok; // Status of MD lookup 142 psMaskType maskBad = psMetadataLookupU8(NULL, config->arguments, "MASK.BAD"); // Value to mask 143 psMaskType maskBlank = psMetadataLookupU8(NULL, config->arguments, "MASK.BLANK"); // Mask for blank reg. 140 psMaskType maskVal = pmConfigMaskGet("BLANK", config); // Value to mask 144 141 bool useVariance = psMetadataLookupBool(&mdok, config->arguments, "VARIANCE"); // Use variance for rejection? 145 142 … … 208 205 psRegionSet(0, outRO->image->numCols - 1, 209 206 0, outRO->image->numRows - 1), 210 mask Blank);207 maskVal); 211 208 psString name = NULL; // Name of image 212 209 psStringAppend(&name, "reject_%03d.fits", i); … … 220 217 #endif 221 218 222 if (!pmStackCombine(outRO, stack, mask Bad, maskBlank, 0, 0, NAN, numGood != num, useVariance, false)) {219 if (!pmStackCombine(outRO, stack, maskVal, maskVal, 0, 0, NAN, numGood != num, useVariance, false)) { 223 220 psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts."); 224 221 psFree(fpaList); -
trunk/ppSub/src/ppSubLoop.c
r18559 r18591 14 14 bool ppSubLoop(pmConfig *config) 15 15 { 16 // Value to mask17 psMaskType maskBlank = pmConfigMaskGet(psMetadataLookupStr(NULL, config->arguments, "MASK.BLANK"), config) |18 pmConfigMaskGet(psMetadataLookupStr(NULL, config->arguments, "MASK.BAD"),19 config); // Mask for subtracted image20 21 16 bool mdok; // Status of MD lookup 22 17 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics … … 34 29 } 35 30 psFree(resolved); 31 } 32 33 if (!pmConfigMaskSetBits(NULL, NULL, config)) { 34 psError(PS_ERR_UNKNOWN, false, "Unable to determine mask value."); 35 return false; 36 36 } 37 37 … … 147 147 return false; 148 148 } 149 ppStatsFPA(stats, output->fpa, view, maskBlank, config);149 ppStatsFPA(stats, output->fpa, view, pmConfigMaskGet("BLANK", config), config); 150 150 } 151 151 -
trunk/ppSub/src/ppSubReadout.c
r18559 r18591 77 77 int binning = psMetadataLookupS32(NULL, config->arguments, "SPAM.BINNING"); // Binning for SPAM kernel 78 78 float penalty = psMetadataLookupF32(NULL, config->arguments, "PENALTY"); // Penalty for wideness 79 psMaskType maskBad = pmConfigMaskGet(psMetadataLookupStr(NULL, config->arguments, "MASK.BAD"), 80 config); // Value to mask 81 psMaskType maskBlank = pmConfigMaskGet(psMetadataLookupStr(NULL, config->arguments, "MASK.BLANK"), 82 config); // Mask for blank reg. 79 psMaskType maskIn = pmConfigMaskGet("MASK.VALUE", config); // Bits to mask going in to pmSubtractionMatch 80 psMaskType maskOut = pmConfigMaskGet("BLANK", config); // Bits to mask after pmSubtractionMatch 83 81 float badFrac = psMetadataLookupF32(NULL, config->arguments, "BADFRAC"); // Maximum bad fraction 84 82 const char *stampsName = psMetadataLookupStr(&mdok, config->arguments, "STAMPS"); // Filename for stamps … … 115 113 } 116 114 117 if (!pmReadoutMaskNonfinite(inRO, mask Bad)) {115 if (!pmReadoutMaskNonfinite(inRO, maskIn)) { 118 116 psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in input."); 119 117 return false; 120 118 } 121 if (!pmReadoutMaskNonfinite(refRO, mask Bad)) {119 if (!pmReadoutMaskNonfinite(refRO, maskIn)) { 122 120 psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in reference."); 123 121 return false; … … 136 134 if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, regionSize, spacing, threshold, sources, 137 135 stampsName, type, size, order, widths, orders, inner, ringsOrder, binning, 138 penalty, optimum, optWidths, optOrder, optThresh, iter, rej, mask Bad,139 mask Blank, badFrac, mode)) {136 penalty, optimum, optWidths, optOrder, optThresh, iter, rej, maskIn, 137 maskOut, badFrac, mode)) { 140 138 psError(PS_ERR_UNKNOWN, false, "Unable to match images."); 141 139 psFree(inConv); … … 200 198 #ifdef TESTING 201 199 { 202 pmReadoutMaskApply(minuend, mask Blank);200 pmReadoutMaskApply(minuend, maskOut); 203 201 psFits *fits = psFitsOpen("minuend.fits", "w"); 204 202 psFitsWriteImage(fits, NULL, minuend->image, 0, NULL); … … 206 204 } 207 205 { 208 pmReadoutMaskApply(subtrahend, mask Blank);206 pmReadoutMaskApply(subtrahend, maskOut); 209 207 psFits *fits = psFitsOpen("subtrahend.fits", "w"); 210 208 psFitsWriteImage(fits, NULL, subtrahend->image, 0, NULL); … … 278 276 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; 279 277 280 pmReadoutMaskApply(outRO, mask Blank);278 pmReadoutMaskApply(outRO, maskOut); 281 279 282 280 psFree(inConv); … … 286 284 for (int y = 0; y < outRO->image->numRows; y++) { 287 285 for (int x = 0; x < outRO->image->numCols; x++) { 288 if (isnan(outRO->image->data.F32[y][x]) && !(outRO->mask->data.U8[y][x] & mask Blank)) {286 if (isnan(outRO->image->data.F32[y][x]) && !(outRO->mask->data.U8[y][x] & maskOut)) { 289 287 printf("Unmasked NAN at %d %d --> %d\n", x, y, outRO->mask->data.U8[y][x]); 290 288 } … … 301 299 if (renorm) { 302 300 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator 303 if (!pmReadoutWeightRenorm(outRO, mask Blank, PS_STAT_ROBUST_MEDIAN, PS_STAT_ROBUST_STDEV,301 if (!pmReadoutWeightRenorm(outRO, maskOut, PS_STAT_ROBUST_MEDIAN, PS_STAT_ROBUST_STDEV, 304 302 renormWidth, rng)) { 305 303 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise weights for photometry."); -
trunk/ppSub/test/fake.c
r18289 r18591 7 7 8 8 // PSF for images 9 #define X_AXIS_1 2.0 // Length of x axis (FWHM) for image 19 #define X_AXIS_1 5.0 // Length of x axis (FWHM) for image 1 10 10 #define Y_AXIS_1 3.0 // Length of y axis (FWHM) for image 1 11 #define X_AXIS_2 3.0 // Length of x axis (FWHM) for image 112 #define Y_AXIS_2 2.0 // Length of y axis (FWHM) for image 111 #define X_AXIS_2 5.0 // Length of x axis (FWHM) for image 1 12 #define Y_AXIS_2 5.0 // Length of y axis (FWHM) for image 1 13 13 14 14 // Image parameters
Note:
See TracChangeset
for help on using the changeset viewer.
