mrpro.utils.normalize_indices
- mrpro.utils.normalize_indices(ndim: int, indices: int | Sequence[int] | None, *, unique: bool = True) tuple[int, ...][source]
Normalize each index in indices to the range [0, ndim).
- Parameters:
- Returns:
Tuple of normalized indices in [0, ndim).
- Raises:
IndexError – If any index is outside
[-ndim, ndim).IndexError – If unique is True and normalized indices are not unique.