LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+0dd8ce4237,g1470d8bcf6+3ea6592b6f,g2079a07aa2+86d27d4dc4,g2305ad1205+5ca4c0b359,g295015adf3+d10818ec9d,g2a9a014e59+6f9be1b9cd,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+703ba97ebf,g487adcacf7+4fa16da234,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ffa42b374e,g5a732f18d5+53520f316c,g64a986408d+0dd8ce4237,g858d7b2824+0dd8ce4237,g8a8a8dda67+585e252eca,g99cad8db69+d39438377f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+f1d96605c8,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e5339d463f,gc120e1dc64+da31e9920e,gc28159a63d+0e5473021a,gcf0d15dbbd+703ba97ebf,gdaeeff99f8+f9a426f77a,ge6526c86ff+889fc9d533,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+7268b93478,gff1a9f87cc+0dd8ce4237,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
lsst.skymap.tractBuilder.CellTractBuilder Class Reference
Inheritance diagram for lsst.skymap.tractBuilder.CellTractBuilder:
lsst.skymap.tractBuilder.BaseTractBuilder

Public Member Functions

 __init__ (self, config)
 
 getPatchInfo (self, index, tractWcs)
 
 getPackedConfig (self, config)
 

Static Public Attributes

 ConfigClass = CellTractBuilderConfig
 

Protected Attributes

 _cellInnerDimensions
 
 _cellBorder
 
 _numCellsPerPatchInner
 
 _numCellsInPatchBorder
 
 _patchInnerDimensions
 
 _patchBorder
 
 _initialized
 
 _tractBBox
 

Detailed Description

Definition at line 302 of file tractBuilder.py.

Constructor & Destructor Documentation

◆ __init__()

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

Reimplemented from lsst.skymap.tractBuilder.BaseTractBuilder.

Definition at line 305 of file tractBuilder.py.

305 def __init__(self, config):
306 super().__init__(config)
307
308 self._cellInnerDimensions = geom.Extent2I(*(val
309 for val in config.cellInnerDimensions))
310 self._cellBorder = config.cellBorder
311 self._numCellsPerPatchInner = config.numCellsPerPatchInner
312 self._numCellsInPatchBorder = config.numCellsInPatchBorder
313 self._patchInnerDimensions = geom.Extent2I(*(val*self._numCellsPerPatchInner
314 for val in config.cellInnerDimensions))
315 # The patch border is the number of cells in the border + the cell
316 # border.
317 self._patchBorder = config.numCellsInPatchBorder*config.cellInnerDimensions[0] + self._cellBorder
318 self._initialized = False
319

Member Function Documentation

◆ getPackedConfig()

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

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

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

Reimplemented from lsst.skymap.tractBuilder.BaseTractBuilder.

Definition at line 356 of file tractBuilder.py.

356 def getPackedConfig(self, config):
357 subConfig = config.tractBuilder[config.tractBuilder.name]
358 configPacked = struct.pack(
359 "<iiiiidd3sd",
360 subConfig.cellInnerDimensions[0],
361 subConfig.cellInnerDimensions[1],
362 subConfig.cellBorder,
363 subConfig.numCellsPerPatchInner,
364 subConfig.numCellsInPatchBorder,
365 config.tractOverlap,
366 config.pixelScale,
367 config.projection.encode('ascii'),
368 config.rotation
369 )
370
371 return configPacked
372
373

◆ getPatchInfo()

lsst.skymap.tractBuilder.CellTractBuilder.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 from lsst.skymap.tractBuilder.BaseTractBuilder.

Definition at line 320 of file tractBuilder.py.

320 def getPatchInfo(self, index, tractWcs):
321 # This should always be initialized
322 if not self._initialized:
323 raise RuntimeError("Programmer error; this should always be initialized.")
324 if isinstance(index, Index2D):
325 _index = index
326 else:
327 if isinstance(index, numbers.Number):
328 _index = self.getPatchIndexPair(index)
329 else:
330 _index = Index2D(*index)
331 if (not 0 <= _index.x < self._numPatches.x) \
332 or (not 0 <= _index.y < self._numPatches.y):
333 raise IndexError("Patch index %s is not in range [0-%d, 0-%d]" %
334 (_index, self._numPatches.x - 1, self._numPatches.y - 1))
335 innerMin = geom.Point2I(*[_index[i]*self._patchInnerDimensions[i] for i in range(2)])
336 innerBBox = geom.Box2I(innerMin, self._patchInnerDimensions)
337 if not self._tractBBox.contains(innerBBox):
338 raise RuntimeError(
339 "Bug: patch index %s valid but inner bbox=%s not contained in tract bbox=%s" %
340 (_index, innerBBox, self._tractBBox))
341 outerBBox = geom.Box2I(innerBBox)
342 outerBBox.grow(self.getPatchBorder())
343 # We do not clip the patch for cell-based tracts.
344 return PatchInfo(
345 index=_index,
346 innerBBox=innerBBox,
347 outerBBox=outerBBox,
348 sequentialIndex=self.getSequentialPatchIndexFromPair(_index),
349 tractWcs=tractWcs,
350 cellInnerDimensions=self._cellInnerDimensions,
351 cellBorder=self._cellBorder,
352 numCellsPerPatchInner=self._numCellsPerPatchInner,
353 numCellsInPatchBorder=self._numCellsInPatchBorder
354 )
355
An integer coordinate rectangle.
Definition Box.h:55

Member Data Documentation

◆ _cellBorder

lsst.skymap.tractBuilder.CellTractBuilder._cellBorder
protected

Definition at line 310 of file tractBuilder.py.

◆ _cellInnerDimensions

lsst.skymap.tractBuilder.CellTractBuilder._cellInnerDimensions
protected

Definition at line 308 of file tractBuilder.py.

◆ _initialized

lsst.skymap.tractBuilder.CellTractBuilder._initialized
protected

Definition at line 318 of file tractBuilder.py.

◆ _numCellsInPatchBorder

lsst.skymap.tractBuilder.CellTractBuilder._numCellsInPatchBorder
protected

Definition at line 312 of file tractBuilder.py.

◆ _numCellsPerPatchInner

lsst.skymap.tractBuilder.CellTractBuilder._numCellsPerPatchInner
protected

Definition at line 311 of file tractBuilder.py.

◆ _patchBorder

lsst.skymap.tractBuilder.CellTractBuilder._patchBorder
protected

Definition at line 317 of file tractBuilder.py.

◆ _patchInnerDimensions

lsst.skymap.tractBuilder.CellTractBuilder._patchInnerDimensions
protected

Definition at line 313 of file tractBuilder.py.

◆ _tractBBox

lsst.skymap.tractBuilder.CellTractBuilder._tractBBox
protected

Definition at line 340 of file tractBuilder.py.

◆ ConfigClass

lsst.skymap.tractBuilder.CellTractBuilder.ConfigClass = CellTractBuilderConfig
static

Definition at line 303 of file tractBuilder.py.


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