Skip to content

Commit

Permalink
review straylight edits to rebase -- add straylight.check
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Dec 6, 2019
1 parent cbb0dc4 commit 67e41a8
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions python/lsst/obs/subaru/strayLight/yStrayLight.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,26 @@ def readIsrData(self, dataRef, rawExposure):
# Note that this is run only in Gen2; in Gen3 we will rely on having
# a proper butler-recognized dataset type with the right validity
# ranges (though this has not yet been implemented).
detId = rawExposure.getDetector().getId()
if not self.checkFilter(rawExposure):
# No correction to be made
if not self.check(rawExposure):
return None

return SubaruStrayLightData(dataRef.get("yBackground_filename")[0])

def check(self, exposure):
# Docstring inherited from StrayLightTask.check.
detId = exposure.getDetector().getId()
if not self.checkFilter(exposure):
# No correction to be made
return False
if detId in range(104, 112):
# No correction data: assume it's zero
return None
if rawExposure.getInfo().getVisitInfo().getDate().toPython() >= datetime.datetime(2018, 1, 1):
return False
if exposure.getInfo().getVisitInfo().getDate().toPython >= datetime.datetime(2018, 1, 1):
# LEDs causing the stray light have been covered up.
# We believe there is no remaining stray light.
return None
return SubaruStrayLightData(dataRef.get("yBackground_filename")[0])
return False

return True

def run(self, exposure, strayLightData):
"""Subtract the y-band stray light
Expand All @@ -87,22 +95,14 @@ def run(self, exposure, strayLightData):
An opaque object that contains any calibration data used to
correct for stray light.
"""
exposureMetadata = exposure.getMetadata()
detId = exposure.getDetector().getId()

if not self.checkFilter(exposure):
self.log.info("No straylight correction needed.")
return None
if detId in range(104, 112):
self.log.info("No straylight correction needed.")
return None
if exposure.getInfo().getVisitInfo().getDate().toPython() >= datetime.datetime(2018, 1, 1):
self.log.info("No straylight correction needed.")
if not self.check(exposure):
return None

if strayLightData is None:
raise RuntimeError("No strayLightData supplied for correction.")

exposureMetadata = exposure.getMetadata()
detId = exposure.getDetector().getId()
if self.config.doRotatorAngleCorrection:
angleStart, angleEnd = inrStartEnd(exposure.getInfo().getVisitInfo())
self.log.debug(
Expand Down

0 comments on commit 67e41a8

Please sign in to comment.