23 __all__ = [
"CachingSkyMap"]
25 from .baseSkyMap
import BaseSkyMap
29 """A SkyMap that generates its tracts on request and caches them.
34 Number of tracts to create.
35 config : `lsst.skymap.BaseSkyMapConfig` (optional)
36 The configuration for this SkyMap; if None use the default config.
37 version : `int` or `tuple` of `int` (optional)
38 Software version of this class, to retain compatibility with old
43 A subclass should define
44 * __init__ to calculate the required number of tracts (and pass it up)
45 * generateTract to generate a tract
47 Subclassers should also check that the arguments to the constructor are
48 consistent with the below __reduce__ method.
51 def __init__(self, numTracts, config=None, version=0):
52 super(CachingSkyMap, self).
__init__(config)
59 """To support pickling.
63 **Warning:** This method assumes that the constructor is be defined:
64 __init__(self, config, version=defaultVersion)
65 The use of 'config' is effectively set by the registry mechanism.
66 If additional optional arguments are added, this method should be
67 overridden to correspond.
69 return (self.__class__, (self.
configconfig, self.
_version_version))
72 """Iterator over tracts."""
77 """Length is number of tracts."""
81 """Get the TractInfo for a particular index.
83 The tract is returned from a cache, if available, otherwise generated
86 if index < 0
or index > self.
_numTracts_numTracts:
87 raise IndexError(
"Index out of range: %d vs %d" % (index, self.
_numTracts_numTracts))
95 """Generate TractInfo for the specified tract index."""
96 raise NotImplementedError(
"Subclasses must define this method.")
def generateTract(self, index)
def __init__(self, numTracts, config=None, version=0)
def __getitem__(self, index)