LSST Applications g04c3c9f7ca+2075667efa,g1e125bf412+5f448d5fcf,g2079a07aa2+3e9fd84d81,g2305ad1205+b635cf1488,g2bbee38e9b+6c6beb4891,g337abbeb29+6c6beb4891,g33d1c0ed96+6c6beb4891,g3a166c0a6a+6c6beb4891,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+42f171e1e6,g5c3423f6d4+d536b04327,g607f77f49a+d536b04327,g6f43f06aed+ca1339dc19,g858d7b2824+d536b04327,g8ee334c5b4+d7f9608c2f,g9963eaa53e+b3dc1655d3,g998f4353bf+d536b04327,g99cad8db69+8ef2408349,g9ddcbc5298+9a081db1e4,ga1e77700b3+2cbb763275,gadfd92a7e4+aec2f3b930,gae0086650b+585e252eca,gb0e22166c9+0e73c8378f,gb3b7280ab2+cb5fdb229e,gbb8dafda3b+a327199e22,gc120e1dc64+88074880ea,gc28159a63d+6c6beb4891,gcdd4ae20e8+bd241b2308,gcde1bda545+903e937d91,gcf0d15dbbd+bd241b2308,gdaeeff99f8+f9a426f77a,gddc38dedce+585e252eca,ge79ae78c31+6c6beb4891,gfbcc870c63+b310236976,w.2024.23
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: