Skip to content

Commit

Permalink
constructCalibs: check for non-finite darktime
Browse files Browse the repository at this point in the history
Scaling by a non-finite darktime can destroy the image.
This is important because the darktime defaults to NAN
unless set explicitly by the obs package.
  • Loading branch information
PaulPrice committed Jan 16, 2017
1 parent e6a1387 commit 4a0c73c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python/lsst/pipe/drivers/constructCalibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,6 @@ class DarkConfig(CalibConfig):
psfSize = Field(dtype=int, default=21, doc="Repair PSF size (pixels)")
crGrow = Field(dtype=int, default=2, doc="Grow radius for CR (pixels)")
repair = ConfigurableField(target=RepairTask, doc="Task to repair artifacts")
darkTime = Field(dtype=str, default="DARKTIME",
doc="Header keyword for time since last CCD wipe, or None", optional=True)

def setDefaults(self):
CalibConfig.setDefaults(self)
Expand Down Expand Up @@ -718,9 +716,10 @@ def processSingle(self, sensorRef):

def getDarkTime(self, exposure):
"""Retrieve the dark time for an exposure"""
if self.config.darkTime is not None:
return exposure.getMetadata().get(self.config.darkTime)
return exposure.getInfo().getVisitInfo().getDarkTime()
darkTime = exposure.getInfo().getVisitInfo().getDarkTime()
if not numpy.isfinite(darkTime):
raise RuntimeError("Non-finite darkTime")
return darkTime


class FlatConfig(CalibConfig):
Expand Down

0 comments on commit 4a0c73c

Please sign in to comment.