Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/numpy/fft/__pycache__/helper.cpython-37.pyc
Назад
B �5�g � @ s� d Z ddlmZmZmZmZmZ ddlmZm Z ddddgZ eefZdd d �Z ee dd�dd d��Zee dd�ddd��Ze d�ddd��Ze d�ddd��ZdS )z* Discrete Fourier Transforms - helper.py � )�integer�empty�arange�asarray�roll)�array_function_dispatch� set_module�fftshift� ifftshift�fftfreq�rfftfreqNc C s | fS )N� )�x�axesr r �F/home/digitalm-up/venv/lib/python3.7/site-packages/numpy/fft/helper.py�_fftshift_dispatcher s r z numpy.fft)�modulec sh t � �� |dkr0tt� j��}dd� � jD �}n,t|t�rJ� j| d }n� fdd�|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 S s g | ]}|d �qS )� r )�.0�dimr r r � <listcomp>C s zfftshift.<locals>.<listcomp>r c s g | ]}� j | d �qS )r )�shape)r �ax)r r r r G s )r �tuple�range�ndimr � isinstance� integer_typesr )r r �shiftr )r r r s - c sj t � �� |dkr0tt� j��}dd� � jD �}n.t|t�rL� j| d }n� fdd�|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 S s g | ]}|d �qS )r r )r r r r r r r s zifftshift.<locals>.<listcomp>r c s g | ]}� j | d �qS )r )r )r r )r r r r v s )r r r r r r r r )r r r r )r r r L s # � �?c C sz t | t�std��d| | }t| t�}| d d d }td|td�}||d|�<