nlcpy.rollaxis

nlcpy.rollaxis(a, axis, start=0)[source]

Rolls the specified axis backwards, until it lies in a given position.

This function is implemented for backward compatibility of numpy. You should use moveaxis().

Parameters
andarray

Input array.

axisint

The axis to roll backwards. The positions of the other axes do not change relative to one another.

startint, optional

The axis is rolled until it lies before this position. The default, 0, results in a “complete” roll.

Returns
resndarray

Array with moved axes. This array is a view of the input array.

See also

moveaxis

Moves axes of an array to new positions.

Examples

>>> import nlcpy as vp
>>> a = vp.ones((3,4,5,6))
>>> vp.rollaxis(a, 3, 1).shape
(3, 6, 4, 5)
>>> vp.rollaxis(a, 2).shape
(5, 3, 4, 6)
>>> vp.rollaxis(a, 1, 4).shape
(3, 5, 6, 4)