utilities.arrays.normalize_index#

utilities.arrays.normalize_index(index: int, axis_size: int) int[source]#

Coerce a possibly negative index into a valid non-negative index.

Parameters:
  • index (int) – Index to normalize (may be negative).

  • axis_size (int) – Size of the axis the index refers to.

Returns:

Equivalent non-negative index.

Return type:

int