Changeset 26671
- Timestamp:
- Jan 22, 2010, 11:45:18 AM (16 years ago)
- Location:
- branches/eam_branches/20091201/ppStack/src
- Files:
-
- 4 edited
-
ppStackMatch.c (modified) (4 diffs)
-
ppStackOptions.c (modified) (2 diffs)
-
ppStackOptions.h (modified) (1 diff)
-
ppStackPrepare.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ppStack/src/ppStackMatch.c
r26543 r26671 316 316 int optOrder = psMetadataLookupS32(&mdok, ppsub, "OPTIMUM.ORDER"); // Order for search 317 317 float poorFrac = psMetadataLookupF32(&mdok, ppsub, "POOR.FRACTION"); // Fraction for "poor" 318 319 bool scale = psMetadataLookupBool(NULL, recipe, "SCALE"); // Scale kernel parameters? 320 float scaleRef = psMetadataLookupF32(NULL, recipe, "SCALE.REF"); // Reference for scaling 321 float scaleMin = psMetadataLookupF32(NULL, recipe, "SCALE.MIN"); // Minimum for scaling 322 float scaleMax = psMetadataLookupF32(NULL, recipe, "SCALE.MAX"); // Maximum for scaling 323 if (!isfinite(scaleRef) || !isfinite(scaleMin) || !isfinite(scaleMax)) { 324 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 325 "Scale parameters (SCALE.REF=%f, SCALE.MIN=%f, SCALE.MAX=%f) not set in recipe.", 326 scaleRef, scaleMin, scaleMax); 327 return false; 328 } 329 318 330 319 331 // These values are specified specifically for stacking … … 410 422 } 411 423 } else { 424 // Scale the input parameters 425 psVector *widthsCopy = psVectorCopy(NULL, widths, PS_TYPE_F32); // Copy of kernel widths 426 if (scale && !pmSubtractionParamsScale(&size, &footprint, widthsCopy, 427 options->inputSeeing->data.F32[index], 428 options->targetSeeing, scaleRef, scaleMin, scaleMax)) { 429 psError(PS_ERR_UNKNOWN, false, "Unable to scale kernel parameters"); 430 psFree(fake); 431 psFree(optWidths); 432 psFree(stampSources); 433 psFree(conv); 434 psFree(widthsCopy); 435 if (threads > 0) { 436 pmSubtractionThreadsFinalize(readout, fake); 437 } 438 return false; 439 } 440 412 441 if (!pmSubtractionMatch(NULL, conv, fake, readout, footprint, stride, regionSize, spacing, 413 threshold, stampSources, stampsName, type, size, order, widths ,442 threshold, stampSources, stampsName, type, size, order, widthsCopy, 414 443 orders, inner, ringsOrder, binning, penalty, 415 444 optimum, optWidths, optOrder, optThresh, iter, rej, sysError, skyErr, … … 421 450 psFree(stampSources); 422 451 psFree(conv); 452 psFree(widthsCopy); 423 453 if (threads > 0) { 424 454 pmSubtractionThreadsFinalize(readout, fake); … … 426 456 return false; 427 457 } 458 psFree(widthsCopy); 428 459 } 429 460 -
branches/eam_branches/20091201/ppStack/src/ppStackOptions.c
r26475 r26671 20 20 psFree(options->convVariances); 21 21 psFree(options->psf); 22 psFree(options->inputSeeing); 22 23 psFree(options->inputMask); 23 24 psFree(options->sourceLists); … … 54 55 options->num = 0; 55 56 options->psf = NULL; 57 options->inputSeeing = NULL; 58 options->targetSeeing = NAN; 56 59 options->inputMask = NULL; 57 60 options->sourceLists = NULL; -
branches/eam_branches/20091201/ppStack/src/ppStackOptions.h
r26475 r26671 18 18 // Prepare 19 19 pmPSF *psf; // Target PSF 20 psVector *inputSeeing; // Input seeing FWHMs 21 float targetSeeing; // Target seeing FWHM 20 22 float sumExposure; // Sum of exposure times 21 23 psVector *inputMask; // Mask for inputs -
branches/eam_branches/20091201/ppStack/src/ppStackPrepare.c
r26475 r26671 176 176 177 177 178 bool redoPhot = psMetadataLookupBool(NULL, recipe, "PHOT");179 psArray *sources = NULL;180 181 if (options->convolve || options->matchZPs || redoPhot) {182 pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources183 sources = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.SOURCES"); // Sources184 if (!sources) {185 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find sources in readout.");186 return NULL;187 }188 options->sourceLists->data[index] = psMemIncrRefCounter(sources);189 }178 bool redoPhot = psMetadataLookupBool(NULL, recipe, "PHOT"); 179 psArray *sources = NULL; 180 181 if (options->convolve || options->matchZPs || redoPhot) { 182 pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources 183 sources = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.SOURCES"); // Sources 184 if (!sources) { 185 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find sources in readout."); 186 return NULL; 187 } 188 options->sourceLists->data[index] = psMemIncrRefCounter(sources); 189 } 190 190 191 191 // Re-do photometry if we don't trust the source lists … … 194 194 pmFPAfileActivate(config->files, false, NULL); 195 195 ppStackFileActivationSingle(config, PPSTACK_FILES_CONVOLVE, true, index); 196 if (options->convolve) {197 pmFPAfileActivate(config->files, true, "PPSTACK.CONV.KERNEL");198 }196 if (options->convolve) { 197 pmFPAfileActivate(config->files, true, "PPSTACK.CONV.KERNEL"); 198 } 199 199 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", index); // File 200 200 pmFPAview *photView = ppStackFilesIterateDown(config); … … 225 225 } 226 226 psFree(fileIter); 227 228 psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message 229 bool havePSFs = false; // Do we have any PSFs? 230 options->inputSeeing = psVectorAlloc(num, PS_TYPE_F32); 231 psVectorInit(options->inputSeeing, NAN); 232 for (int i = 0; i < num; i++) { 233 pmPSF *psf = psfs->data[i]; // PSF for image 234 if (!psf) { 235 continue; 236 } 237 havePSFs = true; 238 float fwhm = pmPSFtoFWHM(psf, 0.5 * numCols, 0.5 * numRows); // FWHM for image 239 psStringAppend(&log, "Input %d: %f\n", i, fwhm); 240 options->inputSeeing->data.F32[i] = fwhm; 241 } 242 if (havePSFs) { 243 psLogMsg("ppStack", PS_LOG_INFO, "%s", log); 244 } 245 psFree(log); 227 246 228 247 // Generate target PSF … … 237 256 psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "PSF.TARGET", PS_DATA_UNKNOWN, 238 257 "Target PSF for stack", options->psf); 258 options->targetSeeing = pmPSFtoFWHM(options->psf, 0.5 * numCols, 0.5 * numRows); // FWHM for target 259 psLogMsg("ppStack", PS_LOG_INFO, "Target seeing FWHM: %f\n", options->targetSeeing); 239 260 240 261 pmChip *outChip = pmFPAfileThisChip(config->files, view, "PPSTACK.OUTPUT"); // Output chip
Note:
See TracChangeset
for help on using the changeset viewer.
