23 __all__ = (
'InitialSkyWcsError',
'createInitialSkyWcs',
'bboxFromIraf')
26 import lsst.geom
as geom
28 from lsst.afw.cameraGeom
import PIXELS, FIELD_ANGLE
29 from lsst.afw.image
import RotType
30 from lsst.afw.geom.skyWcs
import makeSkyWcs
35 """For handling failures when creating a SkyWcs from a camera geometry and 38 Typically used as a chained exception from a lower level exception. 44 """Create a SkyWcs from the telescope boresight and detector geometry. 46 A typical usecase for this is to create the initial WCS for a newly-read 52 visitInfo : `lsst.afw.image.VisitInfo` 53 Where to get the telescope boresight and rotator angle from. 54 detector : `lsst.afw.cameraGeom.Detector` 55 Where to get the camera geomtry from. 56 flipX : `bool`, optional 57 If False, +X is along W, if True +X is along E. 61 skyWcs : `lsst.afw.geom.SkyWcs` 67 Raised if there is an error generating the SkyWcs, chained from the 68 lower-level exception if available. 70 if visitInfo.getRotType() != RotType.SKY:
71 msg = (f
"Cannot create SkyWcs from camera geometry: rotator angle defined using " 72 f
"RotType={visitInfo.getRotType()} instead of SKY.")
74 orientation = visitInfo.getBoresightRotAngle()
75 boresight = visitInfo.getBoresightRaDec()
77 pixelsToFieldAngle = detector.getTransform(detector.makeCameraSys(PIXELS),
78 detector.makeCameraSys(FIELD_ANGLE))
81 return makeSkyWcs(pixelsToFieldAngle, orientation, flipX, boresight)
85 """Return a Box2I corresponding to an IRAF-style BBOX 87 [x0:x1,y0:y1] where x0 and x1 are the one-indexed start and end columns, and correspondingly 88 y0 and y1 are the start and end rows. 91 mat = re.search(
r"^\[([-\d]+):([-\d]+),([-\d]+):([-\d]+)\]$", irafBBoxStr)
93 raise RuntimeError(
"Unable to parse IRAF-style bbox \"%s\"" % irafBBoxStr)
94 x0, x1, y0, y1 = [int(_)
for _
in mat.groups()]
96 return geom.BoxI(geom.PointI(x0 - 1, y0 - 1), geom.PointI(x1 - 1, y1 - 1))
def createInitialSkyWcs(visitInfo, detector, flipX=False)
def bboxFromIraf(irafBBoxStr)