- Timestamp:
- Jun 19, 2012, 5:24:19 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotStackReadout.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111122/psphot merged: 33070-33071,33086,33088,33094-33095,33612,33640 /branches/eam_branches/ipp-20120405/psphot (added) merged: 33946,33953
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot/src
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot/src/psphotStackReadout.c
r33415 r34041 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 … … 302 317 psphotExtendedSourceFits (config, view, STACK_SRC); // pass 1 (detections->allSources) 303 318 304 // create source children for the OUT filerule (for radial aperture photometry )305 psArray *objects Radial= psphotSourceChildrenByObject (config, view, STACK_OUT, objects);306 if (!objects Radial) {319 // create source children for the OUT filerule (for radial aperture photometry and output) 320 psArray *objectsOut = psphotSourceChildrenByObject (config, view, STACK_OUT, objects); 321 if (!objectsOut) { 307 322 psFree(objects); 308 323 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); … … 310 325 } 311 326 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"); 327 328 bool radial_apertures = psMetadataLookupBool(NULL, recipe, "RADIAL_APERTURES"); 329 if (radial_apertures) { 330 // measure circular, radial apertures (objects sorted by S/N) 331 // this forces photometry on the undetected sources from other images 332 333 // NOTE: we always do the radial apertures analysis on the convolved image since 334 // those are the ones that are psf matched and the source of STACK_OUT's pixels 335 // XXX: Actually if PSPHOT.STACK.MATCH.PSF.SOURCE were set to RAW this wouldn't be true. 336 // but in that case we don't get past the psf matching step because there is no 337 // target psf for the RAW inputs 338 339 // If useRaw copy the sources to the convolved readout 340 if (strcmp(STACK_SRC, STACK_CNV)) { 341 if (!psphotCopySources (config, view, STACK_CNV, STACK_SRC)) { 342 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 343 return psphotReadoutCleanup (config, view, STACK_SRC); 344 } 345 } 346 psphotRadialApertures (config, view, STACK_CNV, 0); // XXX entry 0 == unmatched? 347 psMemDump("extmeas"); 348 349 int nRadialEntries = psphotStackMatchPSFsEntries(config, view, STACK_OUT); 350 351 for (int entry = 1; entry < nRadialEntries; entry++) { 352 // NOTE: entry 0 is the unmatched image set 353 354 // re-measure the PSF for the smoothed image (using entries in 'allSources') 355 psphotChoosePSF (config, view, STACK_OUT, false); 356 357 // this is necessary to update the models based on the new PSF 358 psphotResetModels (config, view, STACK_OUT); 359 360 // this is necessary to get the right normalization for the new models 361 psphotFitSourcesLinear (config, view, STACK_OUT, false); 362 363 // measure circular, radial apertures (objects sorted by S/N) 364 // entry 0 == unmatched? pass entry + 1? 365 psphotRadialApertures (config, view, STACK_OUT, entry); 366 367 // replace the flux in the image so it is returned to its original state 368 psphotReplaceAllSources (config, view, STACK_OUT, false); 369 370 // smooth to the next FWHM, or set 'smoothAgain' to false if no more 371 psphotStackMatchPSFsNext(config, view, STACK_OUT, entry); 372 psMemDump("matched"); 373 } 341 374 } 342 375 … … 344 377 if (!psphotApResid (config, view, STACK_SRC)) { 345 378 psFree (objects); 379 psFree (objectsOut); 346 380 psLogMsg ("psphot", 3, "failed on psphotApResid"); 347 381 return psphotReadoutCleanup (config, view, STACK_SRC); … … 375 409 376 410 psFree (objects); 377 psFree (objects Radial);411 psFree (objectsOut); 378 412 379 413 // create the exported-metadata and free local data
Note:
See TracChangeset
for help on using the changeset viewer.
