23 __all__ = [
"PatchInfo",
"makeSkyPolygonFromBBox"]
30 """Make an on-sky polygon from a bbox and a SkyWcs
34 bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
35 Bounding box of region, in pixel coordinates
36 wcs : `lsst.afw.geom.SkyWcs`
41 polygon : `lsst.sphgeom.ConvexPolygon`
44 pixelPoints =
Box2D(bbox).getCorners()
45 skyPoints = wcs.pixelToSky(pixelPoints)
46 return ConvexPolygon.convexHull([sp.getVector()
for sp
in skyPoints])
50 """Information about a patch within a tract of a sky map.
52 See `TractInfo` for more information.
56 index : `tuple` of `int`
57 x,y index of patch (a pair of ints)
58 innerBBox : `lsst.geom.Box2I`
60 outerBBox : `lsst.geom.Box2I`
64 def __init__(self, index, innerBBox, outerBBox):
68 if not outerBBox.contains(innerBBox):
69 raise RuntimeError(
"outerBBox=%s does not contain innerBBox=%s" % (outerBBox, innerBBox))
72 """Return patch index: a tuple of (x, y)
76 result : `tuple` of `int`
82 """Get inner bounding box.
86 bbox : `lsst.geom.Box2I`
87 The inner bounding Box.
92 """Get outer bounding box.
96 bbox : `lsst.geom.Box2I`
97 The outer bounding Box.
102 """Get the inner on-sky region.
106 result : `lsst.sphgeom.ConvexPolygon`
107 The inner sky region.
112 """Get the outer on-sky region.
116 result : `lsst.sphgeom.ConvexPolygon`
117 The outer sky region.
122 return (self.
getIndex() == rhs.getIndex()) \
127 return not self.
__eq__(rhs)
130 return "PatchInfo(index=%s)" % (self.
getIndex(),)
133 return "PatchInfo(index=%s, innerBBox=%s, outerBBox=%s)" % \