scipy.fft.

ifftshift#

scipy.fft.ifftshift(x, axes=None)[source]#

The inverse of fftshift. Although identical for even-length x, the functions differ by one sample for odd-length x.

Parameters:
xarray_like

Input array.

axesint or shape tuple, optional

Axes over which to calculate. Defaults to None, which shifts all axes.

Returns:
yndarray

The shifted array.

See also

fftshift

Shift zero-frequency component to the center of the spectrum.

Notes

Array API Standard Support

ifftshift has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

Library

CPU

GPU

NumPy

n/a

CuPy

n/a

PyTorch

JAX

Dask

n/a

See Support for the array API standard for more information.

Examples

>>> import numpy as np
>>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3)
>>> freqs
array([[ 0.,  1.,  2.],
       [ 3.,  4., -4.],
       [-3., -2., -1.]])
>>> np.fft.ifftshift(np.fft.fftshift(freqs))
array([[ 0.,  1.,  2.],
       [ 3.,  4., -4.],
       [-3., -2., -1.]])