get_axis#

pybrops.core.util.array.get_axis(axis, ndim)[source]#

Return an index (unsigned) from a provided axis integer (signed)

Parameters:
  • axis (int) – Integer representation of the axis. Can be in range (-ndim,ndim). If outside this range, will raise an AxisError.

  • ndim (int) – Number of dimensions available to index along.

Returns:

index – Index representation of the axis. In range [0,ndim).

Return type:

int