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 one or more points fall within these bounds.

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(point: XY[int | float] | YX[int | float], /) bool#
contains(point: XY[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]] | YX[Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]], /) ndarray
contains(*, x: int | float, y: int | float) bool
contains(*, x: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], y: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) ndarray

Test whether one or more points fall within these bounds.

Parameters#

point

An XY or YX coordinate pair to test for containment. Mutually exclusive with x and y.

x

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

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#

bool | numpy.ndarray

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.

intersection(other: Bounds) Bounds#

Compute the intersection of this bounds object with another.

Parameters#

other

Bounds to intersect with this one.

serialize() BoundsSerializationModel#

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.