1 from builtins
import range
2 from builtins
import object
26 import lsst.daf.base
as dafBase
27 import lsst.afw.coord
as afwCoord
28 import lsst.afw.geom
as afwGeom
29 import lsst.afw.image
as afwImage
33 """A factory for creating Wcs objects for the sky tiles.
36 def __init__(self, pixelScale, projection, rotation=0*afwGeom.radians):
39 @param[in] pixelScale: desired scale, as sky/pixel, an afwGeom.Angle
40 @param[in] projection: FITS-standard 3-letter name of projection, e.g.:
41 TAN (tangent), STG (stereographic), MOL (Mollweide's), AIT (Hammer-Aitoff)
42 see Representations of celestial coordinates in FITS (Calabretta and Greisen, 2002)
43 @param[in] rotation: Rotation relative to cardinal, as an lsst.afw.geom.Angle
45 if len(projection) != 3:
46 raise RuntimeError(
"projection=%r; must have length 3" % (projection,))
60 def makeWcs(self, crPixPos, crValCoord, **kargs):
63 @param[in] crPixPos: crPix for WCS, using the LSST standard; an afwGeom.Point2D or pair of floats
64 @param[in] crValCoord: crVal for WCS (afwCoord.Coord)
65 **kargs: FITS keyword arguments for WCS
67 ps = dafBase.PropertySet()
68 crPixFits = [ind + 1.0
for ind
in crPixPos]
69 crValDeg = crValCoord.getPosition(afwGeom.degrees)
72 ps.add(
"CTYPE%1d" % (ip1,), self.
_ctypes[i])
73 ps.add(
"CRPIX%1d" % (ip1,), crPixFits[i])
74 ps.add(
"CRVAL%1d" % (ip1,), crValDeg[i])
75 ps.add(
"RADECSYS",
"ICRS")
76 ps.add(
"EQUINOX", 2000)
77 for k, v
in list(self._cdMatrix.items()) + list(kargs.items()):
79 return afwImage.makeWcs(ps)