Bounds#

class lsst.images.Bounds(*args, **kwargs)#

Bases: Protocol

A protocol for objects that represent the validity region for a function defined in 2-d pixel coordinates.

Notes#

Most objects natively have a simple 2-d bounding box as their bounds (typically the boundary of a sensor), and the Box class is hence the most common bounds implementation. But sometimes a large chunk of that box may be missing due to vignetting or bad amplifiers, and we may want to transform from one coordinate system to another. The Bounds interface is intended to handle both of these cases as well.

Attributes Summary

Methods Summary

contains()

Test whether this box fully contains another or one or more points.

intersection(other)

Compute the intersection of this bounds object with another.

serialize()

Convert a bounds instance into a serializable object.

Attributes Documentation

bbox#

Methods Documentation

contains(*, x: int, y: int) bool#
contains(*, x: ndarray, y: ndarray) ndarray

Test whether this box fully contains another or one or more points.

Parameters#

x

One or more integer X coordinates to test for containment. If an array, an array of results will be returned.

y

One or more integer Y coordinates to test for containment. If an array, an array of results will be returned.

Returns#

bool | numpy.ndarray

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

intersection(other: Bounds) Bounds#

Compute the intersection of this bounds object with another.

serialize() SerializableBounds#

Convert a bounds instance into a serializable object.

Notes#

The returned object must support direct nesting with Pydantic models and have a deserialize method (taking no arguments) that converts back to this Bounds type. It is common for serialize and deserialize to just return self, when the bounds object is natively serializable.