LSST Applications g0265f82a02+c6dfa2ddaf,g1162b98a3f+ffe7eabc7e,g2079a07aa2+1b2e822518,g2bbee38e9b+c6dfa2ddaf,g337abbeb29+c6dfa2ddaf,g36da64cc00+ea84795170,g3ddfee87b4+955a963fd8,g50ff169b8f+2eb0e556e8,g52b1c1532d+90ebb246c7,g555ede804d+955a963fd8,g591dd9f2cf+bac198a2cb,g5ec818987f+420292cfeb,g858d7b2824+d6c9a0a3b8,g876c692160+aabc49a3c3,g8a8a8dda67+90ebb246c7,g8cdfe0ae6a+4fd9e222a8,g99cad8db69+e6cd765486,g9ddcbc5298+a1346535a5,ga1e77700b3+df8f93165b,ga8c6da7877+acd47f83f4,gae46bcf261+c6dfa2ddaf,gb0e22166c9+8634eb87fb,gb3f2274832+12c8382528,gba4ed39666+1ac82b564f,gbb8dafda3b+0574160a1f,gbeb006f7da+dea2fbb49f,gc28159a63d+c6dfa2ddaf,gc86a011abf+d6c9a0a3b8,gcf0d15dbbd+955a963fd8,gdaeeff99f8+1cafcb7cd4,gdc0c513512+d6c9a0a3b8,ge79ae78c31+c6dfa2ddaf,geb67518f79+ba1859f325,gee10cc3b42+90ebb246c7,gf1cff7945b+d6c9a0a3b8,w.2024.13
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker Class Reference

Public Member Functions

 __init__ (self, inputSkyWcs)
 
 makeWcs (self, linearShift, affMatrix)
 

Public Attributes

 frameDict
 
 frameIdxs
 
 frameMin
 
 frameMax
 
 mapFrom
 
 mapTo
 
 lastMapBeforeSky
 
 origin
 

Detailed Description

Convenience class for appending a shifting an input SkyWcs on sky and
appending an affine transform.

The class assumes that all frames are sequential and are mapped one to the
next.

Parameters
----------
input_sky_wcs : `lsst.afw.geom.SkyWcs`
    WCS to decompose and append affine matrix and shift in on sky
    location to.

Definition at line 209 of file fitAffineWcs.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.__init__ ( self,
inputSkyWcs )

Definition at line 223 of file fitAffineWcs.py.

223 def __init__(self, inputSkyWcs):
224 self.frameDict = inputSkyWcs.getFrameDict()
225
226 # Grab the order of the frames by index.
227 # TODO: DM-20825
228 # Change the frame the transform is appended to to be explicitly
229 # the FIELD_ANGLE->IWC transform. Requires related tickets to be
230 # completed.
231 domains = self.frameDict.getAllDomains()
232 self.frameIdxs = np.sort([self.frameDict.getIndex(domain)
233 for domain in domains])
234 self.frameMin = np.min(self.frameIdxs)
235 self.frameMax = np.max(self.frameIdxs)
236
237 # Find frame just before the final mapping to sky and store those
238 # indices and mappings for later.
239 self.mapFrom = self.frameMax - 2
240 if self.mapFrom < self.frameMin:
241 self.mapFrom = self.frameMin
242 self.mapTo = self.frameMax - 1
243 if self.mapTo <= self.mapFrom:
244 self.mapTo = self.frameMax
245 self.lastMapBeforeSky = self.frameDict.getMapping(
246 self.mapFrom, self.mapTo)
247
248 # Get the original WCS sky location.
249
250 self.origin = inputSkyWcs.getSkyOrigin()
251

Member Function Documentation

◆ makeWcs()

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.makeWcs ( self,
linearShift,
affMatrix )
Apply a shift and affine transform to the WCS internal to this
class.

A new SkyWcs with these transforms applied is returns.

Parameters
----------
linearShift : `numpy.ndarray`, (2,)
    A linear shift to apply at the same time as applying the affine
    matrix transform.
aff_matrix : 'numpy.ndarray', (3, 3)
    Affine matrix to apply to the mapping/transform to add to the
    WCS.

Returns
-------
outputWcs : `lsst.afw.geom.SkyWcs`
    Wcs with a final shift and affine transform applied.

Definition at line 252 of file fitAffineWcs.py.

252 def makeWcs(self, linearShift, affMatrix):
253 """Apply a shift and affine transform to the WCS internal to this
254 class.
255
256 A new SkyWcs with these transforms applied is returns.
257
258 Parameters
259 ----------
260 linearShift : `numpy.ndarray`, (2,)
261 A linear shift to apply at the same time as applying the affine
262 matrix transform.
263 aff_matrix : 'numpy.ndarray', (3, 3)
264 Affine matrix to apply to the mapping/transform to add to the
265 WCS.
266
267 Returns
268 -------
269 outputWcs : `lsst.afw.geom.SkyWcs`
270 Wcs with a final shift and affine transform applied.
271 """
272 # Create a WCS that only maps from IWC to Sky with the shifted
273 # Sky origin position. This is simply the final undistorted tangent
274 # plane to sky. The PIXELS to SKY map will be become our IWC to SKY
275 # map and gives us our final shift position.
276 iwcsToSkyWcs = makeSkyWcs(
277 Point2D(0., 0.),
278 self.origin,
279 np.array([[1., 0.], [0., 1.]]))
280 iwcToSkyMap = iwcsToSkyWcs.getFrameDict().getMapping("PIXELS", "SKY")
281
282 # Append a simple affine Matrix transform to the current to the
283 # second to last frame mapping. e.g. the one just before IWC to SKY.
284 newMapping = self.lastMapBeforeSky.then(astshim.MatrixMap(affMatrix))
285 newMapping = newMapping.then(astshim.ShiftMap(linearShift))
286
287 # Create a new frame dict starting from the input_sky_wcs's first
288 # frame. Append the correct mapping created above and our new on
289 # sky location.
290 outputFrameDict = astshim.FrameDict(
291 self.frameDict.getFrame(self.frameMin))
292 for frameIdx in self.frameIdxs:
293 if frameIdx == self.mapFrom:
294 outputFrameDict.addFrame(
295 self.mapFrom,
296 newMapping,
297 self.frameDict.getFrame(self.mapTo))
298 elif frameIdx >= self.mapTo:
299 continue
300 else:
301 outputFrameDict.addFrame(
302 frameIdx,
303 self.frameDict.getMapping(frameIdx, frameIdx + 1),
304 self.frameDict.getFrame(frameIdx + 1))
305 # Append the final sky frame to the frame dict.
306 outputFrameDict.addFrame(
307 self.frameMax - 1,
308 iwcToSkyMap,
309 iwcsToSkyWcs.getFrameDict().getFrame("SKY"))
310
311 return SkyWcs(outputFrameDict)

Member Data Documentation

◆ frameDict

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameDict

Definition at line 224 of file fitAffineWcs.py.

◆ frameIdxs

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameIdxs

Definition at line 232 of file fitAffineWcs.py.

◆ frameMax

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameMax

Definition at line 235 of file fitAffineWcs.py.

◆ frameMin

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameMin

Definition at line 234 of file fitAffineWcs.py.

◆ lastMapBeforeSky

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.lastMapBeforeSky

Definition at line 245 of file fitAffineWcs.py.

◆ mapFrom

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.mapFrom

Definition at line 239 of file fitAffineWcs.py.

◆ mapTo

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.mapTo

Definition at line 242 of file fitAffineWcs.py.

◆ origin

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.origin

Definition at line 250 of file fitAffineWcs.py.


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