simplify_basic_index#

astropy.utils.shapes.simplify_basic_index(basic_index, *, shape)[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 to None.

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. Entries can be None if the size along a dimension is not known, in which case the index for that dimension is returned unchanged, except that a negative integer for slice start raises an error since it cannot be interpreted.