Changeset 18289
- Timestamp:
- Jun 23, 2008, 12:43:11 PM (18 years ago)
- Location:
- trunk/ppSub
- Files:
-
- 1 added
- 3 edited
-
src/ppSubArguments.c (modified) (2 diffs)
-
src/ppSubCamera.c (modified) (5 diffs)
-
src/ppSubReadout.c (modified) (8 diffs)
-
test/fake.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubArguments.c
r17813 r18289 186 186 psMetadataAddS32(arguments, PS_LIST_TAIL, "-order", 0, "Spatial polynomial order", -1); 187 187 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, "Kernel type (ISIS|POIS|SPAM|FRIES|GUNK|RINGS)", NULL); 188 psMetadataAddF32(arguments, PS_LIST_TAIL, "-penalty", 0, "Penalty for wideness", NAN); 188 189 psMetadataAddStr(arguments, PS_LIST_TAIL, "-isis-widths", 0, "ISIS Gaussian FWHMs (comma-separated)", NULL); 189 190 psMetadataAddStr(arguments, PS_LIST_TAIL, "-isis-orders", 0, "ISIS polynomial orders (comma-separated)", NULL); … … 260 261 VALUE_ARG_RECIPE_FLOAT("-rej", "REJ", F32); 261 262 VALUE_ARG_RECIPE_FLOAT("-badfrac", "BADFRAC", F32); 263 VALUE_ARG_RECIPE_FLOAT("-penalty", "PENALTY", F32); 262 264 263 265 valueArgRecipeStr(arguments, recipe, "-mask-bad", "MASK.BAD", config->arguments); -
trunk/ppSub/src/ppSubCamera.c
r17834 r18289 82 82 83 83 // Output image 84 pmFPAfile *output = pmFPAfileDefine Skycell(config, NULL, "PPSUB.OUTPUT");84 pmFPAfile *output = pmFPAfileDefineFromFile(config, input, 1, 1, "PPSUB.OUTPUT"); 85 85 if (!output) { 86 86 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT")); … … 94 94 95 95 // Output mask 96 pmFPAfile *outMask = pmFPAfileDefine Skycell(config, output->fpa, "PPSUB.OUTPUT.MASK");96 pmFPAfile *outMask = pmFPAfileDefineOutput(config, output->fpa, "PPSUB.OUTPUT.MASK"); 97 97 if (!outMask) { 98 98 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.MASK")); … … 107 107 // Output weight 108 108 if (inputWeight && refWeight) { 109 pmFPAfile *outWeight = pmFPAfileDefine Skycell(config, output->fpa, "PPSUB.OUTPUT.WEIGHT");109 pmFPAfile *outWeight = pmFPAfileDefineOutput(config, output->fpa, "PPSUB.OUTPUT.WEIGHT"); 110 110 if (!outWeight) { 111 111 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.WEIGHT")); … … 119 119 } 120 120 121 #if 0 121 122 if (!pmFPAAddSourceFromFormat(output->fpa, "Subtraction", output->format)) { 122 123 psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA."); 123 124 return false; 124 125 } 126 #endif 125 127 126 128 pmFPAfile *sources = pmFPAfileDefineFromArgs(&status, config, "PPSUB.SOURCES", "PPSUB.SOURCES"); … … 153 155 154 156 // Internal-ish file for getting the PSF from the matched addition 155 pmFPAfile *psf = pmFPAfileDefine Skycell(config, psphot->fpa, "PSPHOT.PSF.LOAD");157 pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, output, "PSPHOT.PSF.LOAD"); 156 158 if (!psf) { 157 159 psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD"); -
trunk/ppSub/src/ppSubReadout.c
r17835 r18289 12 12 13 13 #define WCS_TOLERANCE 0.001 // Tolerance for WCS 14 //#define TESTING // For test output14 #define TESTING // For test output 15 15 16 16 … … 73 73 int ringsOrder = psMetadataLookupS32(NULL, config->arguments, "RINGS.ORDER"); // RINGS polynomial order 74 74 int binning = psMetadataLookupS32(NULL, config->arguments, "SPAM.BINNING"); // Binning for SPAM kernel 75 float penalty = psMetadataLookupF32(NULL, config->arguments, "PENALTY"); // Penalty for wideness 75 76 psMaskType maskBad = pmConfigMask(psMetadataLookupStr(NULL, config->arguments, "MASK.BAD"), 76 77 config); // Value to mask … … 131 132 132 133 if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, regionSize, spacing, threshold, sources, 133 stampsName, type, size, order, widths, orders, inner, ringsOrder, 134 binning, optimum, optWidths, optOrder, optThresh, iter, rej, maskBad,134 stampsName, type, size, order, widths, orders, inner, ringsOrder, binning, 135 penalty, optimum, optWidths, optOrder, optThresh, iter, rej, maskBad, 135 136 maskBlank, badFrac, mode)) { 136 137 psError(PS_ERR_UNKNOWN, false, "Unable to match images."); … … 184 185 #endif 185 186 186 // "Subtract" the mask and weight map 187 // Subtraction is: minuend - subtrahend 188 pmReadout *minuend = inConv; 189 pmReadout *subtrahend = refConv; 190 191 if (reverse) { 192 pmReadout *temp = subtrahend; 193 subtrahend = minuend; 194 minuend = temp; 195 } 196 197 #ifdef TESTING 198 { 199 pmReadoutMaskApply(minuend, maskBlank); 200 psFits *fits = psFitsOpen("minuend.fits", "w"); 201 psFitsWriteImage(fits, NULL, minuend->image, 0, NULL); 202 psFitsClose(fits); 203 } 204 { 205 pmReadoutMaskApply(subtrahend, maskBlank); 206 psFits *fits = psFitsOpen("subtrahend.fits", "w"); 207 psFitsWriteImage(fits, NULL, subtrahend->image, 0, NULL); 208 psFitsClose(fits); 209 } 210 #endif 211 187 212 outRO->mask = (psImage*)psBinaryOp(outRO->mask, inConv->mask, "|", refConv->mask); 188 if (inConv->weight && refConv->weight) { 189 outRO->weight = (psImage*)psBinaryOp(outRO->weight, inConv->weight, "+", refConv->weight); 190 } 191 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; 213 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; // It'll be there soon 192 214 193 215 // Photometry is to be performed in two stages: … … 198 220 pmPSF *psf = NULL; // PSF for photometry 199 221 if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) { 200 // We use a summed image as the basis for the PSF: this will have the maximum S/N. 201 outRO->image = (psImage*)psBinaryOp(outRO->image, inConv->image, "+", refConv->image); 222 outRO->image = psImageCopy(outRO->image, minuend->image, PS_TYPE_F32); 223 if (minuend->weight) { 224 outRO->weight = psImageCopy(outRO->weight, minuend->weight, PS_TYPE_F32); 225 } 202 226 203 227 pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT"); … … 244 268 } 245 269 246 // Do the subtraction 247 { 248 // Subtraction is: minuend - subtrahend 249 pmReadout *minuend = inConv; 250 pmReadout *subtrahend = refConv; 251 252 if (reverse) { 253 pmReadout *temp = subtrahend; 254 subtrahend = minuend; 255 minuend = temp; 256 } 257 258 outRO->image = (psImage*)psBinaryOp(outRO->image, minuend->image, "-", subtrahend->image); 259 260 #ifdef TESTING 261 { 262 psFits *fits = psFitsOpen("minuend.fits", "w"); 263 psFitsWriteImage(fits, NULL, minuend->image, 0, NULL); 264 psFitsClose(fits); 265 } 266 { 267 psFits *fits = psFitsOpen("subtrahend.fits", "w"); 268 psFitsWriteImage(fits, NULL, subtrahend->image, 0, NULL); 269 psFitsClose(fits); 270 } 271 #endif 272 273 pmReadoutMaskApply(outRO, maskBlank); 274 } 270 // Do the actual subtraction 271 outRO->image = (psImage*)psBinaryOp(outRO->image, minuend->image, "-", subtrahend->image); 272 if (inConv->weight && refConv->weight) { 273 outRO->weight = (psImage*)psBinaryOp(outRO->weight, inConv->weight, "+", refConv->weight); 274 } 275 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; 276 277 pmReadoutMaskApply(outRO, maskBlank); 275 278 276 279 psFree(inConv); … … 304 307 } 305 308 306 psTraceSetLevel("psphot", 6);307 308 309 // Photometry stage 2: find and measure sources on the subtracted image 309 310 if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) { … … 314 315 pmReadout *psfRO = pmFPAfileThisReadout(config->files, view, "PSPHOT.PSF.LOAD"); 315 316 if (!psfRO) { 316 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find file PSPHOT.PSF.LOAD");317 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find readout for file PSPHOT.PSF.LOAD"); 317 318 return false; 318 319 }
Note:
See TracChangeset
for help on using the changeset viewer.
