LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
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: