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 | 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: