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