LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Public Member Functions | Public Attributes | List of all members
lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker Class Reference

Public Member Functions

def __init__ (self, inputSkyWcs)
 
def makeWcs (self, crvalOffset, 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 247 of file fitAffineWcs.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 261 of file fitAffineWcs.py.

261  def __init__(self, inputSkyWcs):
262  self.frameDict = inputSkyWcs.getFrameDict()
263 
264  # Grab the order of the frames by index.
265  # TODO: DM-20825
266  # Change the frame the transform is appended to to be explicitly
267  # the FIELD_ANGLE->IWC transform. Requires related tickets to be
268  # completed.
269  domains = self.frameDict.getAllDomains()
270  self.frameIdxs = np.sort([self.frameDict.getIndex(domain)
271  for domain in domains])
272  self.frameMin = np.min(self.frameIdxs)
273  self.frameMax = np.max(self.frameIdxs)
274 
275  # Find frame just before the final mapping to sky and store those
276  # indices and mappings for later.
277  self.mapFrom = self.frameMax - 2
278  if self.mapFrom < self.frameMin:
279  self.mapFrom = self.frameMin
280  self.mapTo = self.frameMax - 1
281  if self.mapTo <= self.mapFrom:
282  self.mapTo = self.frameMax
283  self.lastMapBeforeSky = self.frameDict.getMapping(
284  self.mapFrom, self.mapTo)
285 
286  # Get the original WCS sky location.
287 
288  self.origin = inputSkyWcs.getSkyOrigin()
289 

Member Function Documentation

◆ makeWcs()

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

A new SkyWcs with these transforms applied is returns.

Parameters
----------
crval_shift : `numpy.ndarray`, (2,)
    Shift in radians to apply to the Wcs origin/crvals.
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 290 of file fitAffineWcs.py.

290  def makeWcs(self, crvalOffset, affMatrix):
291  """Apply a shift and affine transform to the WCS internal to this
292  class.
293 
294  A new SkyWcs with these transforms applied is returns.
295 
296  Parameters
297  ----------
298  crval_shift : `numpy.ndarray`, (2,)
299  Shift in radians to apply to the Wcs origin/crvals.
300  aff_matrix : 'numpy.ndarray', (3, 3)
301  Affine matrix to apply to the mapping/transform to add to the
302  WCS.
303 
304  Returns
305  -------
306  outputWcs : `lsst.afw.geom.SkyWcs`
307  Wcs with a final shift and affine transform applied.
308  """
309  # Create a WCS that only maps from IWC to Sky with the shifted
310  # Sky origin position. This is simply the final undistorted tangent
311  # plane to sky. The PIXELS to SKY map will be become our IWC to SKY
312  # map and gives us our final shift position.
313  iwcsToSkyWcs = makeSkyWcs(
314  Point2D(0., 0.),
315  self.origin.offset(crvalOffset[0] * degrees,
316  crvalOffset[1] * arcseconds),
317  np.array([[1., 0.], [0., 1.]]))
318  iwcToSkyMap = iwcsToSkyWcs.getFrameDict().getMapping("PIXELS", "SKY")
319 
320  # Append a simple affine Matrix transform to the current to the
321  # second to last frame mapping. e.g. the one just before IWC to SKY.
322  newMapping = self.lastMapBeforeSky.then(astshim.MatrixMap(affMatrix))
323 
324  # Create a new frame dict starting from the input_sky_wcs's first
325  # frame. Append the correct mapping created above and our new on
326  # sky location.
327  outputFrameDict = astshim.FrameDict(
328  self.frameDict.getFrame(self.frameMin))
329  for frameIdx in self.frameIdxs:
330  if frameIdx == self.mapFrom:
331  outputFrameDict.addFrame(
332  self.mapFrom,
333  newMapping,
334  self.frameDict.getFrame(self.mapTo))
335  elif frameIdx >= self.mapTo:
336  continue
337  else:
338  outputFrameDict.addFrame(
339  frameIdx,
340  self.frameDict.getMapping(frameIdx, frameIdx + 1),
341  self.frameDict.getFrame(frameIdx + 1))
342  # Append the final sky frame to the frame dict.
343  outputFrameDict.addFrame(
344  self.frameMax - 1,
345  iwcToSkyMap,
346  iwcsToSkyWcs.getFrameDict().getFrame("SKY"))
347 
348  return SkyWcs(outputFrameDict)
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
Definition: SkyWcs.cc:526
Point< double, 2 > Point2D
Definition: Point.h:324
std::shared_ptr< afw::geom::SkyWcs > makeWcs(SipForwardTransform const &sipForward, SipReverseTransform const &sipReverse, geom::SpherePoint const &skyOrigin)
Create a new TAN SIP Wcs from a pair of SIP transforms and the sky origin.

Member Data Documentation

◆ frameDict

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameDict

Definition at line 262 of file fitAffineWcs.py.

◆ frameIdxs

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameIdxs

Definition at line 270 of file fitAffineWcs.py.

◆ frameMax

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameMax

Definition at line 273 of file fitAffineWcs.py.

◆ frameMin

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameMin

Definition at line 272 of file fitAffineWcs.py.

◆ lastMapBeforeSky

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.lastMapBeforeSky

Definition at line 283 of file fitAffineWcs.py.

◆ mapFrom

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.mapFrom

Definition at line 277 of file fitAffineWcs.py.

◆ mapTo

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.mapTo

Definition at line 280 of file fitAffineWcs.py.

◆ origin

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.origin

Definition at line 288 of file fitAffineWcs.py.


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