HTTP/1.1 301 Moved Permanently
Date: Tue, 22 Jul 2025 18:16:14 GMT
Server: Apache/2.4.39 (Ubuntu)
Location: https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html
Content-Length: 361
Content-Type: text/html; charset=iso-8859-1
HTTP/2 200
date: Tue, 22 Jul 2025 18:16:15 GMT
content-type: text/html; charset=utf-8
server: cloudflare
x-origin-cache: HIT
last-modified: Mon, 30 Jun 2025 16:50:36 GMT
access-control-allow-origin: *
expires: Tue, 22 Jul 2025 18:26:15 GMT
cache-control: max-age=600
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=Yj8ZN22Ok57a3BnNmCdKzyNH72zgnGbFGqG00D9PwcxmyhU7HtpMN5%2B%2BL2ZhAuw1d16JXXiMH4VCOsUUdypL3uPzx6tOshWUHQ%3D%3D"}]}
x-proxy-cache: MISS
x-github-request-id: B71A:36FAE8:26A2:2DA3:687FD569
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210085-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753208175.986020,VS0,VE217
vary: Accept-Encoding
x-fastly-request-id: cf80d68e5b481e4653cc868b0c0b86a608fe7147
cf-cache-status: DYNAMIC
content-encoding: gzip
cf-ray: 9634ed955f943b15-BOM
alt-svc: h3=":443"; ma=86400
numpy.fft.fftshift — NumPy v2.3 Manual
numpy.fft.fftshift
-
fft.fftshift(x, axes=None)[source]
Shift the zero-frequency component to the center of the spectrum.
This function swaps half-spaces for all axes listed (defaults to all).
Note that y[0]
is the Nyquist component only if len(x)
is even.
- Parameters:
- xarray_like
Input array.
- axesint or shape tuple, optional
Axes over which to shift. Default is None, which shifts all axes.
- Returns:
- yndarray
The shifted array.
Examples
>>> import numpy as np
>>> freqs = np.fft.fftfreq(10, 0.1)
>>> freqs
array([ 0., 1., 2., ..., -3., -2., -1.])
>>> np.fft.fftshift(freqs)
array([-5., -4., -3., -2., -1., 0., 1., 2., 3., 4.])
Shift the zero-frequency component only along the second axis:
>>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3)
>>> freqs
array([[ 0., 1., 2.],
[ 3., 4., -4.],
[-3., -2., -1.]])
>>> np.fft.fftshift(freqs, axes=(1,))
array([[ 2., 0., 1.],
[-4., 3., 4.],
[-1., -3., -2.]])