simplify_basic_index#
- astropy.utils.shapes.simplify_basic_index(basic_index: int | slice | Sequence[int | slice | EllipsisType | None], *, shape: Sequence[int]) tuple[int | slice, ...] [source]#
Given a Numpy basic index, return a tuple of integers and slice objects with no default values (
None
) if possible.If one of the dimensions has a slice and the step is negative and the stop value of the slice was originally
None
, the new stop value of the slice may still be set toNone
.For more information on valid basic indices, see https://numpy.org/doc/stable/user/basics.indexing.html#basic-indexing
- Parameters:
- basic_index
A valid Numpy basic index
- shape
The shape of the array being indexed