Changeset 26007 for branches/pap/ppStack
- Timestamp:
- Nov 2, 2009, 5:08:31 PM (17 years ago)
- Location:
- branches/pap/ppStack/src
- Files:
-
- 8 edited
-
ppStackArguments.c (modified) (3 diffs)
-
ppStackCombineFinal.c (modified) (1 diff)
-
ppStackCombineInitial.c (modified) (1 diff)
-
ppStackConvolve.c (modified) (5 diffs)
-
ppStackLoop.c (modified) (1 diff)
-
ppStackMatch.c (modified) (7 diffs)
-
ppStackReadout.c (modified) (5 diffs)
-
ppStackReject.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap/ppStack/src/ppStackArguments.c
r23841 r26007 148 148 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stamps", 0, "Stamps file with x,y,flux per line", NULL); 149 149 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL); 150 psMetadataAdd S32(arguments, PS_LIST_TAIL, "-iter", 0, "Number of rejection iterations", 0);150 psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-iter", 0, "Number of rejection iterations per input", NAN); 151 151 psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-rej", 0, 152 152 "Combination rejection thresold (sigma)", NAN); … … 250 250 } 251 251 252 VALUE_ARG_RECIPE_ INT("-iter", "ITER", S32, 0);252 VALUE_ARG_RECIPE_FLOAT("-combine-iter", "COMBINE.ITER", F32); 253 253 VALUE_ARG_RECIPE_FLOAT("-combine-rej", "COMBINE.REJ", F32); 254 254 VALUE_ARG_RECIPE_FLOAT("-combine-sys", "COMBINE.SYS", F32); … … 260 260 VALUE_ARG_RECIPE_FLOAT("-poor-frac", "POOR.FRACTION", F32); 261 261 262 valueArgRecipeStr(arguments, recipe, "-mask-val", "MASK. VAL",recipe);262 valueArgRecipeStr(arguments, recipe, "-mask-val", "MASK.IN", recipe); 263 263 valueArgRecipeStr(arguments, recipe, "-mask-bad", "MASK.BAD", recipe); 264 264 valueArgRecipeStr(arguments, recipe, "-mask-poor", "MASK.POOR", recipe); -
branches/pap/ppStack/src/ppStackCombineFinal.c
r25964 r26007 10 10 #include "ppStackLoop.h" 11 11 12 #define TESTING // Enable test output12 //#define TESTING // Enable test output 13 13 14 14 bool ppStackCombineFinal(pmReadout *target, ppStackThreadData *stack, psArray *covariances, -
branches/pap/ppStack/src/ppStackCombineInitial.c
r25964 r26007 10 10 #include "ppStackLoop.h" 11 11 12 #define TESTING // Enable test output12 //#define TESTING // Enable test output 13 13 14 14 bool ppStackCombineInitial(ppStackThreadData *stack, ppStackOptions *options, pmConfig *config) -
branches/pap/ppStack/src/ppStackConvolve.c
r25955 r26007 9 9 #include "ppStack.h" 10 10 #include "ppStackLoop.h" 11 12 //#define TESTING 13 11 14 12 15 // Update the value of a concept … … 130 133 ppStackWriteImage(options->convMasks->data[i], maskHeader, readout->mask, config); 131 134 psFree(maskHeader); 132 psImageCovarianceTransfer(readout->variance, readout->covariance);133 135 ppStackWriteImage(options->convVariances->data[i], hdu->header, readout->variance, config); 134 136 #ifdef TESTING … … 139 141 pmStackVisualPlotTestImage(readout->covariance->image, name); 140 142 psFree(name); 143 } 144 { 145 int numCols = readout->image->numCols, numRows = readout->image->numRows; 146 psImage *sn = psImageAlloc(numCols, numRows, PS_TYPE_F32); 147 for (int y = 0; y < numRows; y++) { 148 for (int x = 0; x < numCols; x++) { 149 sn->data.F32[y][x] = readout->image->data.F32[y][x] / 150 sqrtf(readout->variance->data.F32[y][x]); 151 } 152 } 153 psString name = NULL; 154 psStringAppend(&name, "signoise_%d.fits", i); 155 ppStackWriteImage(name, hdu->header, sn, config); 156 psFree(name); 157 psFree(sn); 141 158 } 142 159 #endif … … 221 238 numGood = 0; // Number of good images 222 239 for (int i = 0; i < num; i++) { 223 if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PPSTACK_MASK_ALL) {240 if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PPSTACK_MASK_ALL) { 224 241 continue; 225 242 } … … 245 262 // Correct chi^2 for renormalisation 246 263 psBinaryOp(options->matchChi2, options->matchChi2, "/", renorms); 264 for (int i = 0; i < num; i++) { 265 psLogMsg("ppStack", PS_LOG_INFO, "Additional variance for image %d: %f\n", 266 i, options->matchChi2->data.F32[i]); 267 } 247 268 psFree(renorms); 248 269 -
branches/pap/ppStack/src/ppStackLoop.c
r25964 r26007 130 130 } 131 131 psTrace("ppStack", 2, "Stack of unconvolved images....\n"); 132 if (!ppStackCombineFinal(options->unconvRO, stack, options->origCovars, options, config, true, true)) {132 if (!ppStackCombineFinal(options->unconvRO, stack, options->origCovars, options, config, false, true)) { 133 133 psError(PS_ERR_UNKNOWN, false, "Unable to perform unconvolved combination."); 134 134 psFree(stack); -
branches/pap/ppStack/src/ppStackMatch.c
r25959 r26007 18 18 #define COVAR_FRAC 0.01 // Truncation fraction for covariance matrix 19 19 20 #define TESTING // Enable debugging output20 //#define TESTING // Enable debugging output 21 21 22 22 #ifdef TESTING … … 167 167 ) 168 168 { 169 #if 1 169 170 bool mdok; // Status of metadata lookups 170 171 … … 192 193 psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask 193 194 195 psImageCovarianceTransfer(readout->variance, readout->covariance); 194 196 return pmReadoutVarianceRenormalise(readout, maskBad, num, minValid, maxValid); 197 #else 198 return true; 199 #endif 195 200 } 196 201 … … 212 217 int size = psMetadataLookupS32(NULL, ppsub, "KERNEL.SIZE"); // Kernel half-size 213 218 214 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of bits to mask going in219 psString maskValStr = psMetadataLookupStr(NULL, ppsub, "MASK.VAL"); // Name of bits to mask going in 215 220 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 216 221 psString maskPoorStr = psMetadataLookupStr(NULL, recipe, "MASK.POOR"); // Name of bits to mask for poor … … 377 382 } 378 383 #endif 384 385 fprintf(stderr, "vf = %f\n", psImageCovarianceFactor(readout->covariance)); 386 379 387 380 388 if (threads > 0) { … … 516 524 psFree(iter); 517 525 options->matchChi2->data.F32[index] = sum / (psImageCovarianceFactor(readout->covariance) * num); 526 fprintf(stderr, "chi2 = %f ; vf = %f\n", sum/num, psImageCovarianceFactor(readout->covariance)); 518 527 } 519 528 … … 542 551 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator 543 552 if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskVal | maskBad, rng)) { 544 psWarning("Can't measure background for image.");545 psErrorClear();553 psWarning("Can't measure background for image."); 554 psErrorClear(); 546 555 } else { 547 if (!psMetadataLookupBool(NULL, config->arguments, "PPSTACK.SKIP.BG.SUB")) {548 psLogMsg("ppStack", PS_LOG_INFO, "Correcting convolved image background by %lf (+/- %lf)",549 psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), psStatsGetValue(bg, PS_STAT_ROBUST_STDEV));550 (void)psBinaryOp(readout->image, readout->image, "-",551 psScalarAlloc(psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), PS_TYPE_F32));552 }556 if (!psMetadataLookupBool(NULL, config->arguments, "PPSTACK.SKIP.BG.SUB")) { 557 psLogMsg("ppStack", PS_LOG_INFO, "Correcting convolved image background by %lf (+/- %lf)", 558 psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), psStatsGetValue(bg, PS_STAT_ROBUST_STDEV)); 559 (void)psBinaryOp(readout->image, readout->image, "-", 560 psScalarAlloc(psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), PS_TYPE_F32)); 561 } 553 562 } 554 563 -
branches/pap/ppStack/src/ppStackReadout.c
r25968 r26007 116 116 117 117 bool mdok; // Status of MD lookup 118 int iter = psMetadataLookupS32(NULL, recipe, "ITER"); // Rejection iterations118 float iter = psMetadataLookupF32(NULL, recipe, "COMBINE.ITER"); // Rejection iterations 119 119 float combineRej = psMetadataLookupF32(NULL, recipe, "COMBINE.REJ"); // Combination threshold 120 120 float combineSys = psMetadataLookupF32(NULL, recipe, "COMBINE.SYS"); // Combination systematic error … … 126 126 int kernelSize = psMetadataLookupS32(NULL, ppsub, "KERNEL.SIZE"); // Kernel half-size 127 127 128 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK. VAL"); // Name of bits to mask going in128 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.IN"); // Name of bits to mask going in 129 129 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 130 psString maskSuspectStr = psMetadataLookupStr(NULL, recipe, "MASK.SUSPECT"); // Name of suspect mask bits 131 psImageMaskType maskSuspect = pmConfigMaskGet(maskSuspectStr, config); // Suspect bits 130 132 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 131 133 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels … … 161 163 } 162 164 163 if (!pmStackCombine(outRO, stack, maskVal | maskBad, mask Bad, kernelSize, iter,165 if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, kernelSize, iter, 164 166 combineRej, combineSys, combineDiscard, useVariance, safe, false)) { 165 167 psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection."); … … 217 219 bool safe = psMetadataLookupBool(&mdok, recipe, "SAFE"); // Be safe when combining small numbers of pixels 218 220 219 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK. VAL"); // Name of bits to mask going in221 psString maskValStr = psMetadataLookupStr(NULL, recipe, "MASK.IN"); // Name of bits to mask going in 220 222 psImageMaskType maskVal = pmConfigMaskGet(maskValStr, config); // Bits to mask going in to pmSubtractionMatch 223 psString maskSuspectStr = psMetadataLookupStr(NULL, recipe, "MASK.SUSPECT"); // Name of suspect mask bits 224 psImageMaskType maskSuspect = pmConfigMaskGet(maskSuspectStr, config); // Suspect bits 221 225 psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits to mask for bad 222 226 psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels … … 267 271 } 268 272 269 if (!pmStackCombine(outRO, stack, maskVal | maskBad, mask Bad, 0, iter, combineRej,273 if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej, 270 274 combineSys, combineDiscard, useVariance, safe, true)) { 271 275 psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts."); -
branches/pap/ppStack/src/ppStackReject.c
r25964 r26007 10 10 #include "ppStackLoop.h" 11 11 12 #define TESTING12 //#define TESTING 13 13 14 14 bool ppStackReject(ppStackOptions *options, pmConfig *config)
Note:
See TracChangeset
for help on using the changeset viewer.
