Skip to content

Commit

Permalink
Actually load fringe data in quickLook
Browse files Browse the repository at this point in the history
  • Loading branch information
isullivan committed Jan 26, 2024
1 parent c780214 commit 2c2e7ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
32 changes: 23 additions & 9 deletions python/lsst/summit/utils/quickLook.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ class QuickLookIsrTask(pipeBase.PipelineTask):
def __init__(self, isrTask=IsrTask, **kwargs):
super().__init__(**kwargs)
# Pass in IsrTask so that we can modify it slightly for unit tests.
# Note that this is not an instance of the IsrTask class, but the class
# itself, which is then instantiated later on, in the run() method,
# with the dynamically generated config.
self.isrTask = IsrTask

def run(self, ccdExposure, *,
camera=None,
bias=None,
dark=None,
flat=None,
fringes=pipeBase.Struct(fringes=None),
fringes=None,
defects=None,
linearizer=None,
crosstalk=None,
Expand Down Expand Up @@ -154,12 +157,11 @@ def run(self, ccdExposure, *,
the detector in question.
defects : `lsst.ip.isr.Defects`, optional
List of defects.
fringes : `lsst.pipe.base.Struct`, optional
Struct containing the fringe correction data, with
elements:
- ``fringes``: fringe calibration frame (`afw.image.Exposure`)
- ``seed``: random seed derived from the ccdExposureId for random
number generator (`uint32`)
fringes : `afw.image.Exposure`, optional
The fringe correction data.
This input is slightly different than the `fringes` keyword to
`lsst.ip.isr.IsrTask`, since the processing done in that task's
`runQuantum` method is instead done here.
opticsTransmission: `lsst.afw.image.TransmissionCurve`, optional
A ``TransmissionCurve`` that represents the throughput of the,
optics, to be evaluated in focal-plane coordinates.
Expand Down Expand Up @@ -221,7 +223,10 @@ def run(self, ccdExposure, *,
isrConfig.doFlat = True
self.log.info("Running with flat correction")

# TODO: deal with fringes here
if fringes:
isrConfig.doFringe = True
self.log.info("Running with fringe correction")

if defects:
isrConfig.doDefect = True
self.log.info("Running with defect correction")
Expand All @@ -239,7 +244,8 @@ def run(self, ccdExposure, *,
bfGains = newBFKernel.gain
isrConfig.doBrighterFatter = True
self.log.info("Running with new brighter-fatter correction")
except AttributeError:
except AttributeError as e:
self.log.warning(f"Error loading brighter-fatter correction: {e}")
bfGains = None
else:
bfGains = None
Expand All @@ -254,6 +260,14 @@ def run(self, ccdExposure, *,

isrConfig.doWrite = False
isrTask = self.isrTask(config=isrConfig)

if fringes:
# Must be run after isrTask is instantiated.
isrTask.fringe.loadFringes(fringes,
expId=ccdExposure.info.id,
assembler=isrTask.assembleCcd
if isrConfig.doAssembleIsrExposures else None)

result = isrTask.run(ccdExposure,
camera=camera,
bias=bias,
Expand Down
4 changes: 1 addition & 3 deletions tests/test_quickLook.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@


class QuickLookIsrTaskTestCase(unittest.TestCase):

"""Tests of the run method with fake data.
"""

Expand Down Expand Up @@ -149,7 +148,6 @@ def setUp(self):
butlerTests.addDataIdValue(self.repo, "instrument", instrument)
butlerTests.addDataIdValue(self.repo, "physical_filter", physical_filter, band=band)
butlerTests.addDataIdValue(self.repo, "detector", detector)
# butlerTests.addDataIdValue(self.repo, "detector", detector + 1)
butlerTests.addDataIdValue(self.repo, "exposure", exposureId, physical_filter=physical_filter)
butlerTests.addDataIdValue(self.repo, "visit", visit)

Expand Down Expand Up @@ -258,7 +256,7 @@ def test_runQuantum(self):
config.doDeferredCharge = True
config.usePtcReadNoise = True
config.doCrosstalk = True
config.doBrighterFatter = False
config.doBrighterFatter = True

# Override a method in IsrTask that is executed early, to instead raise
# a custom exception called ExitMock that we can catch and ignore.
Expand Down

0 comments on commit 2c2e7ee

Please sign in to comment.