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