mrpro.utils.normalize_index

mrpro.utils.normalize_index(ndim: int, index: int) int[source]

Normalize possibly negative indices.

Parameters:
  • ndim (int) – number of dimensions

  • index (int) – index to normalize. negative indices count from the end.

Raises:

IndexError – if index is outside [-ndim,ndim)