CellGridBounds#

pydantic model lsst.images.cells.CellGridBounds#

A region of pixels defined by a set of cells within a grid.

Notes

This data structure is optimized for the case where a continguous rectangular region of the grid (the bbox attribute) is populated with only a few exceptions (the missing set).

Slicing a CellGridBounds with a Box returns a new CellGridBounds with just the cells that overlap that box. As always, CellGridBounds.bbox will be snapped to the outer boundaries of those cells, so it will contain (and not generally equal) the given box.

Parameters:

data (Any)

Fields:
field bbox: Box [Required]#

Pixel bounding box of the region (snapped to cell boundaries).

field grid: CellGrid [Required]#

Definition of the grid that defines the cells.

field missing: frozenset[CellIJ] = frozenset({})#

Indices of cells that are missing, where (i=0, j=0) is the cell that starts at grid.bbox.start.

cell_indices()#

Iterate over the indices of the cells in these bounds.

Return type:

Iterator[CellIJ]

contains(point=None, /, *, x=None, y=None)#

Test whether these bounds contain one or more points.

Parameters:
  • point (Union[XY[Any], YX[Any], None], default: None) – An XY or YX coordinate pair to test for containment. Mutually exclusive with x and y.

  • x (Any, default: None) – One or more X coordinates to test for containment, as a scalar or any array-like. Results are broadcast against y. Mutually exclusive with point.

  • y (Any, default: None) – One or more Y coordinates to test for containment, as a scalar or any array-like. Results are broadcast against x. Mutually exclusive with point.

Returns:

If x and y are both scalars, a single bool value. If x and y are array-like, a boolean array with their broadcasted shape.

Return type:

bool | numpy.ndarray

contains_cell(index)#

Test whether the given cell is in the bounds.

Parameters:

index (CellIJ) – Index of the cell to test.

Return type:

bool

deserialize()#

Deserialize a bounds object on the assumption it is a CellGridBounds.

This method just returns the CellGridBounds itself, since that already provides Pydantic serialization hooks. It exists for compatibility with the Bounds protocol.

Return type:

CellGridBounds

intersection(other)#

Compute the intersection of this bounds object with another.

Parameters:

other (Bounds) – Bounds to intersect with this one.

Return type:

Bounds

missing_boxes()#

Iterate over the bounding boxes of the missing cells.

Return type:

Iterator[Box]

serialize()#

Convert a bounds instance into a serializable object.

Return type:

CellGridBounds

property subgrid_size: CellIJ#

Number of cells within these bounds in both dimensions, not accounting for missing.

property subgrid_start: CellIJ#

The index of the first cell in this bounds’ bounding box within its grid.

property subgrid_stop: CellIJ#

One-past-the-last indices for the cells in these bounds, within its grid.

This page was last modified on .