YX#

class lsst.images.YX(y: T, x: T)#

Bases: NamedTuple, Generic

A pair of per-dimension objects, ordered (y, x).

Notes#

YX is used for slices, shapes, and other 2-d pairs when the most natural ordering is (y, x). Because it is a tuple, however, arithmetic operations behave as they would on a collections.abc.Sequence, not a mathematical vector (e.g. adding concatenates).

In Pydantic models YX is serialized as a JSON object with y and x keys rather than an array, so the dimension order is explicit in the serialized form. Validation also accepts a two-element [y, x] array, the form emitted before the object form was introduced and still present in files that cannot be rewritten. Pydantic only invokes the schema hooks that provide this for bare YX annotations, however, because it handles parameterized named tuples specially; model fields that need a member type (e.g. YX[int]) must be annotated with SerializableYX instead.

See Also#

XY

Attributes Summary

x

The x / column object.

xy

A tuple of the same objects in the opposite order.

y

The y / row object.

Methods Summary

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

map(func)

Apply a function to both objects.

to_legacy_float_extent()

Convert to a legacy lsst.geom.Extent2D object.

to_legacy_float_point()

Convert to a legacy lsst.geom.Point2D object.

to_legacy_int_extent()

Convert to a legacy lsst.geom.Extent2I object.

to_legacy_int_point()

Convert to a legacy lsst.geom.Point2I object.

Attributes Documentation

x: T#

The x / column object.

xy#

A tuple of the same objects in the opposite order.

y: T#

The y / row object.

Methods Documentation

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

map(func: Callable[[T], U]) YX#

Apply a function to both objects.

Parameters#

func

Callable applied to each of the two objects in turn.

to_legacy_float_extent() LegacyExtent2D#

Convert to a legacy lsst.geom.Extent2D object.

to_legacy_float_point() LegacyPoint2D#

Convert to a legacy lsst.geom.Point2D object.

to_legacy_int_extent() LegacyExtent2I#

Convert to a legacy lsst.geom.Extent2I object.

to_legacy_int_point() LegacyPoint2I#

Convert to a legacy lsst.geom.Point2I object.