LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper Class Reference
Inheritance diagram for lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper:

Public Member Functions

 __init__ (self, pix_to_field, origin=None, world_origin=None)
 
 origin (self)
 
 world_origin (self)
 

Public Attributes

 u0
 
 x0
 

Protected Member Functions

 _xyTouv (self, x, y, color=None)
 
 _uvToxy (self, u, v, color)
 
 _posToWorld (self, image_pos, color=None)
 
 _local (self, image_pos, color=None)
 
 _newOrigin (self, origin, world_origin)
 

Protected Attributes

 _pix_to_field
 
 _origin
 
 _world_origin
 
 _mapping
 
 _color
 
 _rad_to_arcsec
 

Static Protected Attributes

float _rad_to_arcsec = 206264.80624709636
 

Detailed Description

Wrap a `lsst.afw.geom.TransformPoint2ToPoint2[2->2]` in a GalSim WCS.

Parameters
----------
pix_to_field : `lsst.afw.geom.TransformPoint2ToPoint2[2->2]`
    Transform to wrap.  Most likely PIXELS -> FIELD_ANGLE, but other 2D ->
    2D transforms should be possible.
origin : `galsim.PositionD`, optional
    Origin in image coordinates.
world_origin : `galsim.PositionD`, optional
    Origin in world coordinates.

Notes
-----

GalSim EuclideanWCS assumes
    u = ufunc(x-x0, y-y0) + u0
    v = vfunc(x-x0, y-y0) + v0
where u,v are world (likely field angles), and (x, y) are pixels.
GalSim also assumes that origin = x0, y0 and world_origin = u0, v0.
I might have naively thought that uv(origin) == world_origin, but
that appears to not be required. So we're just going to leave both
free.

Definition at line 75 of file wcs_wrapper.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper.__init__ ( self,
pix_to_field,
origin = None,
world_origin = None )

Definition at line 102 of file wcs_wrapper.py.

102 def __init__(self, pix_to_field, origin=None, world_origin=None):
103 if origin is None:
104 # Use galsim._PositionD as it's faster than galsim.PositionD
105 origin = galsim._PositionD(0.0, 0.0)
106 if world_origin is None:
107 world_origin = galsim._PositionD(0.0, 0.0)
108 self._pix_to_field = pix_to_field
109 self._origin = origin
110 self._world_origin = world_origin
111 self._mapping = self._pix_to_field.getMapping()
112 self._color = None
113

Member Function Documentation

◆ _local()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._local ( self,
image_pos,
color = None )
protected
Compute local Jacobian WCS.

Parameters
----------
image_pos : galsim.PositionD
    Image position at which to compute local WCS.
color : ndarray
    Color to use in transformation.  Unused currently.

Returns
-------
local : galsim.JacobianWCS
    Local linear approximation to WCS.

Definition at line 186 of file wcs_wrapper.py.

186 def _local(self, image_pos, color=None):
187 """Compute local Jacobian WCS.
188
189 Parameters
190 ----------
191 image_pos : galsim.PositionD
192 Image position at which to compute local WCS.
193 color : ndarray
194 Color to use in transformation. Unused currently.
195
196 Returns
197 -------
198 local : galsim.JacobianWCS
199 Local linear approximation to WCS.
200 """
201 x0 = image_pos.x - self.x0
202 y0 = image_pos.y - self.y0
203
204 duvdxy = self._pix_to_field.getJacobian(Point2D(x0, y0))
205 return galsim.JacobianWCS(
206 *(duvdxy.ravel()*self._rad_to_arcsec)
207 )
208

◆ _newOrigin()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._newOrigin ( self,
origin,
world_origin )
protected
Return a new UVWcsWrapper with new origins.

Parameters
----------
origin : `galsim.PositionD`, optional
    Origin in image coordinates.
world_origin : `galsim.PositionD`, optional
    Origin in world coordinates.

Returns
-------
ret : `UVWcsWrapper`
    Transformed WCS.

Definition at line 209 of file wcs_wrapper.py.

209 def _newOrigin(self, origin, world_origin):
210 """Return a new UVWcsWrapper with new origins.
211
212 Parameters
213 ----------
214 origin : `galsim.PositionD`, optional
215 Origin in image coordinates.
216 world_origin : `galsim.PositionD`, optional
217 Origin in world coordinates.
218
219 Returns
220 -------
221 ret : `UVWcsWrapper`
222 Transformed WCS.
223 """
224 return UVWcsWrapper(self._pix_to_field, origin, world_origin)

