1 from builtins
import range
24 from .baseSkyMap
import BaseSkyMap
26 __all__ = [
"CachingSkyMap"]
30 """A SkyMap that generates its tracts on request and caches them 32 A subclass should define 33 * __init__ to calculate the required number of tracts (and pass it up) 34 * generateTract to generate a tract 36 Subclassers should also check that the arguments to the constructor are 37 consistent with the below __reduce__ method. 40 def __init__(self, numTracts, config=None, version=0):
41 super(CachingSkyMap, self).
__init__(config)
48 """To support pickling 50 Warning: This method assumes that the constructor should be defined: 51 __init__(self, config, version=defaultVersion) 52 The use of 'config' is effectively set by the registry mechanism. 53 If additional optional arguments are added, this method should be 54 overridden to correspond. 59 """Iterator over tracts""" 64 """Length is number of tracts""" 68 """Get the TractInfo for a particular index 70 The tract is returned from a cache, if available, otherwise generated 74 raise IndexError(
"Index out of range: %d vs %d" % (index, self.
_numTracts))
82 """Generate the TractInfo for the particular index""" 83 raise NotImplementedError(
"Subclasses must define this method.")
def __init__(self, numTracts, config=None, version=0)
def __getitem__(self, index)
def generateTract(self, index)