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_sizelsst.geom.Extent2I

The size of each interior grid cell.

shapelsst.skymap.Index2D

The number of cells in the grid in each dimension.

paddingint, optional

The number of pixels to pad the grid in each dimension.

minlsst.geom.Point2I or None, optional

The minimum (lower left) corner of the interior grid, excluding padding. If None, the minimum corner is set to be (0, 0).

Attributes Summary

bbox

bbox_with_padding

cell_size

padding

shape

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()

get_bbox_with_padding()

get_cell_size()

get_padding()

get_shape()

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:
indexIndex2D

A 2D index of the cell.

Returns:
bboxlsst.geom.Box2I

The bounding box of the cell.

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:
bboxlsst.geom.Box2I

Bounding box of the full grid (without including padding).

cell_sizelsst.geom.Extent2I

Size of each interior grid cell. Must divide the bbox width and height evenly.

paddingint, optional

The number of pixels to pad the grid in each dimension.

Returns:
gridUniformGrid

A new UniformGrid instance.

Raises:
IndexError

Raised if cell_size dimensions do not divide the bbox 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:
bboxlsst.geom.Box2I

Bounding box of the full grid (without including padding).

shapelsst.skymap.Index2D

Number of cells in the grid in each dimension. Must divide the bbox width and height evenly.

paddingint, optional

The number of pixels to pad the grid in each dimension.

Returns:
gridUniformGrid

A new UniformGrid instance.

Raises:
LengthError

Raised if shape dimensions do not divide the bbox dimensions evenly.

get_bbox() Box2I
get_bbox_with_padding() Box2I
get_cell_size() Extent2I
get_padding() int
get_shape() Index2D
index(position: Point2I) Index2D

Index of the cell that contains the given point.

Parameters:
positionlsst.geom.Point2I

A point in the grid.

Returns:
indexlsst.skymap.Index2D

A 2D index of the cell containing position.

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:
indexIndex2D

A 2D index of the cell.

Returns:
pointlsst.geom.Point2I

The minimum point of the cell’s bounding box.