UniformGrid#
- class lsst.cell_coadds.UniformGrid(cell_size: Extent2I, shape: Index2D, *, padding: int = 0, min: Point2I | None = None)#
Bases:
objectA 2-dimensional integer grid.
Parameters#
- cell_size
lsst.geom.Extent2I The size of each interior grid cell.
- shape
lsst.skymap.Index2D The number of cells in the grid in each dimension.
- padding
int, optional The number of pixels to pad the grid in each dimension.
- min
lsst.geom.Point2Ior None, optional The minimum (lower left) corner of the interior grid, excluding
padding. IfNone, the minimum corner is set to be (0, 0).
Attributes Summary
Methods Summary
bbox_of(index)Bounding box of the cell at the given index.
from_bbox_cell_size(bbox, cell_size[, padding])Generate a UniformGrid instance from a bounding box and a cell size.
from_bbox_shape(bbox, shape[, padding])Generate a UniformGrid instance from a bounding box and a shape.
get_bbox()index(position)Index of the cell that contains the given point.
min_of(index)Minimum point of a single cell's bounding box.
Attributes Documentation
- bbox#
- bbox_with_padding#
- cell_size#
- padding#
- shape#
Methods Documentation
- bbox_of(index: Index2D) Box2I#
Bounding box of the cell at the given index.
Parameters#
- index
Index2D A 2D index of the cell.
Returns#
- bbox
lsst.geom.Box2I The bounding box of the cell.
- index
- classmethod from_bbox_cell_size(bbox: Box2I, cell_size: Extent2I, padding: int = 0) UniformGrid#
Generate a UniformGrid instance from a bounding box and a cell size.
Parameters#
- bbox
lsst.geom.Box2I Bounding box of the full grid (without including
padding).- cell_size
lsst.geom.Extent2I Size of each interior grid cell. Must divide the
bboxwidth and height evenly.- padding
int, optional The number of pixels to pad the grid in each dimension.
Returns#
- grid
UniformGrid A new UniformGrid instance.
Raises#
- IndexError
Raised if
cell_sizedimensions do not divide thebboxdimensions evenly.
- bbox
- classmethod from_bbox_shape(bbox: Box2I, shape: Index2D, padding: int = 0) UniformGrid#
Generate a UniformGrid instance from a bounding box and a shape.
Parameters#
- bbox
lsst.geom.Box2I Bounding box of the full grid (without including
padding).- shape
lsst.skymap.Index2D Number of cells in the grid in each dimension. Must divide the
bboxwidth and height evenly.- padding
int, optional The number of pixels to pad the grid in each dimension.
Returns#
- grid
UniformGrid A new UniformGrid instance.
Raises#
- LengthError
Raised if
shapedimensions do not divide thebboxdimensions evenly.
- bbox
- get_padding() int#
- index(position: Point2I) Index2D#
Index of the cell that contains the given point.
Parameters#
- position
lsst.geom.Point2I A point in the grid.
Returns#
- index
lsst.skymap.Index2D A 2D index of the cell containing
position.
Raises#
- ValueError
Raised if
positionis not within the grid’s bounding box including the padding.
- position
- cell_size