IntervalSliceFactory#

class lsst.images.IntervalSliceFactory(parent: Interval | None = None, is_local: bool = False)#

Bases: object

A factory for Interval objects using array-slice syntax.

Notes#

When indexed with a single slice on the Interval.factory attribute, this returns an Interval with exactly the given bounds:

assert Interval.factory[3:6] == Interval(start=3, stop=6)

A missing start bound is replaced by 0, but a missing stop bound is not allowed.

When obtained from the Interval.absolute property, indices are absolute coordinate values, but any omitted bounds are replaced with the parent interval’s bounds:

parent = Interval.factory[3:6]
assert Interval.factory[4:5] == parent.absolute[:5]

The final interval is also checked to be contained by the parent interval.

When obtained from the Interval.local property, indices are interpreted as relative to the parent interval, and negative indices are relative to the end (like Sequence indexing):

parent = Interval.factory[3:6]
assert Interval.factory[4:5] == parent.local[1:-1]

When the stop bound is greater than the size of the parent interval, the returned interval is clipped to be contained by the parent (as in Sequence indexing).