fftshift

fftshift(x: array, /, *, axes: int | Sequence[int] | None = None) array

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

This function swaps half-spaces for all axes (dimensions) specified by axes.

Note

out[0] is the Nyquist component only if the length of the input is even.

Parameters:
  • x (array) – input array. Should have a floating-point data type.

  • axes (Optional[Union[int, Sequence[int]]]) –

    axes over which to shift. If None, the function must shift all axes. Default: None.

    If axes contains two or more entries which resolve to the same axis (i.e., resolved axes are not unique), the behavior is unspecified and thus implementation-defined.

Returns:

out (array) – the shifted array. The returned array must have the same data type and shape as x.

Notes

New in version 2022.12.