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

boundary()

Iterate over points on the boundary as (y, x) tuples.

contains()

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

deserialize(serialized)

Convert a serialized bounds object into its in-memory form.

intersection(bounds)

Compute the intersection of this bounds object with another.

serialize()

Convert a bounds instance into a serializable object.

Attributes Documentation

bbox#

Methods Documentation

boundary() Iterator[YX[int]]#

Iterate over points on the boundary as (y, x) tuples.

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.

classmethod deserialize(serialized: SerializableBounds) Self#

Convert a serialized bounds object into its in-memory form.

intersection(bounds: Bounds) Bounds#

Compute the intersection of this bounds object with another.

serialize() SerializableBounds#

Convert a bounds instance into a serializable object.