spiketools.utils.checks.check_axis

spiketools.utils.checks.check_axis(axis, arr)[source]

Check axis argument, and infer from array orientation if not defined.

Parameters:
axis{None, 0, 1, -1}

Axis argument. If not None, this value is returned. If None, the given array is checked to infer axis.

arrndarray or list of ndarray

Array to check the axis argument for.

Returns:
axis{0, 1, -1}

Axis argument. For 1d array, 0 is returned, reflecting a vector. For 2d array, 0 is for column, and 1 is for row. If the axis could not be inferred, -1 is returned.