Get a WCS from an exposureInfo, with distortion terms if possible.
If the WCS in the exposure is a pure TAN WCS and distortion information is available in the exposure's Detector, then return a DistortedTanWcs that combines the distortion information with the pure TAN WCS. Otherwise return the WCS in the exposureInfo without modification.
This function is intended as a temporary workaround until ISR puts a WCS with distortion information into its exposures.
- Parameters
-
[in] | exposureInfo | exposure information (an lsst.afw.image.ExposureInfo), e.g. from exposure.getInfo() |
[in] | log | an lsst.pex.logging.Log or None; if specified then a warning is logged if:
- the exposureInfo's WCS has no distortion and cannot be cast to a TanWcs
- the expousureInfo's detector has no TAN_PIXELS transform (distortion information)
|
- Exceptions
-
RuntimeError | if exposureInfo has no WCS. |
Definition at line 46 of file utils.py.
48 """!Get a WCS from an exposureInfo, with distortion terms if possible
50 If the WCS in the exposure is a pure TAN WCS and distortion information is available
51 in the exposure's Detector, then return a DistortedTanWcs that combines the
52 distortion information with the pure TAN WCS.
53 Otherwise return the WCS in the exposureInfo without modification.
55 This function is intended as a temporary workaround until ISR puts a WCS with distortion information
58 @param[in] exposureInfo exposure information (an lsst.afw.image.ExposureInfo),
59 e.g. from exposure.getInfo()
60 @param[in] log an lsst.pex.logging.Log or None; if specified then a warning is logged if:
61 - the exposureInfo's WCS has no distortion and cannot be cast to a TanWcs
62 - the expousureInfo's detector has no TAN_PIXELS transform (distortion information)
63 @throw RuntimeError if exposureInfo has no WCS.
65 if not exposureInfo.hasWcs():
66 raise RuntimeError(
"exposure must have a WCS")
67 wcs = exposureInfo.getWcs()
68 if not wcs.hasDistortion()
and exposureInfo.hasDetector():
71 detector = exposureInfo.getDetector()
73 pixelsToTanPixels = detector.getTransform(TAN_PIXELS)
74 tanWcs = afwImage.TanWcs.cast(wcs)
75 except Exception
as e:
77 log.warn(
"Could not create a DistortedTanWcs: %s" % (e,))
def getDistortedWcs
Get a WCS from an exposureInfo, with distortion terms if possible.
Combination of a TAN WCS and a distortion model.