BoxSliceFactory#

class lsst.images.BoxSliceFactory(y: ~lsst.images._geom.IntervalSliceFactory = <lsst.images._geom.IntervalSliceFactory object>, x: ~lsst.images._geom.IntervalSliceFactory = <lsst.images._geom.IntervalSliceFactory object>)#

Bases: object

A factory for Box objects using array-slice syntax.

Notes#

When Box.factory is indexed with a pair of slices, this returns a Box with exactly those bounds:

assert (
    Box.factory[3:6, -1:2]
    == Box(x=Interval(start=-1, stop=2), y=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 Box.absolute property, indices are absolute coordinate values, but any omitted bounds are replaced with the parent box’s bounds:

parent = Box.factory[3:6, -1:2]
assert Box.factory[4:5, 0:2] == parent.absolute[:5, 0:]

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

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

parent = Box.factory[3:6, -1:2]
assert Box.factory[4:5, 0:2] == parent.local[1:-1, 1:]