GridContainer#

class lsst.cell_coadds.GridContainer(shape: Index2D, offset: Index2D | None = None)#

Bases: MutableMapping[Index2D, T]

A container whose elements form a 2-d grid.

Parameters#

shapeIndex2D

The number of cells in the grid in each dimension.

offsetIndex2D or None, optional

The integer offset of the grid in each dimension. If None, the offset is Index2D(0, 0).

Attributes Summary

arbitrary

An arbitrary cell from the container.

first

The cell at the lower left corner of the container.

last

The cell at the upper right corner of the container.

offset

Index of the first cell in the container.

shape

Number of cells in the container in each dimension.

size

The number of cells expected in the container.

Methods Summary

indices()

Return an iterator over all possible indices for the container.

rebuild_transformed(transform)

Return a GridContainer with the same shape and offset.

subset_overlapping(grid, bbox)

Return a new GridContainer with cells that overlap a bounding box.

Attributes Documentation

arbitrary#

An arbitrary cell from the container.

It is typically the first cell, but in the case where it might not be available, it is a well-behaved cell.

Raises#

RuntimeError:

Raised if the grid container is empty.

first#

The cell at the lower left corner of the container.

last#

The cell at the upper right corner of the container.

offset#

Index of the first cell in the container.

shape#

Number of cells in the container in each dimension.

size#

The number of cells expected in the container.

This does not indicate the number of cells that have been filled. Use len() instead.

Methods Documentation

indices() Iterable[Index2D]#

Return an iterator over all possible indices for the container.

Unlike keys, this method returns an iterator over all valid indices, whether the corresponding value is set or not.

See Also#

keys

rebuild_transformed(transform: Callable[[T], T]) GridContainer#

Return a GridContainer with the same shape and offset.

The cell values are created by applying a callback function to each cell value in this object.

Parameters#

transformCallable[[T], T]

A callable function that takes a cell value and returns a new

subset_overlapping(grid: UniformGrid, bbox: geom.Box2I) GridContainer#

Return a new GridContainer with cells that overlap a bounding box.

Parameters#

gridUniformGrid

Grid that maps the container’s cells to the coordinates used to define the bounding box. May define a grid that is a super of the container’s cells.

bboxBox2I

Bounding box that returned cells must overlap.

Returns#

grid_containerGridContainer

GridContainer with just the cells that overlap the bounding box.