lsst.skymap  14.0-4-g3609236+7
wcsFactory.py
Go to the documentation of this file.
1 from builtins import object
2 #
3 # LSST Data Management System
4 # Copyright 2008, 2009, 2010 LSST Corporation.
5 #
6 # This product includes software developed by the
7 # LSST Project (http://www.lsst.org/).
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the LSST License Statement and
20 # the GNU General Public License along with this program. If not,
21 # see <http://www.lsstcorp.org/LegalNotices/>.
22 #
23 import lsst.afw.geom as afwGeom
24 
25 
26 class WcsFactory(object):
27  """A factory for creating Wcs objects for the sky tiles.
28  """
29 
30  def __init__(self, pixelScale, projection, rotation=0*afwGeom.radians, flipX=False):
31  """Make a WcsFactory
32 
33  @param[in] pixelScale: desired scale, as sky/pixel, an afwGeom.Angle
34  @param[in] projection: FITS-standard 3-letter name of projection, e.g.:
35  TAN (tangent), STG (stereographic), MOL (Mollweide's), AIT (Hammer-Aitoff)
36  see Representations of celestial coordinates in FITS (Calabretta and Greisen, 2002)
37  @param[in] rotation: Rotation relative to cardinal, as an lsst.afw.geom.Angle
38  @param[in] flipX: Flip the X axis?
39  """
40  if len(projection) != 3:
41  raise RuntimeError("projection=%r; must have length 3" % (projection,))
42  self._projection = projection
43  self._cdMatrix = afwGeom.makeCdMatrix(scale=pixelScale, orientation=rotation, flipX=flipX)
44 
45  def makeWcs(self, crPixPos, crValCoord):
46  """Make a Wcs
47 
48  @param[in] crPixPos: crPix for WCS, using the LSST standard; an afwGeom.Point2D or pair of floats
49  @param[in] crValCoord: crVal for WCS (afwCoord.Coord)
50  """
51  return afwGeom.makeSkyWcs(crpix=crPixPos, crval=crValCoord.toIcrs(),
52  cdMatrix=self._cdMatrix, projection=self._projection)
def makeWcs(self, crPixPos, crValCoord)
Definition: wcsFactory.py:45
def __init__(self, pixelScale, projection, rotation=0 *afwGeom.radians, flipX=False)
Definition: wcsFactory.py:30