-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-40517: add unit test for quickLook #77
Changes from 7 commits
8f49355
c5f7820
280fc3c
08c18db
a9c4aa4
549e6c2
c780214
2c2e7ee
0a50ce5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,22 +89,32 @@ class QuickLookIsrTask(pipeBase.PipelineTask): | |
ConfigClass = QuickLookIsrTaskConfig | ||
_DefaultName = "quickLook" | ||
|
||
def __init__(self, **kwargs): | ||
def __init__(self, isrTask=IsrTask, **kwargs): | ||
super().__init__(**kwargs) | ||
# Pass in IsrTask so that we can modify it slightly for unit tests. | ||
self.isrTask = IsrTask | ||
|
||
def run(self, ccdExposure, *, | ||
camera=None, | ||
bias=None, | ||
dark=None, | ||
flat=None, | ||
fringes=pipeBase.Struct(fringes=None), | ||
defects=None, | ||
linearizer=None, | ||
crosstalk=None, | ||
bfKernel=None, | ||
bfGains=None, | ||
newBFKernel=None, | ||
ptc=None, | ||
crosstalkSources=None, | ||
isrBaseConfig=None | ||
isrBaseConfig=None, | ||
filterTransmission=None, | ||
opticsTransmission=None, | ||
strayLightData=None, | ||
sensorTransmission=None, | ||
atmosphereTransmission=None, | ||
deferredChargeCalib=None, | ||
illumMaskedImage=None, | ||
): | ||
"""Run isr and cosmic ray repair using, doing as much isr as possible. | ||
|
||
|
@@ -224,7 +234,17 @@ def run(self, ccdExposure, *, | |
isrConfig.doCrosstalk = True | ||
self.log.info("Running with crosstalk correction") | ||
|
||
if bfKernel: | ||
if newBFKernel is not None: | ||
try: | ||
bfGains = newBFKernel.gain | ||
isrConfig.doBrighterFatter = True | ||
self.log.info("Running with new brighter-fatter correction") | ||
except AttributeError: | ||
bfGains = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I took the statement "Should never fail" in the docstring of this task too literally! I'm happy to either log a warning or let it raise, your choice. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yeah, I see, I did wonder if it was something like that. I mean, it should never fail based if valid things are being passed in, but if, say, a calib was the wrong size or something truly awful like that then I think in those cases it should still raise tbh, otherwise the behaviour is sort of ill-defined. Everything that's passed in should work, and if it doesn't then I think that's raise-time. All the other raises like that are implicit and come from isrTask raising though, so I think raising here is fine. |
||
else: | ||
bfGains = None | ||
|
||
if bfKernel is not None and bfGains is None: | ||
isrConfig.doBrighterFatter = True | ||
self.log.info("Running with brighter-fatter correction") | ||
|
||
|
@@ -233,20 +253,28 @@ def run(self, ccdExposure, *, | |
self.log.info("Running with ptc correction") | ||
|
||
isrConfig.doWrite = False | ||
isrTask = IsrTask(config=isrConfig) | ||
isrTask = self.isrTask(config=isrConfig) | ||
result = isrTask.run(ccdExposure, | ||
camera=camera, | ||
bias=bias, | ||
dark=dark, | ||
flat=flat, | ||
# fringes=pipeBase.Struct(fringes=None), | ||
fringes=fringes, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we're actually accepting the fringes if they're passed in, I think we should also have a block that tests if we got fringes supplied, and if so, sets the config option on to use them. We can then remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think just replacing that TODO with
should do it. |
||
defects=defects, | ||
linearizer=linearizer, | ||
crosstalk=crosstalk, | ||
bfKernel=bfKernel, | ||
bfGains=bfGains, | ||
ptc=ptc, | ||
crosstalkSources=crosstalkSources,) | ||
crosstalkSources=crosstalkSources, | ||
filterTransmission=filterTransmission, | ||
opticsTransmission=opticsTransmission, | ||
sensorTransmission=sensorTransmission, | ||
atmosphereTransmission=atmosphereTransmission, | ||
strayLightData=strayLightData, | ||
deferredChargeCalib=deferredChargeCalib, | ||
illumMaskedImage=illumMaskedImage, | ||
) | ||
|
||
postIsr = result.exposure | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took me longer to understand than I care to admit, so I think a slightly more thorough comment might be useful here. Perhaps something along the lines of