module documentation

Helper functions for axes operations on numpy arrays.

Axes referrs to the indexed dimensions of a numpy array. I.e., a.ndim is the number of dimensions in a, and also the number of axes. a.shape is the length of each axis.

Class AxesOrdering A class that can shift between numpy, fits, and fotran axes ordering
Function iter_axes_group Iterate over a group of axes
Function merge Merge a set of axes into a single axis.
Function not_in Returns the axes of a that are not in group
Function reverse Reverse the axes of a
Function to_end Reorders the axes of a so that the axes specified in the axes tuple are at the end (rhs) of the ordering for purposes of slicing and indexing.
Function to_start Reorders the axes of 'a' so the axes specified in the 'axes' tuple are at the start (lhs) of the ordering for slicing and indexing
Variable _lgr Undocumented
def iter_axes_group(a: np.ndarray, axes: tuple[int, ...]):

Iterate over a group of axes

def merge(a: np.ndarray, axes: tuple[int, ...], axis: int = 0):

Merge a set of axes into a single axis.

a : np.ndarray
Numpy array to group axes of
axes : tuple[int:...]
axes to group together
axis : int
location of the final grouped axis
def not_in(a: np.ndarray, group: tuple[int, ...]) -> tuple[int, ...]:

Returns the axes of a that are not in group

def reverse(a: np.ndarray):

Reverse the axes of a

@contextmanager
def to_end(a: np.ndarray, axes: tuple[int, ...]):

Reorders the axes of a so that the axes specified in the axes tuple are at the end (rhs) of the ordering for purposes of slicing and indexing.

@contextmanager
def to_start(a: np.ndarray, axes: tuple[int, ...]):

Reorders the axes of 'a' so the axes specified in the 'axes' tuple are at the start (lhs) of the ordering for slicing and indexing

_lgr =

Undocumented