/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/fft/__pycache__
Edit: /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/fft/__pycache__/helper.cpython-311.pyc (8421B)
f
d Z ddlmZmZmZmZmZ ddlmZm Z g dZ
eefZddZ
ee
d dd Z ee
d dd
Z e d dd Z e d dd
ZdS )z*
Discrete Fourier Transforms - helper.py
)integeremptyarangeasarrayroll)array_function_dispatch
set_module)fftshift ifftshiftfftfreqrfftfreqNc | fS N )xaxess E/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/fft/helper.py_fftshift_dispatcherr s
4K z numpy.fft)modulec t |3t t j }d j D }n4t |t r j | dz }n fd|D }t || S )ad
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
----------
x : array_like
Input array.
axes : int or shape tuple, optional
Axes over which to shift. Default is None, which shifts all axes.
Returns
-------
y : ndarray
The shifted array.
See Also
--------
ifftshift : The inverse of `fftshift`.
Examples
--------
>>> 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.]])
Nc g | ]}|d z S r .0dims r
zfftshift..C s ---c---r r c 0 g | ]}j | d z S r shaper axr s r r zfftshift..G s$ 111b!111r r tuplerangendimr!
isinstance
integer_typesr r r shifts ` r r
r
s Z
A|U16]]##--QW--- D- ( ( 2
"1111D1115$r c t |3t t j }d j D }n5t |t r j | dz }n fd|D }t || S )a/
The inverse of `fftshift`. Although identical for even-length `x`, the
functions differ by one sample for odd-length `x`.
Parameters
----------
x : array_like
Input array.
axes : int or shape tuple, optional
Axes over which to calculate. Defaults to None, which shifts all axes.
Returns
-------
y : ndarray
The shifted array.
See Also
--------
fftshift : Shift zero-frequency component to the center of the spectrum.
Examples
--------
>>> 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.]])
Nc g | ]}|d z S r r r s r r zifftshift..r s 0003!8000r r c 2 g | ]}j | d z S r r r" s r r zifftshift..v s' 444172;!#$444r r$ r* s ` r r r L s F
A|U16]]##00000 D- ( ( 5'$-1$%4444t4445$r ?c $ t | t st d d| |z z }t | t }| dz
dz dz }t d|t }||d|<