Changeset 33917
- Timestamp:
- May 25, 2012, 11:14:13 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotStackReadout.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotStackReadout.c
r32996 r33917 89 89 return psphotReadoutCleanup (config, view, STACK_SRC); 90 90 } 91 if (!psphotSubtractBackground (config, view, STACK_SRC)) { 92 return psphotReadoutCleanup (config, view, STACK_SRC); 91 if (strcmp(STACK_SRC, STACK_DET)) { 92 #define MODEL_BACKGROUND_SRC 1 93 #ifdef MODEL_BACKGROUND_SRC 94 // work around the fact that the background levels on the convolved 95 // and unconvolved stacks can be different 96 if (!psphotModelBackground (config, view, STACK_SRC)) { 97 return psphotReadoutCleanup (config, view, STACK_SRC); 98 } 99 #endif 100 if (!psphotSubtractBackground (config, view, STACK_SRC)) { 101 return psphotReadoutCleanup (config, view, STACK_SRC); 102 } 93 103 } 94 104 if (!strcasecmp (breakPt, "BACKMDL")) { … … 190 200 psphotReplaceAllSources (config, view, STACK_SRC, false); // pass 1 (detections->allSources) 191 201 202 192 203 // if we only do one pass, skip to extended source analysis 193 204 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish; … … 211 222 // subtract all sources from DET (this will subtract using the psf model for SRC, which 212 223 // will somewhat oversubtract the sources -- this is OK 213 psphotRemoveAllSources (config, view, STACK_DET, false); // ignore subtraction state for sources224 psphotRemoveAllSources (config, view, STACK_DET, false); // do not ignore subtraction state for sources 214 225 } 215 226 … … 223 234 // remove noise for subtracted objects (ie, return to normal noise level) 224 235 // NOTE: this needs to operate only on the OLD sources 225 psphotSubNoise (config, view, STACK_DET); // pass 1 (detections->allSources) 236 // NOTE: if fooprintsUseUnsubtracted, the noise has already been removed by psphotFindDetections 237 bool footprintsUseUnsubtracted = psMetadataLookupBool(NULL, recipe, "FOOTPRINT_USE_UNSUBTRACTED"); 238 if (!footprintsUseUnsubtracted) { 239 psphotSubNoise (config, view, STACK_DET); // pass 1 (detections->allSources) 240 } 226 241 227 242 // if DET and SRC are different images, copy the detections from DET to SRC … … 303 318 304 319 // create source children for the OUT filerule (for radial aperture photometry) 305 psArray *objectsRadial = psphotSourceChildrenByObject (config, view, STACK_OUT, objects); 306 if (!objectsRadial) { 320 // (These are not just for radial aperture photomoetry. If they aren't defined we 321 // get no sources output 322 psArray *objectsOut = psphotSourceChildrenByObject (config, view, STACK_OUT, objects); 323 if (!objectsOut) { 307 324 psFree(objects); 308 325 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); … … 310 327 } 311 328 312 // measure circular, radial apertures (objects sorted by S/N) 313 // this forces photometry on the undetected sources from other images 314 psphotRadialApertures (config, view, STACK_SRC, 0); // XXX entry 0 == unmatched? 315 psMemDump("extmeas"); 316 317 int nRadialEntries = psphotStackMatchPSFsEntries(config, view, STACK_OUT); 318 319 for (int entry = 1; entry < nRadialEntries; entry++) { 320 // NOTE: entry 0 is the unmatched image set 321 322 // re-measure the PSF for the smoothed image (using entries in 'allSources') 323 psphotChoosePSF (config, view, STACK_OUT, false); 324 325 // this is necessary to update the models based on the new PSF 326 psphotResetModels (config, view, STACK_OUT); 327 328 // this is necessary to get the right normalization for the new models 329 psphotFitSourcesLinear (config, view, STACK_OUT, false); 330 331 // measure circular, radial apertures (objects sorted by S/N) 332 // entry 0 == unmatched? pass entry + 1? 333 psphotRadialApertures (config, view, STACK_OUT, entry); 334 335 // replace the flux in the image so it is returned to its original state 336 psphotReplaceAllSources (config, view, STACK_OUT, false); 337 338 // smooth to the next FWHM, or set 'smoothAgain' to false if no more 339 psphotStackMatchPSFsNext(config, view, STACK_OUT, entry); 340 psMemDump("matched"); 329 330 bool radial_apertures = psMetadataLookupBool(NULL, recipe, "RADIAL_APERTURES"); 331 if (radial_apertures) { 332 // measure circular, radial apertures (objects sorted by S/N) 333 // this forces photometry on the undetected sources from other images 334 psphotRadialApertures (config, view, STACK_SRC, 0); // XXX entry 0 == unmatched? 335 psMemDump("extmeas"); 336 337 int nRadialEntries = psphotStackMatchPSFsEntries(config, view, STACK_OUT); 338 339 for (int entry = 1; entry < nRadialEntries; entry++) { 340 // NOTE: entry 0 is the unmatched image set 341 342 // re-measure the PSF for the smoothed image (using entries in 'allSources') 343 psphotChoosePSF (config, view, STACK_OUT, false); 344 345 // this is necessary to update the models based on the new PSF 346 psphotResetModels (config, view, STACK_OUT); 347 348 // this is necessary to get the right normalization for the new models 349 psphotFitSourcesLinear (config, view, STACK_OUT, false); 350 351 // measure circular, radial apertures (objects sorted by S/N) 352 // entry 0 == unmatched? pass entry + 1? 353 psphotRadialApertures (config, view, STACK_OUT, entry); 354 355 // replace the flux in the image so it is returned to its original state 356 psphotReplaceAllSources (config, view, STACK_OUT, false); 357 358 // smooth to the next FWHM, or set 'smoothAgain' to false if no more 359 psphotStackMatchPSFsNext(config, view, STACK_OUT, entry); 360 psMemDump("matched"); 361 } 341 362 } 342 363 … … 344 365 if (!psphotApResid (config, view, STACK_SRC)) { 345 366 psFree (objects); 367 psFree (objectsOut); 346 368 psLogMsg ("psphot", 3, "failed on psphotApResid"); 347 369 return psphotReadoutCleanup (config, view, STACK_SRC); … … 375 397 376 398 psFree (objects); 377 psFree (objects Radial);399 psFree (objectsOut); 378 400 379 401 // create the exported-metadata and free local data
Note:
See TracChangeset
for help on using the changeset viewer.
