Skip to content

Commit

Permalink
Fix bitrot for using new style brighter-fatter kernels
Browse files Browse the repository at this point in the history
Remove unused config option for specifying files
  • Loading branch information
mfisherlevine committed Dec 18, 2019
1 parent a3d1195 commit 0ed9f9e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,6 @@ class IsrTaskConfig(pipeBase.PipelineTaskConfig,
"DETECTOR": "One kernel per detector",
}
)
brighterFatterKernelFile = pexConfig.Field(
dtype=str,
default='',
doc="Kernel file used for the brighter fatter correction"
)
brighterFatterMaxIter = pexConfig.Field(
dtype=int,
default=10,
Expand Down Expand Up @@ -919,21 +914,25 @@ def readIsrData(self, dataRef, rawExposure):

brighterFatterKernel = None
if self.config.doBrighterFatter is True:

# Use the new-style cp_pipe version of the kernel is it exists.
try:
try: # Use the new-style cp_pipe version of the kernel is it exists.
brighterFatterKernel = dataRef.get("brighterFatterKernel")
self.log.info("New style bright-fatter kernel (brighterFatterKernel) loaded")
except NoResults:
# Fall back to the old-style numpy-ndarray style kernel if necessary.
try:
try: # Fall back to the old-style numpy-ndarray style kernel if necessary.
brighterFatterKernel = dataRef.get("bfKernel")
self.log.info("Old style bright-fatter kernel (np.array) loaded")
except NoResults:
brighterFatterKernel = None
if brighterFatterKernel is not None and not isinstance(brighterFatterKernel, numpy.ndarray):
# If the kernel is not an ndarray, it's the cp_pipe version, so extract the kernel for
# this detector, or raise an error.
# If the kernel is not an ndarray, it's the cp_pipe version
# so extract the kernel for this detector, or raise an error
if self.config.brighterFatterLevel == 'DETECTOR':
brighterFatterKernel = brighterFatterKernel.kernel[ccd.getId()]
if brighterFatterKernel.detectorKernel:
brighterFatterKernel = brighterFatterKernel.detectorKernel[ccd.getId()]
elif brighterFatterKernel.detectorKernelFromAmpKernels:
brighterFatterKernel = brighterFatterKernel.detectorKernelFromAmpKernels[ccd.getId()]
else:
raise RuntimeError("Failed to extract kernel from new-style BF kernel.")
else:
# TODO DM-15631 for implementing this
raise NotImplementedError("Per-amplifier brighter-fatter correction not implemented")
Expand Down

0 comments on commit 0ed9f9e

Please sign in to comment.