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

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

clear()

get(k[,d])

indices()

Return an iterator over all possible indices for the container.

items()

keys()

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

rebuild_transformed(transform)

Return a GridContainer with the same shape and offset.

setdefault(k[,d])

subset_overlapping(grid, bbox)

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

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

Attributes Documentation

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

clear() None.  Remove all items from D.
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
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
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

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

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
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.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values