Skip to content

Commit

Permalink
Clarify configuration options; remove unneeded image writes.
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Dec 12, 2018
1 parent 1c1511f commit 3e85eb0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
4 changes: 2 additions & 2 deletions python/lsst/ip/isr/isrQa.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class IsrQaConfig(pexConfig.Config):
doThumbnailOss = pexConfig.Field(
dtype=bool,
doc="Write overscan subtracted thumbnail?",
default=False,
default=True,
)

doWriteFlattened = pexConfig.Field(
Expand All @@ -86,7 +86,7 @@ class IsrQaConfig(pexConfig.Config):
doThumbnailFlattened = pexConfig.Field(
dtype=bool,
doc="Write thumbnail after flat-field correction?",
default=False,
default=True,
)

thumbnailBinning = pexConfig.Field(
Expand Down
37 changes: 29 additions & 8 deletions python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class IsrTaskConfig(pexConfig.Config):
Items are grouped in the order in which they are executed by the task.
"""
# General ISR configuration
datasetType = pexConfig.Field(
dtype=str,
doc="Dataset type for input data; users will typically leave this alone, "
Expand All @@ -83,12 +84,14 @@ class IsrTaskConfig(pexConfig.Config):
doc="QA related configuration options.",
)

# Image conversion configuration
doConvertIntToFloat = pexConfig.Field(
dtype=bool,
doc="Convert integer raw images to floating point values?",
default=True,
)

# Saturated pixel handling.
doSaturation = pexConfig.Field(
dtype=bool,
doc="Mask saturated pixels?",
Expand All @@ -110,6 +113,7 @@ class IsrTaskConfig(pexConfig.Config):
default=1,
)

# Suspect pixel handling.
doSuspect = pexConfig.Field(
dtype=bool,
doc="Mask suspect pixels?",
Expand All @@ -126,6 +130,7 @@ class IsrTaskConfig(pexConfig.Config):
default=0,
)

# Initial masking options.
doSetBadRegions = pexConfig.Field(
dtype=bool,
doc="Should we set the level of all BAD patches of the chip to the chip's average value?",
Expand All @@ -141,6 +146,7 @@ class IsrTaskConfig(pexConfig.Config):
},
)

# Overscan subtraction configuration.
doOverscan = pexConfig.Field(
dtype=bool,
doc="Do overscan subtraction?",
Expand Down Expand Up @@ -214,6 +220,7 @@ class IsrTaskConfig(pexConfig.Config):
default=0,
)

# Amplifier to CCD assembly configuration
doAssembleCcd = pexConfig.Field(
dtype=bool,
default=True,
Expand All @@ -224,6 +231,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="CCD assembly task",
)

# General calibration configuration.
doAssembleIsrExposures = pexConfig.Field(
dtype=bool,
default=False,
Expand All @@ -235,6 +243,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="Trim raw data to match calibration bounding boxes?"
)

# Bias subtraction.
doBias = pexConfig.Field(
dtype=bool,
doc="Apply bias frame correction?",
Expand All @@ -246,6 +255,7 @@ class IsrTaskConfig(pexConfig.Config):
default="bias",
)

# Variance construction
doVariance = pexConfig.Field(
dtype=bool,
doc="Calculate variance?",
Expand All @@ -267,12 +277,14 @@ class IsrTaskConfig(pexConfig.Config):
doc="Calculate empirical read noise instead of value from AmpInfo data?"
)

# Linearization.
doLinearize = pexConfig.Field(
dtype=bool,
doc="Correct for nonlinearity of the detector's response?",
default=True,
)

# Crosstalk.
doCrosstalk = pexConfig.Field(
dtype=bool,
doc="Apply intra-CCD crosstalk correction?",
Expand All @@ -288,12 +300,14 @@ class IsrTaskConfig(pexConfig.Config):
doc="Intra-CCD crosstalk correction",
)

# Masking option prior to brighter-fatter.
doWidenSaturationTrails = pexConfig.Field(
dtype=bool,
doc="Widen bleed trails based on their width?",
default=True
)

# Brighter-Fatter correction.
doBrighterFatter = pexConfig.Field(
dtype=bool,
default=False,
Expand Down Expand Up @@ -331,6 +345,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="Should the gain be applied when applying the brighter fatter correction?"
)

# Defect and bad pixel correction options.
doDefect = pexConfig.Field(
dtype=bool,
doc="Apply correction for CCD defects, e.g. hot pixels?",
Expand All @@ -347,6 +362,7 @@ class IsrTaskConfig(pexConfig.Config):
default=0,
)

# Dark subtraction.
doDark = pexConfig.Field(
dtype=bool,
doc="Apply dark frame correction?",
Expand All @@ -358,6 +374,7 @@ class IsrTaskConfig(pexConfig.Config):
default="dark",
)

# Camera-specific stray light removal.
doStrayLight = pexConfig.Field(
dtype=bool,
doc="Subtract stray light in the y-band (due to encoder LEDs)?",
Expand All @@ -368,6 +385,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="y-band stray light correction"
)

# Flat correction.
doFlat = pexConfig.Field(
dtype=bool,
doc="Apply flat field correction?",
Expand Down Expand Up @@ -399,6 +417,7 @@ class IsrTaskConfig(pexConfig.Config):
default=False
)

# Amplifier normalization based on gains instead of using flats configuration.
doApplyGains = pexConfig.Field(
dtype=bool,
doc="Correct the amplifiers for their gains instead of applying flat correction",
Expand All @@ -410,6 +429,7 @@ class IsrTaskConfig(pexConfig.Config):
default=False,
)

# Fringe correction.
doFringe = pexConfig.Field(
dtype=bool,
doc="Apply fringe correction?",
Expand All @@ -425,25 +445,29 @@ class IsrTaskConfig(pexConfig.Config):
default=True,
)

# NAN pixel interpolation option.
doNanInterpAfterFlat = pexConfig.Field(
dtype=bool,
doc=("If True, ensure we interpolate NaNs after flat-fielding, even if we "
"also have to interpolate them before flat-fielding."),
default=False,
)

# Distortion model application.
doAddDistortionModel = pexConfig.Field(
dtype=bool,
doc="Apply a distortion model based on camera geometry to the WCS?",
default=True,
)

# Initial CCD-level background statistics options.
doMeasureBackground = pexConfig.Field(
dtype=bool,
doc="Measure the background level on the reduced image?",
default=False,
)

# Camera-specific masking configuration.
doCameraSpecificMasking = pexConfig.Field(
dtype=bool,
doc="Mask camera-specific bad regions?",
Expand All @@ -454,6 +478,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="Masking task."
)

# Default photometric calibration options.
fluxMag0T1 = pexConfig.DictField(
keytype=str,
itemtype=float,
Expand All @@ -467,6 +492,7 @@ class IsrTaskConfig(pexConfig.Config):
default=pow(10.0, 0.4*28.0)
)

# Vignette correction configuration.
doVignette = pexConfig.Field(
dtype=bool,
doc="Apply vignetting parameters?",
Expand All @@ -477,6 +503,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="Vignetting task.",
)

# Transmission curve configuration.
doAttachTransmissionCurve = pexConfig.Field(
dtype=bool,
default=False,
Expand All @@ -503,6 +530,7 @@ class IsrTaskConfig(pexConfig.Config):
doc="Load and use transmission_atmosphere (if doAttachTransmissionCurve is True)?"
)

# Write the outputs to disk. If ISR is run as a subtask, this may not be needed.
doWrite = pexConfig.Field(
dtype=bool,
doc="Persist postISRCCD?",
Expand Down Expand Up @@ -844,10 +872,6 @@ def run(self, ccdExposure, camera=None, bias=None, linearizer=None, crosstalkSou
self.log.warn("No WCS found in input exposure")
self.debugView(ccdExposure, "doAssembleCcd")

# CZW: push these into output struct, add to docstring
# if self.config.qa.doWriteOss:
# sensorRef.put(ccdExposure, "ossImage")
# if self.config.qa.doThumbnailOss:
ossThumb = None
if self.config.qa.doThumbnailOss:
ossThumb = isrQa.makeThumbnail(ccdExposure, isrQaConfig=self.config.qa)
Expand Down Expand Up @@ -910,7 +934,7 @@ def run(self, ccdExposure, camera=None, bias=None, linearizer=None, crosstalkSou
interpolationDone = True

if self.config.brighterFatterLevel == 'DETECTOR':
kernelElement = bfKernel # [ccdExposure.getDetector().getId()]
kernelElement = bfKernel
else:
# TODO: DM-15631 for implementing this
raise NotImplementedError("per-amplifier brighter-fatter correction not yet implemented")
Expand Down Expand Up @@ -966,9 +990,6 @@ def run(self, ccdExposure, camera=None, bias=None, linearizer=None, crosstalkSou
badPixelCount, badPixelValue = isrFunctions.setBadRegions(ccdExposure)
self.log.info("Set %d BAD pixels to %f." % (badPixelCount, badPixelValue))

# CZW: add this to the result struct
# if self.config.qa.doWriteFlattened:
# sensorRef.put(ccdExposure, "flattenedImage")
flattenedThumb = None
if self.config.qa.doThumbnailFlattened:
flattenedThumb = isrQa.makeThumbnail(ccdExposure, isrQaConfig=self.config.qa)
Expand Down

0 comments on commit 3e85eb0

Please sign in to comment.