Changeset 21536 for branches/cnb_branch_20090215/ppStack
- Timestamp:
- Feb 19, 2009, 7:59:50 AM (18 years ago)
- Location:
- branches/cnb_branch_20090215/ppStack/src
- Files:
-
- 6 edited
-
ppStack.c (modified) (1 diff)
-
ppStackArguments.c (modified) (3 diffs)
-
ppStackLoop.c (modified) (9 diffs)
-
ppStackMatch.c (modified) (8 diffs)
-
ppStackPhotometry.c (modified) (1 diff)
-
ppStackSources.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branch_20090215/ppStack/src/ppStack.c
r21258 r21536 74 74 pmConfigDone(); 75 75 psLibFinalize(); 76 76 pmVisualClose(); 77 77 exit(exitValue); 78 78 } -
branches/cnb_branch_20090215/ppStack/src/ppStackArguments.c
r21477 r21536 176 176 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-limit", 0, "Limit on star rejection fraction for successful iteration", NAN); 177 177 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys", 0, "Estimated systematic error", NAN); 178 psMetadataAddBool(arguments, PS_LIST_TAIL, "-renorm", 0, "Renormalise variance maps?", false);179 psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-mean", 0,180 "Statistic for mean in renormalisation", NULL);181 psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-stdev", 0,182 "Statistic for stdev in renormalisation", NULL);183 psMetadataAddF32(arguments, PS_LIST_TAIL, "-renorm-width", 0, "Gaussian width for renormalisation", NAN);184 psMetadataAddS32(arguments, PS_LIST_TAIL, "-renorm-num", 0, "Number of samples for renormalisation", 0);185 178 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-image", 0, "Suffix for temporary images", NULL); 186 179 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-mask", 0, "Suffix for temporary masks", NULL); … … 189 182 "Delete temporary files on completion?", false); 190 183 psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads to use", 0); 191 psMetadataAddBool(arguments, PS_LIST_TAIL, "- psphot-visual", 0, "psphotvisualisation", 0);184 psMetadataAddBool(arguments, PS_LIST_TAIL, "-visual", 0, "visualisation", 0); 192 185 193 186 if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 3) { … … 280 273 } 281 274 282 if (psMetadataLookupBool(NULL, arguments, "-renorm") ||283 psMetadataLookupBool(NULL, recipe, "RENORM")) {284 psMetadataAddBool(arguments, PS_LIST_TAIL, "RENORM", 0, "Renormalise variance maps?", true);285 }286 VALUE_ARG_RECIPE_INT("-renorm-num", "RENORM.NUM", S32, 0);287 VALUE_ARG_RECIPE_FLOAT("-renorm-width", "RENORM.WIDTH", F32);288 valueArgRecipeStr(arguments, recipe, "-renorm-mean", "RENORM.MEAN", recipe);289 valueArgRecipeStr(arguments, recipe, "-renorm-stdev", "RENORM.STDEV", recipe);290 291 275 valueArgRecipeStr(arguments, recipe, "-temp-image", "TEMP.IMAGE", recipe); 292 276 valueArgRecipeStr(arguments, recipe, "-temp-mask", "TEMP.MASK", recipe); -
branches/cnb_branch_20090215/ppStack/src/ppStackLoop.c
r21477 r21536 480 480 psMetadataAddF32(stats, PS_LIST_TAIL, "STAMP.NUM", PS_META_DUPLICATE_OK, 481 481 "Number of stamps", kernels->numStamps); 482 float deconv = psMetadataLookupF32(NULL, readout->analysis, 483 PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Deconvolution fraction 484 psMetadataAddF32(stats, PS_LIST_TAIL, "KERNEL.DECONV", PS_META_DUPLICATE_OK, 485 "Deconvolution fraction for kernel", deconv); 482 486 psMetadataAddF32(stats, PS_LIST_TAIL, "PPSTACK.WEIGHTING", PS_META_DUPLICATE_OK, 483 487 "Weighting for image", weightings->data.F32[i]); … … 503 507 psStringAppend(&name, "covariance_%d.fits", i); 504 508 writeImage(name, hdu->header, readout->covariance->image, config); 509 pmStackVisualPlotTestImage(readout->covariance->image, name); 505 510 psFree(name); 506 511 } … … 801 806 #ifdef TESTING 802 807 writeImage("combined_initial.fits", NULL, outRO->image, config); 808 pmStackVisualPlotTestImage(outRO->image, "combined_initial.fits"); 803 809 #endif 804 810 … … 884 890 psString name = NULL; // Name of image 885 891 psStringAppend(&name, "inspect_%03d.fits", i); 892 pmStackVisualPlotTestImage(mask, name); 886 893 psFits *fits = psFitsOpen(name, "w"); 887 894 psFree(name); … … 901 908 psString name = NULL; // Name of image 902 909 psStringAppend(&name, "reject_%03d.fits", i); 910 pmStackVisualPlotTestImage(mask, name); 903 911 psFits *fits = psFitsOpen(name, "w"); 904 912 psFree(name); … … 1034 1042 1035 1043 #ifdef TESTING 1044 pmStackVisualPlotTestImage(outRO->image, "combined_initial.fits"); 1036 1045 writeImage("combined_final.fits", NULL, outRO->image, config); 1037 1046 #endif … … 1151 1160 psLogMsg("ppStack", PS_LOG_INFO, "Stage 7 : WCS & JPEGS : %f sec", psTimerClear("PPSTACK_STEPS")); 1152 1161 1153 if (psMetadataLookupBool(&mdok, recipe, "RENORM")) {1154 // Statistics for renormalisation1155 psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,1156 "RENORM.MEAN"));1157 psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,1158 "RENORM.STDEV"));1159 int renormNum = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM"); // Number of samples1160 float renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width of Gaussian phot1161 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask1162 if (!pmReadoutVarianceRenormPhot(outRO, maskValue, renormNum, renormWidth,1163 renormMean, renormStdev, NULL)) {1164 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");1165 psFree(outRO);1166 return false;1167 }1168 }1169 1170 psLogMsg("ppStack", PS_LOG_INFO, "Stage 8 : Photometry Renormalization : %f sec", psTimerClear("PPSTACK_STEPS"));1171 1172 1162 if (psMetadataLookupBool(&mdok, recipe, "PHOTOMETRY")) { 1173 1163 psTrace("ppStack", 1, "Photometering stacked image....\n"); … … 1199 1189 } 1200 1190 1201 psLogMsg("ppStack", PS_LOG_INFO, "Stage 9: Photometry Analysis : %f sec", psTimerClear("PPSTACK_STEPS"));1191 psLogMsg("ppStack", PS_LOG_INFO, "Stage 8 : Photometry Analysis : %f sec", psTimerClear("PPSTACK_STEPS")); 1202 1192 1203 1193 psThreadPoolFinalize(); … … 1254 1244 } 1255 1245 1256 psLogMsg("ppStack", PS_LOG_INFO, "Stage 10: Final Output : %f sec", psTimerClear("PPSTACK_STEPS"));1246 psLogMsg("ppStack", PS_LOG_INFO, "Stage 9 : Final Output : %f sec", psTimerClear("PPSTACK_STEPS")); 1257 1247 1258 1248 memDump("finish"); -
branches/cnb_branch_20090215/ppStack/src/ppStackMatch.c
r21477 r21536 189 189 190 190 bool mdok; // Status of MD lookup 191 bool renorm = psMetadataLookupBool(&mdok, recipe, "RENORM"); // Renormalise variances?192 191 float penalty = psMetadataLookupF32(NULL, ppsub, "PENALTY"); // Penalty for wideness 193 192 int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads … … 359 358 psString name = NULL; 360 359 psStringAppend(&name, "fake_%03d.fits", numInput); 360 pmStackVisualPlotTestImage(fake->image, name); 361 361 psFits *fits = psFitsOpen(name, "w"); 362 362 psFree(name); … … 368 368 psString name = NULL; 369 369 psStringAppend(&name, "real_%03d.fits", numInput); 370 pmStackVisualPlotTestImage(readout->image, name); 370 371 psFits *fits = psFitsOpen(name, "w"); 371 372 psFree(name); … … 374 375 } 375 376 #endif 376 377 // Renormalise the variances if desired378 if (renorm) {379 // Statistics for renormalisation380 psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,381 "RENORM.MEAN"));382 psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,383 "RENORM.STDEV"));384 385 if (!pmReadoutVarianceRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {386 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");387 psFree(output);388 return false;389 }390 }391 377 392 378 if (threads > 0) { … … 413 399 psString name = NULL; 414 400 psStringAppend(&name, "conv_%03d.fits", numInput); 401 pmStackVisualPlotTestImage(output->image, name); 415 402 psFits *fits = psFitsOpen(name, "w"); 416 403 psFree(name); … … 422 409 psString name = NULL; 423 410 psStringAppend(&name, "diff_%03d.fits", numInput); 411 pmStackVisualPlotTestImage(fake->image, name); 424 412 psFits *fits = psFitsOpen(name, "w"); 425 413 psFree(name); … … 562 550 } 563 551 564 // Renormalise the variances if desired565 if (renorm) {566 // Statistics for renormalisation567 psStatsOptions renormMean = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,568 "RENORM.MEAN"));569 psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe,570 "RENORM.STDEV"));571 572 if (!pmReadoutVarianceRenormPixels(readout, maskBad, renormMean, renormStdev, rng)) {573 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");574 psFree(output);575 return false;576 }577 }578 579 552 // Ensure the background value is zero 580 553 psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for background … … 664 637 psString name = NULL; 665 638 psStringAppend(&name, "convolved_%03d.fits", numInput); 639 pmStackVisualPlotTestImage(output->image, name); 666 640 psFits *fits = psFitsOpen(name, "w"); 667 641 psFree(name); -
branches/cnb_branch_20090215/ppStack/src/ppStackPhotometry.c
r21259 r21536 118 118 pmFPACopy(photFile->fpa, readout->parent->parent->parent); 119 119 120 if (psMetadataLookupBool(NULL, config->arguments, "- psphot-visual")) {121 p sphotSetVisual(true);120 if (psMetadataLookupBool(NULL, config->arguments, "-visual")) { 121 pmVisualSetVisual(true); 122 122 } 123 123 -
branches/cnb_branch_20090215/ppStack/src/ppStackSources.c
r21260 r21536 69 69 psString name = NULL; 70 70 psStringAppend(&name, "start_%03d.fits", i); 71 pmStackVisualPlotTestImage(fake->image, name); 71 72 psFits *fits = psFitsOpen(name, "w"); 72 73 psFree(name); … … 154 155 int minMatches = PS_MAX (2, 0.5*num); 155 156 for (int i = 0; i < matches->n; i++) { 156 pmSourceMatch *match = matches->data[i]; // Match of interest157 if (match->num < minMatches) continue;158 159 // We need to grab a single instance of this source: just take the first available160 int nImage = match->image->data.S32[0];161 int nIndex = match->index->data.S32[0];162 psArray *sources = sourceLists->data[nImage];163 pmSource *source = sources->data[nIndex];164 165 // stick this sample source on sourcesBest166 psArrayAdd (sourcesBest, 100, source);157 pmSourceMatch *match = matches->data[i]; // Match of interest 158 if (match->num < minMatches) continue; 159 160 // We need to grab a single instance of this source: just take the first available 161 int nImage = match->image->data.S32[0]; 162 int nIndex = match->index->data.S32[0]; 163 psArray *sources = sourceLists->data[nImage]; 164 pmSource *source = sources->data[nIndex]; 165 166 // stick this sample source on sourcesBest 167 psArrayAdd (sourcesBest, 100, source); 167 168 } 168 169 psMetadataAdd (sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, "psphot sources", sourcesBest);
Note:
See TracChangeset
for help on using the changeset viewer.
