28 from .cachingSkyMap
import CachingSkyMap
29 from .tractInfo
import ExplicitTractInfo
31 __all__ = [
"RingsSkyMap"]
34 """Configuration for the RingsSkyMap"""
35 numRings = Field(dtype=int, doc=
"Number of rings", check=
lambda x: x > 0)
36 raStart = Field(dtype=float, default=0.0, doc=
"Starting center RA for each ring (degrees)",
37 check=
lambda x: x >= 0.0
and x < 360.0)
41 """Rings sky map pixelization.
43 We divide the sphere into N rings of Declination, plus the two polar
44 caps, which sets the size of the individual tracts. The rings are
45 divided in RA into an integral number of tracts of this size; this
46 division is made at the Declination closest to zero so as to ensure
49 ConfigClass = RingsSkyMapConfig
55 @param[in] config: an instance of self.ConfigClass; if None the default config is used
56 @param[in] version: software version of this class, to retain compatibility with old instances
62 for i
in range(config.numRings):
63 startDec = self.
_ringSize*(i + 0.5) - 0.5*math.pi
65 dec = min(math.fabs(startDec), math.fabs(stopDec))
66 self._ringNums.append(int(2*math.pi*math.cos(dec)/self.
_ringSize) + 1)
68 super(RingsSkyMap, self).
__init__(numTracts, config, version)
71 """Calculate ring indices given a numerical index of a tract
73 The ring indices are the ring number and the tract number within
76 The ring number is -1 for the south polar cap and increases to the
77 north. The north polar cap has ring number = numRings. The tract
78 number is zero for either of the polar caps.
82 if index == self._numTracts - 1:
83 return self.config.numRings, 0
86 while ring < self.config.numRings
and index > self.
_ringNums[ring]:
92 """Generate the TractInfo for this index"""
95 ra, dec = 0, -0.5*math.pi
96 elif ringNum == self.config.numRings:
97 ra, dec = 0, 0.5*math.pi
99 dec = self.
_ringSize*(ringNum + 1) - 0.5*math.pi
100 ra = math.fmod(self.config.raStart + 2*math.pi*tractNum/self.
_ringNums[ringNum], 2*math.pi)
102 center =
IcrsCoord(ra*afwGeom.radians, dec*afwGeom.radians)
103 wcs = self._wcsFactory.makeWcs(crPixPos=
afwGeom.Point2D(0,0), crValCoord=center)
104 return ExplicitTractInfo(index, self.config.patchInnerDimensions, self.config.patchBorder, center,
105 0.5*self.
_ringSize*afwGeom.radians, self.config.tractOverlap*afwGeom.degrees,
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
A class to handle Icrs coordinates (inherits from Coord)