LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
Functions | |
def | splitSliceArgs (sliceArgs) |
def | handleNegativeIndex (index, size, origin, default) |
def | translateSliceArgs (sliceArgs, bboxGetter) |
def | interpretSliceArgs (sliceArgs, bboxGetter) |
def | imageIndicesToNumpy (sliceArgs, bboxGetter) |
def | supportSlicing (cls) |
Variables | |
Factory | |
clone | |
def lsst.afw.image.image._slicing.handleNegativeIndex | ( | index, | |
size, | |||
origin, | |||
default | |||
) |
Handle negative indices passed to image accessors. When negative indices are used in LOCAL coordinates, we interpret them as relative to the upper bounds of the array, as in regular negative indexing in Python. Using negative indices in PARENT coordinates is not allowed unless passed via a `Point2I` or `Box2I`; the potential for confusion between actual negative indices (when ``xy0 < 0``) and offsets relative to the upper bounds of the array is too great. Parameters ---------- index : `int` or `None` 1-d pixel index to interpret, as given by a caller to an image-like object's ``__getitem__`` or ``__setitem__``. size : `int` Size of the image in the dimension corresponding to ``index``. origin : `ImageOrigin` Enum value that sets whether or not to consider xy0 in positions. default : `int` Index to return if `index` is None. Returns ------- index : `int` If ``origin==PARENT``, either the given ``index`` or ``default``. If ``origin==LOCAL``, an equivalent index guaranteed to be nonnegative. Intended primarily for internal use by `supportSlicing()`.
Definition at line 65 of file _slicing.py.
def lsst.afw.image.image._slicing.imageIndicesToNumpy | ( | sliceArgs, | |
bboxGetter | |||
) |
Convert slicing format to numpy LSST `afw` image-like objects use an `[x,y]` coordinate convention, accept `Point2I` and `Box2I` objects for slicing, and slice relative to the bounding box `XY0` location; while python and numpy use the convention `[y,x]` with no `XY0`, so this method converts the `afw` indices or slices into numpy indices or slices Parameters ---------- sliceArgs: `sequence`, `Point2I` or `Box2I` An `(xIndex, yIndex)` pair, or a single `(xIndex,)` tuple, where `xIndex` and `yIndex` can be a `slice` or `int`, or list of `int` objects, and if only a single `xIndex` is given, a `Point2I` or `Box2I`. bboxGetter : callable Callable that accepts an ImageOrigin enum value and returns the appropriate image bounding box. Usually the bound getBBox method of an Image, Mask, or MaskedImage object. Returns ------- y: `int` or `slice` Index or `slice` in the y dimension x: `int` or `slice` Index or `slice` in the x dimension bbox: `Box2I` Bounding box of the image. If `bbox` is `None` then the result is a point and not a subset of an image.
Definition at line 202 of file _slicing.py.
def lsst.afw.image.image._slicing.interpretSliceArgs | ( | sliceArgs, | |
bboxGetter | |||
) |
Transform arguments to __getitem__ or __setitem__ to a standard form. Parameters ---------- sliceArgs : `tuple`, `Box2I`, or `Point2I` Slice arguments passed directly to `__getitem__` or `__setitem__`. bboxGetter : callable Callable that accepts an ImageOrigin enum value and returns the appropriate image bounding box. Usually the bound getBBox method of an Image, Mask, or MaskedImage object. Returns ------- x : int or slice Index or slice in the x dimension y : int or slice Index or slice in the y dimension origin : `ImageOrigin` Either `PARENT` (coordinates respect XY0) or LOCAL (coordinates do not respect XY0)
Definition at line 147 of file _slicing.py.
def lsst.afw.image.image._slicing.splitSliceArgs | ( | sliceArgs | ) |
Separate the actual slice from origin arguments to __getitem__ or __setitem__, using PARENT for the origin if it is not provided. Parameter --------- sliceArgs : `tuple`, `Box2I`, or `Point2I` The first argument passed to an image-like object's ``__getitem__`` or ``__setitem__``. Returns ------- sliceArgs : `tuple`, `Box2I`, or `Point2I` The original sliceArgs passed in, with any ImageOrigin argument stripped off. origin : `ImageOrigin` Enum value that sets whether or not to consider xy0 in positions. See interpretSliceArgs for more information. Intended primarily for internal use by `supportSlicing()`.
Definition at line 28 of file _slicing.py.
def lsst.afw.image.image._slicing.supportSlicing | ( | cls | ) |
Support image slicing
Definition at line 265 of file _slicing.py.
def lsst.afw.image.image._slicing.translateSliceArgs | ( | sliceArgs, | |
bboxGetter | |||
) |
Transform a tuple of slice objects into a Box2I, correctly handling negative indices. see `interpretSliceArgs` for a description of parameters Returns ------- box : `Box2I` or `None` A box to use to create a subimage, or None if the slice refers to a scalar. index: `tuple` or `None` An ``(x, y)`` tuple of integers, or None if the slice refers to a box. origin : `ImageOrigin` Enum indicating whether to account for xy0.
Definition at line 111 of file _slicing.py.
lsst.afw.image.image._slicing.clone |
Definition at line 278 of file _slicing.py.
lsst.afw.image.image._slicing.Factory |
Definition at line 273 of file _slicing.py.