nengolib.signal.shift

nengolib.signal.shift(signal, amount=1, value=0)[source]

Shift the signal amount steps, prepending with value.

Parameters:
signal : array_like

Signal to be shifted.

amount : integer, optional

Number of steps to shift. Defaults to 1.

value : array_like, optional

Value to pad along the first axis. Must be resizable according to the remaining axes. Defaults to 0.

Returns:
shifted_signal : np.array

Shifted signal, shaped according to signal.

Examples

>>> from nengolib.signal import shift
>>> a = [1, 2, 3]
>>> shift(a)
array([0, 1, 2])
>>> shift(a, 2, 4)
array([4, 4, 1])
>>> a = [[1, 2], [3, 4], [5, 6]]
>>> shift(a)
array([[0, 0],
       [1, 2],
       [3, 4]])
>>> shift(a, 2, [0, 7])
array([[0, 7],
       [0, 7],
       [1, 2]])