Changeset 18249
- Timestamp:
- Jun 20, 2008, 3:28:06 PM (18 years ago)
- Files:
-
- 5 edited
-
branches/pap_branch_080617/ppSub/src/ppSubArguments.c (modified) (2 diffs)
-
branches/pap_branch_080617/ppSub/src/ppSubCamera.c (modified) (5 diffs)
-
branches/pap_branch_080617/ppSub/src/ppSubReadout.c (modified) (5 diffs)
-
branches/pap_branch_080617/ppSub/test/fake.c (modified) (4 diffs)
-
trunk/ippconfig/recipes/ppSub.config (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_080617/ppSub/src/ppSubArguments.c
r17813 r18249 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); -
branches/pap_branch_080617/ppSub/src/ppSubCamera.c
r17834 r18249 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"); -
branches/pap_branch_080617/ppSub/src/ppSubReadout.c
r18230 r18249 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 psFits *fits = psFitsOpen("minuend.fits", "w"); 200 psFitsWriteImage(fits, NULL, minuend->image, 0, NULL); 201 psFitsClose(fits); 202 } 203 { 204 psFits *fits = psFitsOpen("subtrahend.fits", "w"); 205 psFitsWriteImage(fits, NULL, subtrahend->image, 0, NULL); 206 psFitsClose(fits); 207 } 208 #endif 209 187 210 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; 211 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; // It'll be there soon 192 212 193 213 // Photometry is to be performed in two stages: … … 198 218 pmPSF *psf = NULL; // PSF for photometry 199 219 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); 220 outRO->image = psImageCopy(outRO->image, minuend->image, PS_TYPE_F32); 221 if (minuend->weight) { 222 outRO->weight = psImageCopy(outRO->weight, minuend->weight, PS_TYPE_F32); 223 } 202 224 203 225 pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT"); … … 244 266 } 245 267 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 } 268 // Do the actual subtraction 269 outRO->image = (psImage*)psBinaryOp(outRO->image, minuend->image, "-", subtrahend->image); 270 if (inConv->weight && refConv->weight) { 271 outRO->weight = (psImage*)psBinaryOp(outRO->weight, inConv->weight, "+", refConv->weight); 272 } 273 outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true; 274 275 pmReadoutMaskApply(outRO, maskBlank); 275 276 276 277 psFree(inConv); -
branches/pap_branch_080617/ppSub/test/fake.c
r18175 r18249 7 7 8 8 // PSF for images 9 #define X_AXIS_1 5.0 // Length of x axis (FWHM) for image 110 #define Y_AXIS_1 3.0 // Length of y axis (FWHM) for image 111 #define X_AXIS_2 3.0 // Length of x axis (FWHM) for image 112 #define Y_AXIS_2 5.0 // Length of y axis (FWHM) for image 19 #define X_AXIS_1 3.0 // Length of x axis (FWHM) for image 1 10 #define Y_AXIS_1 5.0 // Length of y axis (FWHM) for image 1 11 #define X_AXIS_2 5.0 // Length of x axis (FWHM) for image 1 12 #define Y_AXIS_2 3.0 // Length of y axis (FWHM) for image 1 13 13 14 14 // Image parameters … … 22 22 #define SOURCES_DENSITY 30000.0 // Source density at nominated magnitude (per deg^2) 23 23 #define SOURCES_ZP 25.0 // Magnitude ZP 24 #define SOURCES_GAUSSIAN 0// Gaussian sources (boolean)?24 #define SOURCES_GAUSSIAN 1 // Gaussian sources (boolean)? 25 25 26 26 // Noise properties … … 125 125 } 126 126 127 #if 1 128 psImage *var1 = (psImage*)psBinaryOp(NULL, image1, "+", psScalarAlloc(PS_SQR(NOISE_1), PS_TYPE_F32)); 129 psImage *var2 = (psImage*)psBinaryOp(NULL, image2, "+", psScalarAlloc(PS_SQR(NOISE_2), PS_TYPE_F32)); 130 #else 131 psImage *var1 = psImageAlloc(NUMCOLS, NUMROWS, PS_TYPE_F32); 132 psImage *var2 = psImageAlloc(NUMCOLS, NUMROWS, PS_TYPE_F32); 133 psImageInit(var1, PS_SQR(NOISE_1)); 134 psImageInit(var2, PS_SQR(NOISE_2)); 135 #endif 136 127 137 for (int y = 0; y < NUMROWS; y++) { 128 138 for (int x = 0; x < NUMCOLS; x++) { 129 image1->data.F32[y][x] += psRandomGaussian(rng) * NOISE_1;130 image2->data.F32[y][x] += psRandomGaussian(rng) * NOISE_2;139 image1->data.F32[y][x] += psRandomGaussian(rng) * sqrtf(var1->data.F32[y][x]); 140 image2->data.F32[y][x] += psRandomGaussian(rng) * sqrtf(var2->data.F32[y][x]); 131 141 } 132 142 } 133 143 #if 1 144 var1 = (psImage*)psBinaryOp(var1, image1, "+", psScalarAlloc(PS_SQR(NOISE_1), PS_TYPE_F32)); 145 var2 = (psImage*)psBinaryOp(var2, image2, "+", psScalarAlloc(PS_SQR(NOISE_2), PS_TYPE_F32)); 146 #else 147 psImageInit(var1, PS_SQR(NOISE_1)); 148 psImageInit(var2, PS_SQR(NOISE_2)); 149 #endif 134 150 135 151 { … … 144 160 } 145 161 146 psFree(image1);147 psFree(image2);148 149 psFree(rng);150 151 psImage *noise1 = psImageAlloc(NUMCOLS, NUMROWS, PS_TYPE_F32);152 psImage *noise2 = psImageAlloc(NUMCOLS, NUMROWS, PS_TYPE_F32);153 psImageInit(noise1, PS_SQR(NOISE_1));154 psImageInit(noise2, PS_SQR(NOISE_2));155 162 { 156 163 psFits *fits = psFitsOpen("variance1.fits", "w"); 157 psFitsWriteImage(fits, NULL, noise1, 0, NULL);164 psFitsWriteImage(fits, NULL, var1, 0, NULL); 158 165 psFitsClose(fits); 159 166 } 160 167 { 161 168 psFits *fits = psFitsOpen("variance2.fits", "w"); 162 psFitsWriteImage(fits, NULL, noise2, 0, NULL);169 psFitsWriteImage(fits, NULL, var2, 0, NULL); 163 170 psFitsClose(fits); 164 171 } 165 psFree(noise1); 166 psFree(noise2); 172 173 psFree(image1); 174 psFree(image2); 175 176 psFree(var1); 177 psFree(var2); 178 179 psFree(rng); 167 180 168 181 return PS_EXIT_SUCCESS; -
trunk/ippconfig/recipes/ppSub.config
r18242 r18249 18 18 INNER S32 5 # Inner half-size for SPAM and FRIES kernels 19 19 RINGS.ORDER S32 2 # Polynomial order for RINGS kernels 20 PENALTY F32 1.0 # Penalty for wideness 20 21 21 22 OPTIMUM BOOL FALSE # Derive optimum parameters for ISIS and GUNK kernels … … 29 30 RENORM.WIDTH S32 500 # Size of renormalisation boxes 30 31 31 PHOTOMETRY BOOL TRUE # Perform photometry?32 PHOTOMETRY BOOL FALSE # Perform photometry? 32 33 33 34 ### Modifications to use when stacking data
Note:
See TracChangeset
for help on using the changeset viewer.
