HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/fft/tests/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/fft/tests/__pycache__/test_helper.cpython-36.pyc
3

���hG�@sddZddlZddlmZddlmZmZGdd�d�ZGdd�d�ZGd	d
�d
�Z	Gdd�d�Z
dS)
zfTest functions for fftpack.helper module

Copied from fftpack.helper by Pearu Peterson, October 2005

�N)�assert_array_almost_equal)�fft�pic@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestFFTShiftc
Cs�dddddddd	d
g	}ddd
ddddddg	}ttj|�|�ttj|�|�ddddddddddg
}ddddddddddg
}ttj|�|�ttj|�|�dS)Nr�����������������rrr
r���rrr
rrrrr
r)rr�fftshift�	ifftshift)�self�x�y�r�</tmp/pip-build-5_djhm0z/numpy/numpy/fft/tests/test_helper.py�test_definition
szTestFFTShift.test_definitioncCs6x0dD](}tjj|f�}ttjtj|��|�qWdS)Nrr	�	�d��)rr	rrr)�np�randomrrrr)r�nrrrr�test_inverses
zTestFFTShift.test_inversecCs�dddgdddgdd	d
gg}ddd
gdddgdddgg}ttj|dd�|�ttj|dd�tj|dd��ttj|dd�|�ttj|dd�tj|dd��ttj|�|�ttj|�|�dS)Nrrrrr	)�axesrrr
rrrr
r)rr)r)rr)r)rrrr)r�freqsZshiftedrrr�test_axes_keywordszTestFFTShift.test_axes_keywordcCsvddgddgddgg}ddgddgddgg}ttj|dd�|�ttj|dd�|�ttj|d	d�|�ttj|dgd�|�ddgddgddgg}ttj|dd�|�ttj|dd�|�ddgddgddgg}ttj|d
d�|�ttj|dd�|�ttj|ddgd�|�ttj|ddgd�|�ttj|dd�|�ttj|dd�|�ttj|�|�ttj|�|�dS)z1 Test 2D input, which has uneven dimension sizes rrrrr	r
)rN)r)rr)rr)rrrr)rr Z
shift_dim0Z
shift_dim1Zshift_dim_bothrrr�test_uneven_dims)s4



zTestFFTShift.test_uneven_dimscs�ddlm�ddlm�m�m�m�d�����fdd�	}d�����fdd�	}xntd	�D]b}x\td	�D]P}xJdD]B}tj	j
||�}ttj
||�|||��ttj||�|||��qrWqhWqZWdS)z\ Test that the new (>=v1.15) implementation (see #10073) is equal to the original (<=v1.14) r)�
integer_types)�asarray�concatenate�arange�takeNc	s��|�}|j}|dkr$tt|��}nt|��r4|f}|}xD|D]<}|j|}|dd}��||��|�f�}�|||�}q>W|S)z& How fftshift was implemented in v1.14Nrr)�ndim�list�range�
isinstance�shape)	rr�tmpr(r�kr�p2�mylist)r&r$r%r#r'rr�original_fftshift[s


z>TestFFTShift.test_equal_to_original.<locals>.original_fftshiftc	s��|�}|j}|dkr$tt|��}nt|��r4|f}|}xH|D]@}|j|}||dd}��||��|�f�}�|||�}q>W|S)z( How ifftshift was implemented in v1.14 Nrr)r(r)r*r+r,)	rrr-r(rr.rr/r0)r&r$r%r#r'rr�original_ifftshiftks


z?TestFFTShift.test_equal_to_original.<locals>.original_ifftshift�r)N)N�r�rr)rrNr4r5)Znumpy.compatr#Z
numpy.corer$r%r&r'r*rrZrandrrrr)rr1r2�i�jZaxes_keyword�inpr)r&r$r%r#r'r�test_equal_to_originalVs
z#TestFFTShift.test_equal_to_originalN)�__name__�
__module__�__qualname__rrr!r"r9rrrrrs


-rc@seZdZdd�ZdS)�TestFFTFreqc
Cs�dddddd	d
ddg	}tdtjd�|�tdttjdt�|�dddddd
ddddg
}tdtjd�|�tdttjdt�|�dS)Nrrrrr	rr
�
rrr
rrrrr
r)rrZfftfreqr)rrrrrr�szTestFFTFreq.test_definitionN)r:r;r<rrrrrr=�sr=c@seZdZdd�ZdS)�TestRFFTFreqcCs~dddddg}tdtjd�|�tdttjdt�|�ddddddg}tdtjd�|�tdttjdt�|�dS)	Nrrrrr	rr
r>)rrZrfftfreqr)rrrrrr�szTestRFFTFreq.test_definitionN)r:r;r<rrrrrr?�sr?c@seZdZdd�ZdS)�
TestIRFFTNcCs2tjjd�\}}|d|}d	}tj||d�dS)
Nrr3�� y�?)r)rr3rArBr
)r
)rrrZirfftn)r�arZai�arrrr�test_not_last_axis_success�sz%TestIRFFTN.test_not_last_axis_successN)r:r;r<rErrrrr@�sr@)�__doc__ZnumpyrZ
numpy.testingrrrrr=r?r@rrrr�<module>s~