24 - Consider tweaking pixel scale so the average scale is as specified, rather than the scale at the center 26 from builtins
import object
31 __all__ = [
"BaseSkyMap"]
35 patchInnerDimensions = pexConfig.ListField(
36 doc=
"dimensions of inner region of patches (x,y pixels)",
41 patchBorder = pexConfig.Field(
42 doc=
"border between patch inner and outer bbox (pixels)",
46 tractOverlap = pexConfig.Field(
47 doc=
"minimum overlap between adjacent sky tracts, on the sky (deg)",
51 pixelScale = pexConfig.Field(
52 doc=
"nominal pixel scale (arcsec/pixel)",
56 projection = pexConfig.Field(
57 doc=
"""one of the FITS WCS projection codes, such as: 58 - STG: stereographic projection 59 - MOL: Molleweide's projection 60 - TAN: tangent-plane projection 65 rotation = pexConfig.Field(
66 doc=
"Rotation for WCS (deg)",
73 """A collection of overlapping Tracts that map part or all of the sky. 75 See TractInfo for more information. 77 BaseSkyMap is an abstract base class. Subclasses must do the following: 78 @li define __init__ and have it construct the TractInfo objects and put them in _tractInfoList 79 @li define __getstate__ and __setstate__ to allow pickling (the butler saves sky maps using pickle); 80 see DodecaSkyMap for an example of how to do this. (Most of that code could be moved 81 into this base class, but that would make it harder to handle older versions of pickle data.) 83 ConfigClass = BaseSkyMapConfig
86 """Construct a BaseSkyMap 88 @param[in] config: an instance of self.ConfigClass; if None the default config is used 96 pixelScale=afwGeom.Angle(self.
config.pixelScale, afwGeom.arcseconds),
97 projection=self.
config.projection,
98 rotation=afwGeom.Angle(self.
config.rotation, afwGeom.degrees),
102 """Find the tract whose center is nearest the specified coord. 104 @param[in] coord: sky coordinate (afwCoord.Coord) 105 @return TractInfo of tract whose center is nearest the specified coord 108 - if tracts do not cover the whole sky then the returned tract may not include the coord 111 - This routine will be more efficient if coord is ICRS. 112 - If coord is equidistant between multiple sky tract centers then one is arbitrarily chosen. 113 - The default implementation is not very efficient; subclasses may wish to override. 115 icrsCoord = coord.toIcrs()
116 distTractInfoList = []
117 for tractInfo
in self:
118 angSep = icrsCoord.angularSeparation(tractInfo.getCtrCoord()).asDegrees()
119 distTractInfoList.append((angSep, tractInfo))
120 distTractInfoList.sort()
121 return distTractInfoList[0][1]
124 """Find tracts and patches that overlap a region 126 @param[in] coordList: list of sky coordinates (afwCoord.Coord) 127 @return list of (TractInfo, list of PatchInfo) for tracts and patches that contain, 128 or may contain, the specified region. The list will be empty if there is no overlap. 130 @warning this uses a naive algorithm that may find some tracts and patches that do not overlap 131 the region (especially if the region is not a rectangle aligned along patch x,y). 134 for tractInfo
in self:
135 patchList = tractInfo.findPatchList(coordList)
137 retList.append((tractInfo, patchList))
141 """Find closest tract and patches that overlap coordinates 143 @param[in] coordList: list of sky coordinates (afwCoord.Coord) 144 @return list of (TractInfo, list of PatchInfo) for tracts and patches that contain, 145 or may contain, the specified region. The list will be empty if there is no overlap. 148 for coord
in coordList:
150 patchList = tractInfo.findPatchList(coordList)
151 if patchList
and not (tractInfo, patchList)
in retList:
152 retList.append((tractInfo, patchList))
def findTractPatchList(self, coordList)
def findClosestTractPatchList(self, coordList)
def __getitem__(self, ind)
def findTract(self, coord)
def __init__(self, config=None)