LSST Applications g1653933729+a8ce1bb630,g171997e3ee+76e92115be,g1a997c3884+a8ce1bb630,g28da252d5a+4013ff5194,g2bbee38e9b+d6d0f9f6ae,g2bc492864f+d6d0f9f6ae,g2cdde0e794+ccb74358b7,g3156d2b45e+07302053f8,g347aa1857d+d6d0f9f6ae,g35bb328faa+a8ce1bb630,g3a166c0a6a+d6d0f9f6ae,g3e281a1b8c+130fae20e3,g4005a62e65+17cd334064,g414038480c+c9f68e2a12,g41af890bb2+3e1f62f438,g4e1a3235cc+9db7d56ad0,g7b55021d1b+7b623691d5,g80478fca09+334cc8d2bd,g82479be7b0+b568f6b267,g858d7b2824+37b39d8760,g9125e01d80+a8ce1bb630,ga5288a1d22+11cb34fefe,gae0086650b+a8ce1bb630,gb4ec7eb0ab+37b39d8760,gb58c049af0+d64f4d3760,gc081298178+284e133171,gc28159a63d+d6d0f9f6ae,gcf0d15dbbd+00fe2e0b07,gd6b7c0dfd1+8b62435e69,gda3e153d99+37b39d8760,gda6a2b7d83+00fe2e0b07,gdaeeff99f8+1711a396fd,gdd5a9049c5+23f3b3239a,ge2409df99d+5d9f551a54,ge33fd446bb+37b39d8760,ge79ae78c31+d6d0f9f6ae,gf0baf85859+2dea8344a2,gf5289d68f6+3777f3df5e,w.2024.41
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: