Changeset 17255
- Timestamp:
- Mar 31, 2008, 3:46:38 PM (18 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 4 edited
-
ppStack.h (modified) (1 diff)
-
ppStackArguments.c (modified) (5 diffs)
-
ppStackLoop.c (modified) (4 diffs)
-
ppStackMatch.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStack.h
r16991 r17255 63 63 const pmReadout *sourcesRO, ///< Readout with sources 64 64 const pmPSF *psf, ///< Target PSF 65 psRandom *rng, ///< Random number generator 65 66 const pmConfig *config ///< Configuration 66 67 ); -
trunk/ppStack/src/ppStackArguments.c
r17006 r17255 83 83 } 84 84 85 // Get a statistic name from the command-line or recipe, and add the enum to the arguments 86 #define VALUE_ARG_RECIPE_STAT(ARGNAME, RECIPENAME) { \ 87 const char *stat = psMetadataLookupStr(NULL, arguments, ARGNAME); \ 88 if (!stat) { \ 89 stat = psMetadataLookupStr(NULL, recipe, RECIPENAME); \ 90 if (!stat) { \ 91 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find %s in recipe %s", \ 92 RECIPENAME, PPSTACK_RECIPE); \ 93 goto ERROR; \ 94 } \ 95 } \ 96 psMetadataAddS32(config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, psStatsOptionFromString(stat)); \ 97 } 98 85 99 // Get a string value from the command-line and add it to the target 86 100 static bool valueArgStr(psMetadata *arguments, // Command-line arguments … … 141 155 psMetadataAddBool(arguments, PS_LIST_TAIL, "-variance", 0, "Use variance for rejection?", false); 142 156 psMetadataAddBool(arguments, PS_LIST_TAIL, "-safe", 0, "Play safe with small numbers of pixels to combine?", false); 157 psMetadataAddBool(arguments, PS_LIST_TAIL, "-renorm", 0, "Renormalise variance maps?", false); 158 psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-mean", 0, "Statistic for mean in renormalisation", NULL); 159 psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-stdev", 0, "Statistic for stdev in renormalisation", NULL); 160 psMetadataAddS32(arguments, PS_LIST_TAIL, "-renorm-width", 0, "Width of renormalisation boxes", 0); 143 161 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-image", 0, "Suffix for temporary images", NULL); 144 162 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-mask", 0, "Suffix for temporary masks", NULL); … … 208 226 } 209 227 228 if (psMetadataLookupBool(NULL, arguments, "-renorm") || 229 psMetadataLookupBool(NULL, recipe, "RENORM")) { 230 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "RENORM", 0, "Renormalise variance maps?", true); 231 } 232 VALUE_ARG_RECIPE_INT("-renorm-width", "RENORM.WIDTH", S32, 0); 233 VALUE_ARG_RECIPE_STAT("-renorm-mean", "RENORM.MEAN"); 234 VALUE_ARG_RECIPE_STAT("-renorm-stdev", "RENORM.STDEV"); 235 210 236 valueArgRecipeStr(arguments, recipe, "-temp-image", "TEMP.IMAGE", config->arguments); 211 237 valueArgRecipeStr(arguments, recipe, "-temp-mask", "TEMP.MASK", config->arguments); … … 218 244 } 219 245 220 221 246 psTrace("ppStack", 1, "Done reading command-line arguments\n"); 222 247 psFree(arguments); … … 227 252 return false; 228 253 } 229 230 -
trunk/ppStack/src/ppStackLoop.c
r17016 r17255 306 306 psArray *subKernels = psArrayAlloc(num); // Subtraction kernels --- required in the stacking 307 307 psArray *subRegions = psArrayAlloc(num); // Subtraction regions --- required in the stacking 308 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator 308 309 for (int i = 0; i < num; i++) { 309 310 psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num); … … 315 316 psFree(sources); 316 317 psFree(targetPSF); 318 psFree(rng); 317 319 return false; 318 320 } … … 323 325 // Background subtraction, scaling and normalisation is performed automatically by the image matching 324 326 psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction 325 if (!ppStackMatch(readout, ®ions, &kernels, sources, targetPSF, config)) {327 if (!ppStackMatch(readout, ®ions, &kernels, sources, targetPSF, rng, config)) { 326 328 psError(PS_ERR_UNKNOWN, false, "Unable to match image %d --- ignoring.", i); 327 329 psFree(sources); 328 330 psFree(targetPSF); 331 psFree(rng); 329 332 return false; 330 333 } … … 345 348 psFree(sources); 346 349 psFree(targetPSF); 350 psFree(rng); 347 351 348 352 -
trunk/ppStack/src/ppStackMatch.c
r17031 r17255 16 16 17 17 bool ppStackMatch(pmReadout *readout, psArray **regions, psArray **kernels, 18 const pmReadout *sourcesRO, const pmPSF *psf, const pmConfig *config)18 const pmReadout *sourcesRO, const pmPSF *psf, psRandom *rng, const pmConfig *config) 19 19 { 20 20 assert(readout); … … 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 = pmConfigMask(psMetadataLookupStr(NULL, recipe, "MASK.BAD"), config); // Value to mask 33 bool mdok; // Status of MD lookup 34 bool renorm = psMetadataLookupBool(&mdok, recipe, "RENORM"); // Renormalise variances? 35 psStatsOptions renormMean = psMetadataLookupS32(&mdok, recipe, "RENORM.MEAN"); // Statistic for mean 36 psStatsOptions renormStdev = psMetadataLookupS32(&mdok, recipe, "RENORM.STDEV"); // Statistic for stdev 37 int renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width for renormalisation box 38 39 // Renormalise the variances if desired 40 if (renorm && !pmReadoutWeightRenorm(readout, maskBad, renormMean, renormStdev, renormWidth, rng)) { 41 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances."); 42 psFree(output); 43 return false; 44 } 32 45 33 46 #ifndef NO_CONVOLUTION 34 bool mdok; // Status of MD lookup35 47 int order = psMetadataLookupS32(NULL, recipe, "SPATIAL.ORDER"); // Spatial polynomial order 36 48 float regionSize = psMetadataLookupF32(NULL, recipe, "REGION.SIZE"); // Size of iso-kernel regs … … 47 59 int ringsOrder = psMetadataLookupS32(NULL, recipe, "RINGS.ORDER"); // RINGS polynomial order 48 60 int binning = psMetadataLookupS32(NULL, recipe, "SPAM.BINNING"); // Binning for SPAM kernel 49 psMaskType maskBad = pmConfigMask(psMetadataLookupStr(NULL, recipe, "MASK.BAD"),50 config); // Value to mask51 61 psMaskType maskBlank = pmConfigMask(psMetadataLookupStr(NULL, recipe, "MASK.BLANK"), 52 62 config); // Mask for blank reg.
Note:
See TracChangeset
for help on using the changeset viewer.
