Skip to content

Commit

Permalink
Allow doMeasurePsf=False when exposure lacks Psf.
Browse files Browse the repository at this point in the history
Instead of raising an error, use the Psf implied by installSimplePsf
config variables.
  • Loading branch information
jmeyers314 committed Jan 13, 2017
1 parent cb841df commit eec83ac
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions python/lsst/pipe/tasks/characterizeImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ class CharacterizeImageConfig(pexConfig.Config):
doMeasurePsf = pexConfig.Field(
dtype = bool,
default = True,
doc = "Measure PSF? If False then keep the existing PSF model (which must exist) "
"and use that model for all operations."
doc = "Measure PSF? If False then for all subsequent operations use either existing PSF "
"model when present, or install simple PSF model when not (see installSimplePsf "
"config options)"
)
doWrite = pexConfig.Field(
dtype = bool,
Expand Down Expand Up @@ -407,7 +408,8 @@ def characterize(self, exposure, exposureIdInfo=None, background=None):
self._frame = self._initialFrame # reset debug display frame

if not self.config.doMeasurePsf and not exposure.hasPsf():
raise RuntimeError("exposure has no PSF model and config.doMeasurePsf false")
self.log.warn("Source catalog detected and measured with placeholder or default PSF")
self.installSimplePsf.run(exposure=exposure)

if exposureIdInfo is None:
exposureIdInfo = ExposureIdInfo()
Expand Down Expand Up @@ -455,7 +457,7 @@ def detectMeasureAndEstimatePsf(self, exposure, exposureIdInfo, background):
"""!Perform one iteration of detect, measure and estimate PSF
Performs the following operations:
- if config.doMeasurePsf:
- if config.doMeasurePsf or not exposure.hasPsf():
- install a simple PSF model (replacing the existing one, if need be)
- interpolate over cosmic rays with keepCRs=True
- estimate background and subtract it from the exposure
Expand All @@ -480,12 +482,10 @@ def detectMeasureAndEstimatePsf(self, exposure, exposureIdInfo, background):
- background model of background subtracted from exposure (an lsst.afw.math.BackgroundList)
- psfCellSet spatial cells of PSF candidates (an lsst.afw.math.SpatialCellSet)
"""
# install a simple PSF model, if wanted
if self.config.doMeasurePsf:
if self.config.useSimplePsf or not exposure.hasPsf():
self.installSimplePsf.run(exposure=exposure)
elif not exposure.hasPsf():
raise RuntimeError("exposure has no PSF model and config.doMeasurePsf false")
# install a simple PSF model, if needed or wanted
if not exposure.hasPsf() or (self.config.doMeasurePsf and self.config.useSimplePsf):
self.log.warn("Source catalog detected and measured with placeholder or default PSF")
self.installSimplePsf.run(exposure=exposure)

# run repair, but do not interpolate over cosmic rays (do that elsewhere, with the final PSF model)
self.repair.run(exposure=exposure, keepCRs=True)
Expand Down

0 comments on commit eec83ac

Please sign in to comment.