23 __all__ = [
"getSipMatrixFromMetadata",
"makeDistortedTanWcs",
"computePixelToDistortedPixel"]
25 from deprecated.sphinx
import deprecated
28 from ..transformFactory
import linearizeTransform, makeTransform
29 from ..skyWcs
import makeModifiedWcs
30 from .wcsUtils
import _getSipMatrixFromMetadata
34 """Extract a SIP matrix from FITS TAN-SIP WCS metadata.
36 Omitted coefficients are set to 0 and all coefficients may be omitted.
40 metadata : `lsst.daf.base.PropertySet`
43 Name of TAN-SIP matrix (``"A"``, ``"B"``, ``"Ap"``, or ``"Bp"``).
53 If the order keyword ``<name>_ORDER`` (e.g. ``AP_ORDER``) is not found,
54 the value of the order keyword cannot be read as an integer,
55 the value of the order keyword is negative,
56 or if a matrix parameter (e.g. ``AP_5_0``) cannot be read as a float.
58 arr = _getSipMatrixFromMetadata(metadata, name)
64 @deprecated(reason=
"Camera geometry-based SkyWcs are now set when reading raws. To be removed after v20.",
65 category=FutureWarning)
67 """Compute a WCS that includes a model of optical distortion.
69 This is useful in the common case that the initial WCS entirely ignores
70 the effect of optical distortion.
74 tanWcs : `lsst.afw.geom.SkyWcs`
75 A pure TAN WCS, such as is usually provided in raw data.
76 This should have no existing compensation for optical distortion
77 (though it may include an ``ACTUAL_PIXELS`` frame to model pixel-level
79 pixelToFocalPlane : `lsst.afw.geom.TransformPoint2ToPoint2`
80 Transform parent pixel coordinates to focal plane coordinates.
81 This models the location of the CCD on the focal plane
82 and is almost always an affine transformation.
83 This can be obtained from the detector of an exposure.
84 focalPlaneToFieldAngle : `lsst.afw.geom.TransformPoint2ToPoint2`
85 Transform focal plane coordinates to field angle coordinates.
86 This is a model for optical distortion, and is often a radial
87 polynomial. This can be obtained from the camera geometry.
93 A copy of `tanWcs` that includes the effect of optical distortion.
98 If the current frame of `wcs` is not a SkyFrame;
100 If 2-dimensional Frames with Domain "PIXELS" and "IWC"
154 return makeModifiedWcs(pixelTransform=pixelToDistortedPixel, wcs=tanWcs, modifyActualPixels=
False)
158 """Compute the transform ``pixelToDistortedPixel``, which applies optical
159 distortion specified by ``focalPlaneToFieldAngle``.
161 The resulting transform is designed to be used to convert a pure TAN WCS
162 to a WCS that includes a model for optical distortion. In detail,
163 the initial WCS will contain these frames and transforms::
165 PIXELS frame -> pixelToIwc -> IWC frame -> gridToIwc -> SkyFrame
167 To produce the WCS with distortion, replace ``pixelToIwc`` with::
169 pixelToDistortedPixel -> pixelToIwc
173 pixelToFocalPlane : `lsst.afw.geom.TransformPoint2ToPoint2`
174 Transform parent pixel coordinates to focal plane coordinates
175 focalPlaneToFieldAngle : `lsst.afw.geom.TransformPoint2ToPoint2`
176 Transform focal plane coordinates to field angle coordinates
180 pixelToDistortedPixel : `lsst.afw.geom.TransformPoint2ToPoint2`
181 A transform that applies the effect of the optical distortion model.
186 return pixelToFocalPlane.then(focalPlaneToFieldAngle) \
187 .
then(focalPlaneToTanFieldAngle.inverted()) \
188 .
then(pixelToFocalPlane.inverted())