prtools.shift#
- shift(a, shift)[source]#
Shift an array via FFT.
Shift an array by (row, column). The shifts may be non-integer as the shift operation is implemented by introducing a Fourier-domain tilt. If
a
is complex, the result will also be complex.- Parameters:
a (array_like) – The input array.
shift ((2,) sequence) – The shift specified as (row, column).
- Returns:
shifted – The shifted input array.
- Return type:
ndarray
Example
>>> arr = np.zeros((3,3)) >>> arr[2,2] = 1 >>> arr array([[0., 0., 0.], [0., 0., 0.], [0., 0., 1.]]) >>> arr_shift = prtools.shift(arr, shift=(-1,-1)) >>> arr_shift array([[ 0.00000000e+00, -7.40148683e-17, -2.46716228e-17], [-1.16747372e-16, 1.00000000e+00, 2.14548192e-16], [-3.12823642e-17, 2.22044605e-16, -4.18468327e-17]])