UniformGrid¶
- class lsst.cell_coadds.UniformGrid(cell_size: Extent2I, shape: Index2D, *, padding: int = 0, min: Point2I | None = None)¶
Bases:
object
A 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.Point2I
or None, optional The minimum (lower left) corner of the interior grid, excluding
padding
. IfNone
, the minimum corner is set to be (0, 0).
- cell_size
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.
- index
- Returns:
- bbox
lsst.geom.Box2I
The bounding box of the cell.
- bbox
- 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
bbox
width and height evenly.- padding
int
, optional The number of pixels to pad the grid in each dimension.
- bbox
- Returns:
- grid
UniformGrid
A new UniformGrid instance.
- grid
- Raises:
- IndexError
Raised if
cell_size
dimensions do not divide thebbox
dimensions evenly.
- 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
bbox
width and height evenly.- padding
int
, optional The number of pixels to pad the grid in each dimension.
- bbox
- Returns:
- grid
UniformGrid
A new UniformGrid instance.
- grid
- Raises:
- LengthError
Raised if
shape
dimensions do not divide thebbox
dimensions evenly.
- index(position: Point2I) Index2D ¶
Index of the cell that contains the given point.
- Parameters:
- position
lsst.geom.Point2I
A point in the grid.
- position
- Returns:
- index
lsst.skymap.Index2D
A 2D index of the cell containing
position
.
- index
- Raises:
- ValueError
Raised if
position
is not within the grid’s bounding box including the padding.
- min_of(index: Index2D) Point2I ¶
Minimum point of a single cell’s bounding box.
- Parameters:
- index
Index2D
A 2D index of the cell.
- index
- Returns:
- point
lsst.geom.Point2I
The minimum point of the cell’s bounding box.
- point