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([point, x, y])

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=None, /, *, x=None, y=None)#

Test whether one or more points fall within these bounds.

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 (int | float | TypeAliasType | None, 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 (int | float | TypeAliasType | None, 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

intersection(other)#

Compute the intersection of this bounds object with another.

Parameters:

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

Return type:

Bounds

serialize()#

Convert a bounds instance into a serializable object.

Return type:

TypeAliasType

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.

This page was last modified on .