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
bboxattribute) is populated with only a few exceptions (themissingset).Slicing a
CellGridBoundswith aBoxreturns a newCellGridBoundswith just the cells that overlap that box. As always,CellGridBounds.bboxwill 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.
- 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) – AnXYorYXcoordinate pair to test for containment. Mutually exclusive withxandy.x (
Any, default:None) – One or more X coordinates to test for containment, as a scalar or any array-like. Results are broadcast againsty. Mutually exclusive withpoint.y (
Any, default:None) – One or more Y coordinates to test for containment, as a scalar or any array-like. Results are broadcast againstx. Mutually exclusive withpoint.
- Returns:
If
xandyare both scalars, a singleboolvalue. Ifxandyare array-like, a boolean array with their broadcasted shape.- Return type:
- contains_cell(index)#
Test whether the given cell is in the bounds.
- deserialize()#
Deserialize a bounds object on the assumption it is a
CellGridBounds.This method just returns the
CellGridBoundsitself, since that already provides Pydantic serialization hooks. It exists for compatibility with theBoundsprotocol.- Return type:
- intersection(other)#
Compute the intersection of this bounds object with another.
- serialize()#
Convert a bounds instance into a serializable object.
- Return type:
- property subgrid_size: CellIJ#
Number of cells within these bounds in both dimensions, not accounting for
missing.