Changeset 32695 for trunk/psphot/src/psphotStackReadout.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111110 (added) merged: 32645-32647,32660-32663,32685-32686,32689-32694
- Property svn:mergeinfo changed
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111110/psphot (added) merged: 32685-32686,32689,32692,32694
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotStackReadout.c
r32633 r32695 82 82 } 83 83 84 // XXX I think this is not defined correctly for an array of images.85 // XXX I probably need to subtract the model (same model?) for both RAW and OUT.86 // XXX But, probably not a problem in practice since the stacks are constructed with 0.0 mean level.87 88 84 // generate a background model (median, smoothed image) 89 85 if (!psphotModelBackground (config, view, STACK_DET)) { … … 91 87 } 92 88 if (!psphotSubtractBackground (config, view, STACK_DET)) { 89 return psphotReadoutCleanup (config, view, STACK_SRC); 90 } 91 if (!psphotSubtractBackground (config, view, STACK_SRC)) { 93 92 return psphotReadoutCleanup (config, view, STACK_SRC); 94 93 } … … 114 113 } 115 114 116 // if DET and SRC are different images, copy the detections from DET to SRC 115 // If DET and SRC are different images, copy the detections from DET to SRC. This 'copy' 116 // is just a copy of the container pointer; the sources on both DET and SRC are the same 117 // memory objects 117 118 if (strcmp(STACK_SRC, STACK_DET)) { 118 119 if (!psphotCopySources (config, view, STACK_SRC, STACK_DET)) { … … 130 131 return psphotReadoutCleanup (config, view, STACK_SRC); 131 132 } 133 // psphotDumpTest (config, view, STACK_SRC); 132 134 psMemDump("sourcestats"); 133 135 … … 166 168 167 169 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 168 // XXX why do this as a stack operation?169 // psphotFitSourcesLinearStack (config, objects, false);170 170 psphotFitSourcesLinear (config, view, STACK_SRC, false); 171 171 psphotStackVisualFilerule(config, view, STACK_SRC); … … 186 186 psphotBlendFit (config, view, STACK_SRC); // pass 1 (detections->allSources) 187 187 188 // replace all sources 189 psphotReplaceAllSources (config, view, STACK_SRC ); // pass 1 (detections->allSources)188 // replace all sources (do NOT ignore subtraction state) 189 psphotReplaceAllSources (config, view, STACK_SRC, false); // pass 1 (detections->allSources) 190 190 191 191 // if we only do one pass, skip to extended source analysis … … 194 194 // linear fit to include all sources (subtract again) 195 195 // NOTE : apply to ALL sources (extended + psf) 196 // NOTE 2 : this function subtracts the models from the given filerule (SRC), not DET 196 197 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 2 (detections->allSources) 197 198 … … 200 201 // NOTE: this block performs the 2nd pass low-significance PSF detection stage 201 202 { 203 // if DET and SRC are different images, generate children sources for all sources in 204 // the SRC image. This operation replaces the existing DETECTION container on DET 205 // which is currently a view to the one on SRC). children sources go to 206 // det->allSources 207 if (strcmp(STACK_SRC, STACK_DET)) { 208 psphotSourceChildren (config, view, STACK_DET, STACK_SRC); 209 210 // subtract all sources from DET (this will subtract using the psf model for SRC, which 211 // will somewhat oversubtract the sources -- this is OK 212 psphotRemoveAllSources (config, view, STACK_DET, false); // ignore subtraction state for sources 213 } 214 202 215 // add noise for subtracted objects 203 216 psphotAddNoise (config, view, STACK_DET); // pass 1 (detections->allSources) … … 212 225 213 226 // if DET and SRC are different images, copy the detections from DET to SRC 227 // (this operation just ensures the metadata container has a view on SRC as well 214 228 if (strcmp(STACK_SRC, STACK_DET)) { 215 // XXX how does this handle 1st vs 2nd pass sources? 216 if (!psphotCopySources (config, view, STACK_SRC, STACK_DET)) { 229 // replace all sources in DET 230 psphotReplaceAllSources (config, view, STACK_DET, false); // ignore subtraction state for sources 231 232 // copy the newly detected peaks from DET to SRC so SourceStats below can operate on them 233 if (!psphotCopyPeaks (config, view, STACK_SRC, STACK_DET)) { 217 234 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 218 235 return psphotReadoutCleanup (config, view, STACK_SRC); … … 237 254 // replace all sources so fit below applies to all at once 238 255 // NOTE: apply only to OLD sources (which have been subtracted) 239 psphotReplaceAllSources (config, view, STACK_SRC ); // pass 2256 psphotReplaceAllSources (config, view, STACK_SRC, false); // pass 2 240 257 241 258 // merge the newly selected sources into the existing list … … 312 329 313 330 // replace the flux in the image so it is returned to its original state 314 psphotReplaceAllSources (config, view, STACK_OUT );331 psphotReplaceAllSources (config, view, STACK_OUT, false); 315 332 316 333 // smooth to the next FWHM, or set 'smoothAgain' to false if no more
Note:
See TracChangeset
for help on using the changeset viewer.
