Bounds#
- class lsst.images.Bounds(*args, **kwargs)#
Bases:
ProtocolA 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
Boxclass 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.
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
XYorYXcoordinate pair to test for containment. Mutually exclusive withxandy.- x
One or more X coordinates to test for containment, as a scalar or any array-like. Results are broadcast against
y. Mutually exclusive withpoint.- y
One or more Y coordinates to test for containment, as a scalar or any array-like. Results are broadcast against
x. Mutually exclusive withpoint.
Returns#
bool|numpy.ndarrayIf
xandyare both scalars, a singleboolvalue. Ifxandyare 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
deserializemethod (taking no arguments) that converts back to thisBoundstype. It is common forserializeanddeserializeto just returnself, when the bounds object is natively serializable.