◆ _posToWorld()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._posToWorld ( self,
image_pos,
color = None )
protected
Convert image coordinate to world coordinate.

Parameters
----------
image_pos : galsim.PositionD
    Image coordinate.
color : ndarray
    Color to use in transformation.  Unused currently.

Returns
-------
world_pos : galsim.PositionD
    World coordinate.

Definition at line 168 of file wcs_wrapper.py.

168 def _posToWorld(self, image_pos, color=None):
169 """Convert image coordinate to world coordinate.
170
171 Parameters
172 ----------
173 image_pos : galsim.PositionD
174 Image coordinate.
175 color : ndarray
176 Color to use in transformation. Unused currently.
177
178 Returns
179 -------
180 world_pos : galsim.PositionD
181 World coordinate.
182 """
183 # Use galsim._PositionD as it's faster than galsim.PositionD
184 return galsim._PositionD(*self._xyTouv(image_pos.x, image_pos.y, color))
185

◆ _uvToxy()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._uvToxy ( self,
u,
v,
color )
protected
Convert world coordinates to image coordinates.

Parameters
----------
u, v : ndarray
    World coordinates.
color : ndarray
    Color to use in transformation.  Unused currently.

Returns
-------
x, y : ndarray
    Image coordinates.

Definition at line 148 of file wcs_wrapper.py.

148 def _uvToxy(self, u, v, color):
149 """Convert world coordinates to image coordinates.
150
151 Parameters
152 ----------
153 u, v : ndarray
154 World coordinates.
155 color : ndarray
156 Color to use in transformation. Unused currently.
157
158 Returns
159 -------
160 x, y : ndarray
161 Image coordinates.
162 """
163 u = (u - self.u0)/self._rad_to_arcsec
164 v = (v - self.v0)/self._rad_to_arcsec
165 x, y = self._mapping.applyInverse(np.vstack((u, v)))
166 return x + self.x0, y + self.y0
167

◆ _xyTouv()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._xyTouv ( self,
x,
y,
color = None )
protected
Convert image coordinates to world coordinates.

Parameters
----------
x, y : ndarray
    Image coordinates.
color : ndarray
    Color to use in transformation.  Unused currently.

Returns
-------
u, v : ndarray
    World coordinates.

Definition at line 126 of file wcs_wrapper.py.

126 def _xyTouv(self, x, y, color=None):
127 """Convert image coordinates to world coordinates.
128
129 Parameters
130 ----------
131 x, y : ndarray
132 Image coordinates.
133 color : ndarray
134 Color to use in transformation. Unused currently.
135
136 Returns
137 -------
138 u, v : ndarray
139 World coordinates.
140 """
141 x = x - self.x0
142 y = y - self.y0
143 u, v = self._mapping.applyForward(np.vstack((x, y)))
144 u *= self._rad_to_arcsec
145 v *= self._rad_to_arcsec
146 return u + self.u0, v + self.v0
147

◆ origin()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper.origin ( self)
The image coordinate position to use as the origin.

Definition at line 115 of file wcs_wrapper.py.

115 def origin(self):
116 """The image coordinate position to use as the origin.
117 """
118 return self._origin
119

◆ world_origin()

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper.world_origin ( self)
The world coordinate position to use as the origin.

Definition at line 121 of file wcs_wrapper.py.

121 def world_origin(self):
122 """The world coordinate position to use as the origin.
123 """
124 return self._world_origin
125

Member Data Documentation

◆ _color

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._color
protected

Definition at line 112 of file wcs_wrapper.py.

◆ _mapping

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._mapping
protected

Definition at line 111 of file wcs_wrapper.py.

◆ _origin

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._origin
protected

Definition at line 109 of file wcs_wrapper.py.

◆ _pix_to_field

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._pix_to_field
protected

Definition at line 108 of file wcs_wrapper.py.

◆ _rad_to_arcsec [1/2]

float lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._rad_to_arcsec = 206264.80624709636
staticprotected

Definition at line 100 of file wcs_wrapper.py.

◆ _rad_to_arcsec [2/2]

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._rad_to_arcsec
protected

Definition at line 206 of file wcs_wrapper.py.

◆ _world_origin

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper._world_origin
protected

Definition at line 110 of file wcs_wrapper.py.

◆ u0

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper.u0

Definition at line 146 of file wcs_wrapper.py.

◆ x0

lsst.meas.extensions.piff.wcs_wrapper.UVWcsWrapper.x0

Definition at line 166 of file wcs_wrapper.py.


The documentation for this class was generated from the following file: