LSST Applications
21.0.0+04719a4bac,21.0.0-1-ga51b5d4+4b710797af,21.0.0-1-gfc31b0f+3b24369756,21.0.0-10-g2408eff+50e97f2f47,21.0.0-10-g560fb7b+0803ad37c5,21.0.0-10-g5daeb2b+f9b8dc6d5a,21.0.0-10-g8d1d15d+77a6b82ebf,21.0.0-10-gcf60f90+c961be884d,21.0.0-11-g25eff31+7692554667,21.0.0-17-g6590b197+a14a01c114,21.0.0-2-g103fe59+b79afc2051,21.0.0-2-g1367e85+1003a3501c,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+1003a3501c,21.0.0-2-g7f82c8f+c2a1919b98,21.0.0-2-g8f08a60+fd0b970de5,21.0.0-2-ga326454+c2a1919b98,21.0.0-2-gde069b7+ca45a81b40,21.0.0-2-gecfae73+afcaaec585,21.0.0-2-gfc62afb+1003a3501c,21.0.0-21-g5d80ea29e+5e3c9a3766,21.0.0-3-g357aad2+c67f36f878,21.0.0-3-g4be5c26+1003a3501c,21.0.0-3-g65f322c+02b1f88459,21.0.0-3-g7d9da8d+3b24369756,21.0.0-3-ge02ed75+a423c2ae7a,21.0.0-4-g591bb35+a423c2ae7a,21.0.0-4-g65b4814+0803ad37c5,21.0.0-4-g88306b8+199c7497e5,21.0.0-4-gccdca77+a631590478,21.0.0-4-ge8a399c+b923ff878e,21.0.0-5-gd00fb1e+d8b1e95daa,21.0.0-53-ge728e5d5+3cb64fea8e,21.0.0-6-g2d4f3f3+04719a4bac,21.0.0-7-g04766d7+8d320c19d5,21.0.0-7-g98eecf7+205433fbda,21.0.0-9-g39e06b5+a423c2ae7a,master-gac4afde19b+a423c2ae7a,w.2021.11
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.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.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.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.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.slicing.supportSlicing | ( | cls | ) |
Support image slicing
Definition at line 265 of file slicing.py.
def lsst.afw.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.slicing.clone |
Definition at line 278 of file slicing.py.
lsst.afw.image.slicing.Factory |
Definition at line 273 of file slicing.py.