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 4fd04ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
29 changes: 21 additions & 8 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 Down Expand Up @@ -254,6 +259,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 4fd04ca

Please sign in to comment.