fftshift¶
- paddle.fft. fftshift ( x, axes=None, name=None ) [source]
-
Shift the zero-frequency component to the center of the spectrum.
This function swaps half spaces for all the axes listed (all by default). Note that
y[0]
is the Nyquist component only iflen(x)
is even.- Parameters
-
n (int) – Dimension inputed.
axes (int|tuple, optional) – The axis on which to move. The default is none, which moves all axes. Default is None.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
- Returns
-
Tensor. The shifted tensor.
Examples
import paddle fftfreq_xp = paddle.fft.fftfreq(5, d=0.3) print(fftfreq_xp) # Tensor(shape=[5], dtype=float32, place=Place(gpu:0), stop_gradient=True, # [ 0. , 0.66666669, 1.33333337, -1.33333337, -0.66666669]) res = paddle.fft.fftshift(fftfreq_xp) print(res) # Tensor(shape=[5], dtype=float32, place=Place(gpu:0), stop_gradient=True, # [-1.33333337, -0.66666669, 0. , 0.66666669, 1.33333337])