Coverage for tests/test_addDistortionModel.py : 37%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # Copyright 2018 LSST Corporation. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
"""Test IsrTask.addDistortionModel.
DEPRECATED: to be removed with addDistortionModel """
self.camera = CameraWrapper().camera self.detector = DetectorWrapper().detector self.crpix = lsst.geom.Point2D(50, 100) self.crval = lsst.geom.SpherePoint(36, 71, lsst.geom.degrees) scale = 1.0*lsst.geom.arcseconds self.cdMatrix = afwGeom.makeCdMatrix(scale=scale) self.wcs = afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=self.cdMatrix) self.bbox = lsst.geom.Box2I(lsst.geom.Point2I(-10, 10), lsst.geom.Extent2I(1000, 1022)) self.exposure = ExposureF(self.bbox)
# set the few items of ExposureInfo needed by IsrTask.run # when only adding a distortion model exposureInfo = ExposureInfo(photoCalib=PhotoCalib(1.0), detector=self.detector, visitInfo=VisitInfo(exposureTime=1.0), wcs=self.wcs)
self.exposure.setInfo(exposureInfo)
self.detector = None self.exposure = None
"""Call IsrTask.addDistortionModel directly""" isrFunctions.addDistortionModel(self.exposure, self.camera) self.assertFalse(wcsAlmostEqualOverBBox(self.wcs, self.exposure.getWcs(), self.bbox))
desiredWcs = self.makeDesiredDistortedWcs() self.assertWcsAlmostEqualOverBBox(desiredWcs, self.exposure.getWcs(), self.bbox)
"""Return an IsrConfig with all boolean flags disabled""" isrConfig = IsrTask.ConfigClass() for name in isrConfig: if name.startswith("do"): setattr(isrConfig, name, False) return isrConfig
"""Make the expected distorted WCS""" pixelToFocalPlane = self.detector.getTransform(PIXELS, FOCAL_PLANE) focalPlaneToFieldAngle = self.camera.getTransformMap().getTransform(FOCAL_PLANE, FIELD_ANGLE) return makeDistortedTanWcs(self.wcs, pixelToFocalPlane, focalPlaneToFieldAngle)
"""Test IsrTask.run with config.doAddDistortionModel false""" isrConfig = self.makeMinimalIsrConfig() isrTask = IsrTask(config=isrConfig)
# the camera argument is not needed exposure = isrTask.run(ccdExposure=self.exposure).exposure self.assertEqual(self.wcs, exposure.getWcs())
# and the camera argument is ignored if provided exposure2 = isrTask.run(ccdExposure=self.exposure, camera=self.camera).exposure self.assertEqual(self.wcs, exposure2.getWcs())
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |