fftshift

Contents

fftshift#

class saiunit.fft.fftshift(x, axes=None, **kwargs)#

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

Unit-aware implementation of numpy.fft.fftshift(). The unit of the input is preserved in the output.

Parameters:
  • x (Quantity | Array | ndarray | bool | number | bool | int | float | complex) – N-dimensional input whose zero-frequency components should be shifted to the centre.

  • axes (None | int | Sequence[int]) – Axes over which to shift. If None (default), all axes are shifted.

Returns:

A shifted copy of x with the same unit.

Return type:

Quantity | Array | ndarray | bool | number | bool | int | float | complex

See also

saiunit.fft.ifftshift

Inverse of fftshift.

saiunit.fft.fftfreq

Return sample frequencies for the DFT.

Examples

>>> import saiunit as u
>>> import saiunit.fft as sufft
>>> freq = sufft.fftfreq(4, 1.0 * u.second)
>>> shifted = sufft.fftshift(freq)
>>> recovered = sufft.ifftshift(shifted)