Skip to content
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-20154: Implement new initial WCS design #105

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/lsst/ip/isr/isrFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,8 @@ def attachTransmissionCurve(exposure, opticsTransmission=None, filterTransmissio
return combined


@deprecated(reason="Camera geometry-based SkyWcs are now set when reading raws. To be removed after v19.",
category=FutureWarning)
def addDistortionModel(exposure, camera):
"""!Update the WCS in exposure with a distortion model based on camera
geometry.
Expand Down
11 changes: 2 additions & 9 deletions python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ class IsrTaskConfig(pexConfig.Config):
dtype=bool,
doc="Apply a distortion model based on camera geometry to the WCS?",
default=True,
deprecated=("Camera geometry is incorporated when reading the raw files."
" This option no longer is used, and will be removed after v19.")
)

# Initial CCD-level background statistics options.
Expand Down Expand Up @@ -1163,8 +1165,6 @@ def run(self, ccdExposure, camera=None, bias=None, linearizer=None, crosstalkSou
raise RuntimeError("Must supply a flat exposure if config.doFlat=True.")
if self.config.doDefect and defects is None:
raise RuntimeError("Must supply defects if config.doDefect=True.")
if self.config.doAddDistortionModel and camera is None:
raise RuntimeError("Must supply camera if config.doAddDistortionModel=True.")
if (self.config.doFringe and filterName in self.fringe.config.filters and
fringes.fringes is None):
# The `fringes` object needs to be a pipeBase.Struct, as
Expand Down Expand Up @@ -1388,10 +1388,6 @@ def run(self, ccdExposure, camera=None, bias=None, linearizer=None, crosstalkSou
sensorTransmission=sensorTransmission,
atmosphereTransmission=atmosphereTransmission)

if self.config.doAddDistortionModel:
parejkoj marked this conversation as resolved.
Show resolved Hide resolved
self.log.info("Adding a distortion model to the WCS.")
isrFunctions.addDistortionModel(exposure=ccdExposure, camera=camera)

flattenedThumb = None
if self.config.qa.doThumbnailFlattened:
flattenedThumb = isrQa.makeThumbnail(ccdExposure, isrQaConfig=self.config.qa)
Expand Down Expand Up @@ -1502,9 +1498,6 @@ def runDataRef(self, sensorRef):
ccdExposure = sensorRef.get(self.config.datasetType)

camera = sensorRef.get("camera")
if camera is None and self.config.doAddDistortionModel:
raise RuntimeError("config.doAddDistortionModel is True "
"but could not get a camera from the butler.")
isrData = self.readIsrData(sensorRef, ccdExposure)

result = self.run(ccdExposure, camera=camera, **isrData.getDict())
Expand Down
18 changes: 4 additions & 14 deletions tests/test_addDistortionModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
import lsst.ip.isr.isrFunctions as isrFunctions


class ApplyLookupTableTestCase(lsst.utils.tests.TestCase):
"""Test IsrTask.addDistortionModel
class AddDistortionModelTestCase(lsst.utils.tests.TestCase):
"""Test IsrTask.addDistortionModel.

DEPRECATED: to be removed with addDistortionModel
"""

def setUp(self):
Expand Down Expand Up @@ -83,18 +85,6 @@ def makeDesiredDistortedWcs(self):
focalPlaneToFieldAngle = self.camera.getTransformMap().getTransform(FOCAL_PLANE, FIELD_ANGLE)
return makeDistortedTanWcs(self.wcs, pixelToFocalPlane, focalPlaneToFieldAngle)

def testRunWithAddDistortionModel(self):
"""Test IsrTask.run with config.doAddDistortionModel true"""
isrConfig = self.makeMinimalIsrConfig()
isrConfig.doAddDistortionModel = True
isrTask = IsrTask(config=isrConfig)
with self.assertRaises(RuntimeError):
# the camera argument is required
isrTask.run(ccdExposure=self.exposure)
exposure = isrTask.run(ccdExposure=self.exposure, camera=self.camera).exposure
desiredWcs = self.makeDesiredDistortedWcs()
self.assertWcsAlmostEqualOverBBox(desiredWcs, exposure.getWcs(), self.bbox)

def testRunWithoutAddDistortionModel(self):
"""Test IsrTask.run with config.doAddDistortionModel false"""
isrConfig = self.makeMinimalIsrConfig()
Expand Down