LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.skymap.cachingSkyMap.CachingSkyMap Class Reference
Inheritance diagram for lsst.skymap.cachingSkyMap.CachingSkyMap:
lsst.skymap.baseSkyMap.BaseSkyMap lsst.skymap.discreteSkyMap.DiscreteSkyMap lsst.skymap.healpixSkyMap.HealpixSkyMap lsst.skymap.ringsSkyMap.RingsSkyMap

Public Member Functions

 __init__ (self, numTracts, config=None, version=0)
 
 __reduce__ (self)
 
 __iter__ (self)
 
 __len__ (self)
 
 __getitem__ (self, index)
 
 generateTract (self, index)
 

Public Attributes

 config
 

Protected Attributes

 _numTracts
 
 _tractCache
 
 _tractInfo
 
 _version
 

Detailed Description

A SkyMap that generates its tracts on request and caches them.

Parameters
----------
numTracts : `int`
    Number of tracts to create.
config : `lsst.skymap.BaseSkyMapConfig` (optional)
    The configuration for this SkyMap; if None use the default config.
version : `int` or `tuple` of `int` (optional)
    Software version of this class, to retain compatibility with old
    instances.

Notes
-----
A subclass should define
* __init__ to calculate the required number of tracts (and pass it up)
* generateTract to generate a tract

Subclassers should also check that the arguments to the constructor are
consistent with the below __reduce__ method.

Definition at line 28 of file cachingSkyMap.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.skymap.cachingSkyMap.CachingSkyMap.__init__ ( self,
numTracts,
config = None,
version = 0 )

Reimplemented from lsst.skymap.baseSkyMap.BaseSkyMap.

Reimplemented in lsst.skymap.discreteSkyMap.DiscreteSkyMap, lsst.skymap.healpixSkyMap.HealpixSkyMap, and lsst.skymap.ringsSkyMap.RingsSkyMap.

Definition at line 51 of file cachingSkyMap.py.

51 def __init__(self, numTracts, config=None, version=0):
52 super(CachingSkyMap, self).__init__(config)
53 self._numTracts = numTracts
54 self._tractCache = [None] * self._numTracts
55 self._tractInfo = None # We shouldn't need this; we will generate tracts on demand
56 self._version = version
57

Member Function Documentation

◆ __getitem__()

lsst.skymap.cachingSkyMap.CachingSkyMap.__getitem__ ( self,
index )
Get the TractInfo for a particular index.

The tract is returned from a cache, if available, otherwise generated
on the fly.

Reimplemented from lsst.skymap.baseSkyMap.BaseSkyMap.

Definition at line 80 of file cachingSkyMap.py.

80 def __getitem__(self, index):
81 """Get the TractInfo for a particular index.
82
83 The tract is returned from a cache, if available, otherwise generated
84 on the fly.
85 """
86 if index < 0 or index > self._numTracts:
87 raise IndexError("Index out of range: %d vs %d" % (index, self._numTracts))
88 if self._tractCache[index] is not None:
89 return self._tractCache[index]
90 tract = self.generateTract(index)
91 self._tractCache[index] = tract
92 return tract
93

◆ __iter__()

lsst.skymap.cachingSkyMap.CachingSkyMap.__iter__ ( self)
Iterator over tracts.

Reimplemented from lsst.skymap.baseSkyMap.BaseSkyMap.

Definition at line 71 of file cachingSkyMap.py.

71 def __iter__(self):
72 """Iterator over tracts."""
73 for i in range(self._numTracts):
74 yield self[i]
75

◆ __len__()

lsst.skymap.cachingSkyMap.CachingSkyMap.__len__ ( self)
Length is number of tracts.

Reimplemented from lsst.skymap.baseSkyMap.BaseSkyMap.

Definition at line 76 of file cachingSkyMap.py.

76 def __len__(self):
77 """Length is number of tracts."""
78 return self._numTracts
79

◆ __reduce__()

lsst.skymap.cachingSkyMap.CachingSkyMap.__reduce__ ( self)
To support pickling.

Notes
-----
**Warning:** This method assumes that the constructor is be defined:
    __init__(self, config, version=defaultVersion)
The use of 'config' is effectively set by the registry mechanism.
If additional optional arguments are added, this method should be
overridden to correspond.

Definition at line 58 of file cachingSkyMap.py.

58 def __reduce__(self):
59 """To support pickling.
60
61 Notes
62 -----
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.
68 """
69 return (self.__class__, (self.config, self._version))
70

◆ generateTract()

lsst.skymap.cachingSkyMap.CachingSkyMap.generateTract ( self,
index )
Generate TractInfo for the specified tract index.

Reimplemented in lsst.skymap.discreteSkyMap.DiscreteSkyMap, lsst.skymap.healpixSkyMap.HealpixSkyMap, and lsst.skymap.ringsSkyMap.RingsSkyMap.

Definition at line 94 of file cachingSkyMap.py.

94 def generateTract(self, index):
95 """Generate TractInfo for the specified tract index."""
96 raise NotImplementedError("Subclasses must define this method.")

Member Data Documentation

◆ _numTracts

lsst.skymap.cachingSkyMap.CachingSkyMap._numTracts
protected

Definition at line 53 of file cachingSkyMap.py.

◆ _tractCache

lsst.skymap.cachingSkyMap.CachingSkyMap._tractCache
protected

Definition at line 54 of file cachingSkyMap.py.

◆ _tractInfo

lsst.skymap.cachingSkyMap.CachingSkyMap._tractInfo
protected

Definition at line 55 of file cachingSkyMap.py.

◆ _version

lsst.skymap.cachingSkyMap.CachingSkyMap._version
protected

Definition at line 56 of file cachingSkyMap.py.

◆ config

lsst.skymap.cachingSkyMap.CachingSkyMap.config

Definition at line 69 of file cachingSkyMap.py.


The documentation for this class was generated from the following file: