LSST Applications g02d81e74bb+86cf3d8bc9,g180d380827+7a4e862ed4,g2079a07aa2+86d27d4dc4,g2305ad1205+e1ca1c66fa,g29320951ab+012e1474a1,g295015adf3+341ea1ce94,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+c429d67c83,g48712c4677+f88676dd22,g487adcacf7+27e1e21933,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+b41db86c35,g5a732f18d5+53520f316c,g64a986408d+86cf3d8bc9,g858d7b2824+86cf3d8bc9,g8a8a8dda67+585e252eca,g99cad8db69+84912a7fdc,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+a2b54eae19,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+6681f309db,gc120e1dc64+f0fcc2f6d8,gc28159a63d+0e5473021a,gcf0d15dbbd+c429d67c83,gdaeeff99f8+f9a426f77a,ge6526c86ff+0433e6603d,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+86cf3d8bc9,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.skymap.tractBuilder.BaseTractBuilder Class Reference
Inheritance diagram for lsst.skymap.tractBuilder.BaseTractBuilder:
lsst.skymap.tractBuilder.CellTractBuilder lsst.skymap.tractBuilder.LegacyTractBuilder

Public Member Functions

 __init__ (self, config)
 
 setupPatches (self, minBBox, wcs)
 
 getPatchBorder (self)
 
 getPatchInfo (self, index, tractWcs)
 
 getPatchInnerDimensions (self)
 
 getSequentialPatchIndex (self, patchInfo)
 
 getSequentialPatchIndexFromPair (self, index)
 
 getPatchIndexPair (self, sequentialIndex)
 
 getPackedConfig (self, config)
 

Public Attributes

 config
 

Protected Attributes

 _patchInnerDimensions
 
 _numPatches
 
 _tractBBox
 
 _initialized
 

Detailed Description

Base class for algorithms that define patches within the tract.

Parameters
----------
config : `lsst.pexConfig.Config`
    Input for configuring the algorithm

Definition at line 42 of file tractBuilder.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.skymap.tractBuilder.BaseTractBuilder.__init__ ( self,
config )

Reimplemented in lsst.skymap.tractBuilder.LegacyTractBuilder, and lsst.skymap.tractBuilder.CellTractBuilder.

Definition at line 50 of file tractBuilder.py.

50 def __init__(self, config):
51 self.config = config
52

Member Function Documentation

◆ getPackedConfig()

lsst.skymap.tractBuilder.BaseTractBuilder.getPackedConfig ( self,
config )
Get a packed config suitable for using in a sha1.

Parameters
----------
config : `lsst.skymap.BaseTractBuilderConfig`

Returns
-------
configPacked : `bytes`

Reimplemented in lsst.skymap.tractBuilder.LegacyTractBuilder, and lsst.skymap.tractBuilder.CellTractBuilder.

Definition at line 184 of file tractBuilder.py.

184 def getPackedConfig(self, config):
185 """Get a packed config suitable for using in a sha1.
186
187 Parameters
188 ----------
189 config : `lsst.skymap.BaseTractBuilderConfig`
190
191 Returns
192 -------
193 configPacked : `bytes`
194 """
195 raise NotImplementedError("Must be implemented by a subclass")
196
197

◆ getPatchBorder()

lsst.skymap.tractBuilder.BaseTractBuilder.getPatchBorder ( self)

Definition at line 96 of file tractBuilder.py.

96 def getPatchBorder(self):
97 return self._patchBorder
98

◆ getPatchIndexPair()

lsst.skymap.tractBuilder.BaseTractBuilder.getPatchIndexPair ( self,
sequentialIndex )
Convert sequential index into patch index (x,y) pair.

Parameters
----------
sequentialIndex : `int`

Returns
-------
x, y : `lsst.skymap.Index2D`

Definition at line 167 of file tractBuilder.py.

167 def getPatchIndexPair(self, sequentialIndex):
168 """Convert sequential index into patch index (x,y) pair.
169
170 Parameters
171 ----------
172 sequentialIndex : `int`
173
174 Returns
175 -------
176 x, y : `lsst.skymap.Index2D`
177 """
178 nx, ny = self._numPatches
179 x = sequentialIndex % nx
180 y = sequentialIndex // nx
181 return Index2D(x=x, y=y)
182

◆ getPatchInfo()

lsst.skymap.tractBuilder.BaseTractBuilder.getPatchInfo ( self,
index,
tractWcs )
Return information for the specified patch.

Parameters
----------
index : `lsst.skymap.Index2D` or `~collections.abc.Iterable` of 2 `int`
    Index of patch, as Index2D or pair of ints;
    or a sequential index as returned by getSequentialPatchIndex;
    negative values are not supported.
tractWcs : `lsst.afw.geom.SkyWcs`
    WCS associated with the tract.

Returns
-------
result : `lsst.skymap.PatchInfo`
    The patch info for that index.

Raises
------
IndexError
    Raised if index is out of range.

Reimplemented in lsst.skymap.tractBuilder.LegacyTractBuilder, and lsst.skymap.tractBuilder.CellTractBuilder.

Definition at line 100 of file tractBuilder.py.

100 def getPatchInfo(self, index, tractWcs):
101 """Return information for the specified patch.
102
103 Parameters
104 ----------
105 index : `lsst.skymap.Index2D` or `~collections.abc.Iterable` of 2 `int`
106 Index of patch, as Index2D or pair of ints;
107 or a sequential index as returned by getSequentialPatchIndex;
108 negative values are not supported.
109 tractWcs : `lsst.afw.geom.SkyWcs`
110 WCS associated with the tract.
111
112 Returns
113 -------
114 result : `lsst.skymap.PatchInfo`
115 The patch info for that index.
116
117 Raises
118 ------
119 IndexError
120 Raised if index is out of range.
121 """
122 raise NotImplementedError("Must be implemented by a subclass")
123

◆ getPatchInnerDimensions()

lsst.skymap.tractBuilder.BaseTractBuilder.getPatchInnerDimensions ( self)
Get dimensions of inner region of the patches (all are the same)

Definition at line 124 of file tractBuilder.py.

124 def getPatchInnerDimensions(self):
125 """Get dimensions of inner region of the patches (all are the same)
126 """
127 return self._patchInnerDimensions
128

◆ getSequentialPatchIndex()

lsst.skymap.tractBuilder.BaseTractBuilder.getSequentialPatchIndex ( self,
patchInfo )
Return a single integer that uniquely identifies
the given patch within this tract.

Parameters
----------
patchInfo : `lsst.skymap.PatchInfo`

Returns
-------
sequentialIndex : `int`

Definition at line 129 of file tractBuilder.py.

129 def getSequentialPatchIndex(self, patchInfo):
130 """Return a single integer that uniquely identifies
131 the given patch within this tract.
132
133 Parameters
134 ----------
135 patchInfo : `lsst.skymap.PatchInfo`
136
137 Returns
138 -------
139 sequentialIndex : `int`
140 """
141 index = patchInfo.getIndex()
142 return self.getSequentialPatchIndexFromPair(index)
143

◆ getSequentialPatchIndexFromPair()

lsst.skymap.tractBuilder.BaseTractBuilder.getSequentialPatchIndexFromPair ( self,
index )
Return a single integer that uniquely identifies
the patch index within the tract.

Parameters
----------
index : `lsst.skymap.Index2D` or `~collections.abc.Iterable` of 2 `int`

Returns
-------
sequentialIndex : `int`

Definition at line 144 of file tractBuilder.py.

144 def getSequentialPatchIndexFromPair(self, index):
145 """Return a single integer that uniquely identifies
146 the patch index within the tract.
147
148 Parameters
149 ----------
150 index : `lsst.skymap.Index2D` or `~collections.abc.Iterable` of 2 `int`
151
152 Returns
153 -------
154 sequentialIndex : `int`
155 """
156 if isinstance(index, Index2D):
157 _index = index
158 else:
159 if not isinstance(index, Iterable):
160 raise ValueError("Input index is not an iterable.")
161 if len(index) != 2:
162 raise ValueError("Input index does not have two values.")
163 _index = Index2D(*index)
164 nx, ny = self._numPatches
165 return nx*_index.y + _index.x
166

◆ setupPatches()

lsst.skymap.tractBuilder.BaseTractBuilder.setupPatches ( self,
minBBox,
wcs )
Set up the patches of a particular size in a tract.

We grow the tract bounding box to hold an exact multiple of
the desired size (patchInnerDimensions or
numCellsPerPatchInner*cellInnerDimensions), while keeping
the center roughly the same.  We return the final tract
bounding box, and the number of patches in each dimension
(as an Index2D).

Parameters
----------
minBBox : `lsst.geom.Box2I`
    Minimum bounding box for tract.
wcs : `lsst.afw.geom.SkyWcs`
    Wcs object.

Returns
-------
bbox : `lsst.geom.Box2I`
    final bounding box, number of patches.
numPatches : `lsst.skymap.Index2D`

Definition at line 53 of file tractBuilder.py.

53 def setupPatches(self, minBBox, wcs):
54 """Set up the patches of a particular size in a tract.
55
56 We grow the tract bounding box to hold an exact multiple of
57 the desired size (patchInnerDimensions or
58 numCellsPerPatchInner*cellInnerDimensions), while keeping
59 the center roughly the same. We return the final tract
60 bounding box, and the number of patches in each dimension
61 (as an Index2D).
62
63 Parameters
64 ----------
65 minBBox : `lsst.geom.Box2I`
66 Minimum bounding box for tract.
67 wcs : `lsst.afw.geom.SkyWcs`
68 Wcs object.
69
70 Returns
71 -------
72 bbox : `lsst.geom.Box2I`
73 final bounding box, number of patches.
74 numPatches : `lsst.skymap.Index2D`
75 """
76 bbox = geom.Box2I(minBBox)
77 bboxMin = bbox.getMin()
78 bboxDim = bbox.getDimensions()
79 numPatchesList = [0, 0]
80 for i, innerDim in enumerate(self._patchInnerDimensions):
81 num = (bboxDim[i] + innerDim - 1) // innerDim # round up
82 deltaDim = (innerDim*num) - bboxDim[i]
83 if deltaDim > 0:
84 bboxDim[i] = innerDim * num
85 bboxMin[i] -= deltaDim // 2
86 numPatchesList[i] = num
87 numPatches = Index2D(*numPatchesList)
88 bbox = geom.Box2I(bboxMin, bboxDim)
89 self._numPatches = numPatches
90 # The final tract BBox starts at zero.
91 self._tractBBox = geom.Box2I(geom.Point2I(0, 0), bbox.getDimensions())
92 self._initialized = True
93
94 return bbox, numPatches
95
An integer coordinate rectangle.
Definition Box.h:55

Member Data Documentation

◆ _initialized

lsst.skymap.tractBuilder.BaseTractBuilder._initialized
protected

Definition at line 92 of file tractBuilder.py.

◆ _numPatches

lsst.skymap.tractBuilder.BaseTractBuilder._numPatches
protected

Definition at line 89 of file tractBuilder.py.

◆ _patchInnerDimensions

lsst.skymap.tractBuilder.BaseTractBuilder._patchInnerDimensions
protected

Definition at line 80 of file tractBuilder.py.

◆ _tractBBox

lsst.skymap.tractBuilder.BaseTractBuilder._tractBBox
protected

Definition at line 91 of file tractBuilder.py.

◆ config

lsst.skymap.tractBuilder.BaseTractBuilder.config

Definition at line 51 of file tractBuilder.py.


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