Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04a91732dc+7fec47d7bc,g07dc498a13+5ab4d22ec3,g0fba68d861+565de8e5d5,g1409bbee79+5ab4d22ec3,g1a7e361dbc+5ab4d22ec3,g1fd858c14a+11200c7927,g20f46db602+25d63fd678,g35bb328faa+fcb1d3bbc8,g4d2262a081+61302e889d,g4d39ba7253+d05e267ece,g4e0f332c67+5d362be553,g53246c7159+fcb1d3bbc8,g60b5630c4e+d05e267ece,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8048e755c2+a1301e4c20,g8852436030+163ceb82d8,g89139ef638+5ab4d22ec3,g89e1512fd8+fbb808ebce,g8d6b6b353c+d05e267ece,g9125e01d80+fcb1d3bbc8,g989de1cb63+5ab4d22ec3,g9f33ca652e+8abe617c77,ga9baa6287d+d05e267ece,gaaedd4e678+5ab4d22ec3,gabe3b4be73+1e0a283bba,gb1101e3267+fefe9ce5b1,gb58c049af0+f03b321e39,gb90eeb9370+824c420ec4,gc741bbaa4f+77ddc33078,gcf25f946ba+163ceb82d8,gd315a588df+0f88d5218e,gd6cbbdb0b4+c8606af20c,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+e6bd566e97,ge278dab8ac+932305ba37,ge82c20c137+76d20ab76d,w.2025.10
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst.afw.geom.wcsUtils Namespace Reference

Functions

 getSipMatrixFromMetadata (metadata, name)
 
 computePixelToDistortedPixel (pixelToFocalPlane, focalPlaneToFieldAngle)
 

Function Documentation

◆ computePixelToDistortedPixel()

lsst.afw.geom.wcsUtils.computePixelToDistortedPixel ( pixelToFocalPlane,
focalPlaneToFieldAngle )
Compute the transform ``pixelToDistortedPixel``, which applies optical
distortion specified by ``focalPlaneToFieldAngle``.

The resulting transform is designed to be used to convert a pure TAN WCS
to a WCS that includes a model for optical distortion. In detail,
the initial WCS will contain these frames and transforms::

    PIXELS frame -> pixelToIwc -> IWC frame ->  gridToIwc -> SkyFrame

To produce the WCS with distortion, replace ``pixelToIwc`` with::

    pixelToDistortedPixel -> pixelToIwc

Parameters
----------
pixelToFocalPlane : `lsst.afw.geom.TransformPoint2ToPoint2`
    Transform parent pixel coordinates to focal plane coordinates
focalPlaneToFieldAngle : `lsst.afw.geom.TransformPoint2ToPoint2`
    Transform focal plane coordinates to field angle coordinates

Returns
-------
pixelToDistortedPixel : `lsst.afw.geom.TransformPoint2ToPoint2`
    A transform that applies the effect of the optical distortion model.

Definition at line 65 of file wcsUtils.py.

65def computePixelToDistortedPixel(pixelToFocalPlane, focalPlaneToFieldAngle):
66 """Compute the transform ``pixelToDistortedPixel``, which applies optical
67 distortion specified by ``focalPlaneToFieldAngle``.
68
69 The resulting transform is designed to be used to convert a pure TAN WCS
70 to a WCS that includes a model for optical distortion. In detail,
71 the initial WCS will contain these frames and transforms::
72
73 PIXELS frame -> pixelToIwc -> IWC frame -> gridToIwc -> SkyFrame
74
75 To produce the WCS with distortion, replace ``pixelToIwc`` with::
76
77 pixelToDistortedPixel -> pixelToIwc
78
79 Parameters
80 ----------
81 pixelToFocalPlane : `lsst.afw.geom.TransformPoint2ToPoint2`
82 Transform parent pixel coordinates to focal plane coordinates
83 focalPlaneToFieldAngle : `lsst.afw.geom.TransformPoint2ToPoint2`
84 Transform focal plane coordinates to field angle coordinates
85
86 Returns
87 -------
88 pixelToDistortedPixel : `lsst.afw.geom.TransformPoint2ToPoint2`
89 A transform that applies the effect of the optical distortion model.
90 """
91 # return pixelToFocalPlane -> focalPlaneToFieldAngle -> tanFieldAngleToocalPlane -> focalPlaneToPixel
92 focalPlaneToTanFieldAngle = makeTransform(linearizeTransform(focalPlaneToFieldAngle,
93 lsst.geom.Point2D(0, 0)))
94 return pixelToFocalPlane.then(focalPlaneToFieldAngle) \
95 .then(focalPlaneToTanFieldAngle.inverted()) \
96 .then(pixelToFocalPlane.inverted())

◆ getSipMatrixFromMetadata()

lsst.afw.geom.wcsUtils.getSipMatrixFromMetadata ( metadata,
name )
Extract a SIP matrix from FITS TAN-SIP WCS metadata.

Omitted coefficients are set to 0 and all coefficients may be omitted.

Parameters
----------
metadata : `lsst.daf.base.PropertySet`
    FITS metadata.
name : `str`
    Name of TAN-SIP matrix (``"A"``, ``"B"``, ``"Ap"``, or ``"Bp"``).

Returns
-------
`numpy.array`
    The SIP matrix.

Raises
------
TypeError
    If the order keyword ``<name>_ORDER`` (e.g. ``AP_ORDER``) is not found,
    the value of the order keyword cannot be read as an integer,
    the value of the order keyword is negative,
    or if a matrix parameter (e.g. ``AP_5_0``) cannot be read as a float.

Definition at line 34 of file wcsUtils.py.

34def getSipMatrixFromMetadata(metadata, name):
35 """Extract a SIP matrix from FITS TAN-SIP WCS metadata.
36
37 Omitted coefficients are set to 0 and all coefficients may be omitted.
38
39 Parameters
40 ----------
41 metadata : `lsst.daf.base.PropertySet`
42 FITS metadata.
43 name : `str`
44 Name of TAN-SIP matrix (``"A"``, ``"B"``, ``"Ap"``, or ``"Bp"``).
45
46 Returns
47 -------
48 `numpy.array`
49 The SIP matrix.
50
51 Raises
52 ------
53 TypeError
54 If the order keyword ``<name>_ORDER`` (e.g. ``AP_ORDER``) is not found,
55 the value of the order keyword cannot be read as an integer,
56 the value of the order keyword is negative,
57 or if a matrix parameter (e.g. ``AP_5_0``) cannot be read as a float.
58 """
59 arr = _getSipMatrixFromMetadata(metadata, name)
60 if arr.shape == (): # order=0
61 arr.shape = (1, 1)
62 return arr
63
64