22 from __future__
import absolute_import, division, print_function
24 __all__ = [
"getSipMatrixFromMetadata",
"makeDistortedTanWcs",
"computePixelToDistortedPixel"]
26 from ..coordinates
import Point2D
27 from ..transformFactory
import linearizeTransform, makeTransform
28 from ..skyWcs
import makeModifiedWcs
29 from .wcsUtils
import _getSipMatrixFromMetadata
33 """Extract a SIP matrix from FITS TAN-SIP WCS metadata 35 Omitted coefficients are set to 0 and all coefficients may be omitted. 39 metadata : lsst.daf.base.PropertySet 42 Name of TAN-SIP matrix; one of "A", "B", "Ap", "Bp" 52 If the order keyword <name>_ORDER (e.g. AP_ORDER) is not found, 53 the value of the order keyword cannot be read as an integer, 54 the value of the order keyword is negative, 55 or if a matrix parameter (e.g. AP_5_0) cannot be read as a float. 57 arr = _getSipMatrixFromMetadata(metadata, name)
65 Compute a WCS that includes a model of optical distortion. 67 This is useful in the common case that the initial WCS entirely ignores 68 the effect of optical distortion. 72 tanWcs : lsst.afw.geom.SkyWcs 73 A pure TAN WCS, such as is usually provided in raw data. 74 This should have no existing compensation for optical distortion 75 (though it may include an ACTUAL_PIXELS frame to model pixel-level 77 pixelToFocalPlane : lsst.afw.geom.TransformPoint2ToPoint2 78 Transform parent pixel coordinates to focal plane coordinates. 79 This models the location of the CCD on the focal plane 80 and is almost always an affine transformation. 81 This can be obtained from the detector of an exposure. 82 focalPlaneToFieldAngle : lsst.afw.geom.TransformPoint2ToPoint2 83 Transform focal plane coordinates to field angle coordinates. 84 This is a model for optical distortion, and is often a radial 85 polynomial. This can be obtained from the camera geometry. 91 A copy of `tanWcs` that includes the effect of optical distortion. 96 If the current frame of `wcs` is not a SkyFrame; 98 If 2-dimensional Frames with Domain "PIXELS" and "IWC" 152 return makeModifiedWcs(pixelTransform=pixelToDistortedPixel, wcs=tanWcs, modifyActualPixels=
False)
157 Compute the transform pixelToDistortedPixel, which applies optical 158 distortion specified by focalPlaneToFieldAngle 160 The resulting transform is designed to be used to convert a pure TAN WCS 161 to a WCS that includes a model for optical distortion. In detail, 162 the initial WCS will contain these frames and transforms: 163 PIXELS frame -> pixelToIwc -> IWC frame -> gridToIwc -> SkyFrame 164 To produce the WCS with distortion, replace pixelToIwc with: 165 pixelToDistortedPixel -> pixelToIwc 169 pixelToFocalPlane : lsst.afw.geom.TransformPoint2ToPoint2 170 Transform parent pixel coordinates to focal plane coordinates 171 focalPlaneToFieldAngle : lsst.afw.geom.TransformPoint2ToPoint2 172 Transform focal plane coordinates to field angle coordinates 176 pixelToDistortedPixel : lsst.afw.geom.TransformPoint2ToPoint2 177 A transform that applies the effect of the optical distortion model. 181 return pixelToFocalPlane.then(focalPlaneToFieldAngle) \
182 .
then(focalPlaneToTanFieldAngle.getInverse()) \
183 .
then(pixelToFocalPlane.getInverse())
AffineTransform linearizeTransform(TransformPoint2ToPoint2 const &original, Point2D const &inPoint)
Approximate a Transform by its local linearization.
Point< double, 2 > Point2D
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(AffineTransform const &affine)
Wrap an AffineTransform as a Transform.
def makeDistortedTanWcs(tanWcs, pixelToFocalPlane, focalPlaneToFieldAngle)
def getSipMatrixFromMetadata(metadata, name)
std::shared_ptr< SkyWcs > makeModifiedWcs(TransformPoint2ToPoint2 const &pixelTransform, SkyWcs const &wcs, bool modifyActualPixels)
Create a new SkyWcs whose pixels are transformed by pixelTransform, as described below.
def computePixelToDistortedPixel(pixelToFocalPlane, focalPlaneToFieldAngle)