23__all__ = [
"PatchInfo",
"makeSkyPolygonFromBBox"]
29def makeSkyPolygonFromBBox(bbox, wcs):
30 """Make an on-sky polygon from a bbox and a SkyWcs
35 Bounding box of region,
in pixel coordinates
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)
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.
87 The inner bounding Box.
92 """Get outer bounding box.
97 The outer bounding Box.
102 """Get the inner on-sky region.
107 The inner sky region.
109 return makeSkyPolygonFromBBox(bbox=self.
getInnerBBox(), wcs=tractWcs)
112 """Get the outer on-sky region.
117 The outer sky region.
119 return makeSkyPolygonFromBBox(bbox=self.
getOuterBBox(), wcs=tractWcs)
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)" % \
def getInnerSkyPolygon(self, tractWcs)
def getOuterSkyPolygon(self, tractWcs)
def __init__(self, index, innerBBox, outerBBox)