LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
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 246 of file fitAffineWcs.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 260 of file fitAffineWcs.py.

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

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 289 of file fitAffineWcs.py.

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

◆ frameIdxs

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameIdxs

Definition at line 269 of file fitAffineWcs.py.

◆ frameMax

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameMax

Definition at line 272 of file fitAffineWcs.py.

◆ frameMin

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.frameMin

Definition at line 271 of file fitAffineWcs.py.

◆ lastMapBeforeSky

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.lastMapBeforeSky

Definition at line 282 of file fitAffineWcs.py.

◆ mapFrom

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.mapFrom

Definition at line 276 of file fitAffineWcs.py.

◆ mapTo

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.mapTo

Definition at line 279 of file fitAffineWcs.py.

◆ origin

lsst.meas.astrom.fitAffineWcs.TransformedSkyWcsMaker.origin

Definition at line 287 of file fitAffineWcs.py.


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