23 __all__ = [
"getSipMatrixFromMetadata",
"makeDistortedTanWcs",
"computePixelToDistortedPixel"]
26 from ..transformFactory
import linearizeTransform, makeTransform
27 from ..skyWcs
import makeModifiedWcs
28 from .wcsUtils
import _getSipMatrixFromMetadata
32 """Extract a SIP matrix from FITS TAN-SIP WCS metadata. 34 Omitted coefficients are set to 0 and all coefficients may be omitted. 38 metadata : `lsst.daf.base.PropertySet` 41 Name of TAN-SIP matrix (``"A"``, ``"B"``, ``"Ap"``, or ``"Bp"``). 51 If the order keyword ``<name>_ORDER`` (e.g. ``AP_ORDER``) is not found, 52 the value of the order keyword cannot be read as an integer, 53 the value of the order keyword is negative, 54 or if a matrix parameter (e.g. ``AP_5_0``) cannot be read as a float. 56 arr = _getSipMatrixFromMetadata(metadata, name)
63 """Compute a WCS that includes a model of optical distortion. 65 This is useful in the common case that the initial WCS entirely ignores 66 the effect of optical distortion. 70 tanWcs : `lsst.afw.geom.SkyWcs` 71 A pure TAN WCS, such as is usually provided in raw data. 72 This should have no existing compensation for optical distortion 73 (though it may include an ``ACTUAL_PIXELS`` frame to model pixel-level 75 pixelToFocalPlane : `lsst.afw.geom.TransformPoint2ToPoint2` 76 Transform parent pixel coordinates to focal plane coordinates. 77 This models the location of the CCD on the focal plane 78 and is almost always an affine transformation. 79 This can be obtained from the detector of an exposure. 80 focalPlaneToFieldAngle : `lsst.afw.geom.TransformPoint2ToPoint2` 81 Transform focal plane coordinates to field angle coordinates. 82 This is a model for optical distortion, and is often a radial 83 polynomial. This can be obtained from the camera geometry. 89 A copy of `tanWcs` that includes the effect of optical distortion. 94 If the current frame of `wcs` is not a SkyFrame; 96 If 2-dimensional Frames with Domain "PIXELS" and "IWC" 150 return makeModifiedWcs(pixelTransform=pixelToDistortedPixel, wcs=tanWcs, modifyActualPixels=
False)
154 """Compute the transform ``pixelToDistortedPixel``, which applies optical 155 distortion specified by ``focalPlaneToFieldAngle``. 157 The resulting transform is designed to be used to convert a pure TAN WCS 158 to a WCS that includes a model for optical distortion. In detail, 159 the initial WCS will contain these frames and transforms:: 161 PIXELS frame -> pixelToIwc -> IWC frame -> gridToIwc -> SkyFrame 163 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. 182 return pixelToFocalPlane.then(focalPlaneToFieldAngle) \
183 .
then(focalPlaneToTanFieldAngle.inverted()) \
184 .
then(pixelToFocalPlane.inverted())
lsst::geom::AffineTransform linearizeTransform(TransformPoint2ToPoint2 const &original, lsst::geom::Point2D const &inPoint)
Approximate a Transform by its local linearization.
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 makeDistortedTanWcs(tanWcs, pixelToFocalPlane, focalPlaneToFieldAngle)
def getSipMatrixFromMetadata(metadata, name)
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.
def computePixelToDistortedPixel(pixelToFocalPlane, focalPlaneToFieldAngle)