Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_helper.cpython-313.pyc184 linesDownload Raw Back to __pycache__
1�

2z�jn����SrSSKJrJrJrJrJr SSKJrJ	r	 /SQr3\\4rS
Sjr
\"\
SS9S
S	j5r\"\
SS9S
S4j5r\	"S5SSj5r\	"S5SSj5rg)z+5Discrete Fourier Transforms - _helper.py6 7�)�arange�asarray�empty�integer�roll)�array_function_dispatch�8set_module)�fftshift�	ifftshift�fftfreq�rfftfreqNc��U4$�N�)�x�axess  �WD:\code\apps\devtools\python\user_packages\Python313\site-packages\numpy/fft/_helper.py�_fftshift_dispatcherrs	��
�4�K�z	numpy.fft)�modulec�V�[U5nUc=[[UR55nURVs/sHo"S-PM	 nnOI[U[5(aURUS-nO!UVs/sHo@RUS-PM nn[XU5$s snfs snf)a�9Shift the zero-frequency component to the center of the spectrum.10 11This function swaps half-spaces for all axes listed (defaults to all).12Note that ``y[0]`` is the Nyquist component only if ``len(x)`` is even.13 14Parameters15----------16x : array_like17    Input array.18axes : int or shape tuple, optional19    Axes over which to shift.  Default is None, which shifts all axes.20 21Returns22-------23y : ndarray24    The shifted array.25 26See Also27--------28ifftshift : The inverse of `fftshift`.29 30Examples31--------32>>> import numpy as np33>>> freqs = np.fft.fftfreq(10, 0.1)34>>> freqs35array([ 0.,  1.,  2., ..., -3., -2., -1.])36>>> np.fft.fftshift(freqs)37array([-5., -4., -3., -2., -1.,  0.,  1.,  2.,  3.,  4.])38 39Shift the zero-frequency component only along the second axis:40 41>>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3)42>>> freqs43array([[ 0.,  1.,  2.],44       [ 3.,  4., -4.],45       [-3., -2., -1.]])46>>> np.fft.fftshift(freqs, axes=(1,))47array([[ 2.,  0.,  1.],48       [-4.,  3.,  4.],49       [-1., -3., -2.]])50 51��r�tuple�range�ndim�shape�52isinstance�
integer_typesr�rr�dim�shift�axs     rr53r54s���\	��55�A��|��U�1�6�6�]�#��%&�W�W�-�W�c���W��-��	�D�-�	(�	(�����
��"��,0�1�D�b������!�D��1���$����
.��2s�B!�8B&c�\�[U5nUc>[[UR55nURVs/sHo"S-*PM56 nnOK[U[5(aURUS-*nO"UVs/sHo@RUS-*PM nn[XU5$s snfs snf)a�57The inverse of `fftshift`. Although identical for even-length `x`, the58functions differ by one sample for odd-length `x`.59 60Parameters61----------62x : array_like63    Input array.64axes : int or shape tuple, optional65    Axes over which to calculate.  Defaults to None, which shifts all axes.66 67Returns68-------69y : ndarray70    The shifted array.71 72See Also73--------74fftshift : Shift zero-frequency component to the center of the spectrum.75 76Examples77--------78>>> import numpy as np79>>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3)80>>> freqs81array([[ 0.,  1.,  2.],82       [ 3.,  4., -4.],83       [-3., -2., -1.]])84>>> np.fft.ifftshift(np.fft.fftshift(freqs))85array([[ 0.,  1.,  2.],86       [ 3.,  4., -4.],87       [-3., -2., -1.]])88 89rrr s     rrrMs���H	��90�A��|��U�1�6�6�]�#��()���0���!�8����0��	�D�-�	(�	(��'�'�$�-�1�$�%��/3�4�t��7�7�2�;�!�#�$�t��4���$����
1��5s�B$�:B)c���[U[5(d[S5eSX--n[U[US9nUS-91S-S-n[SU[US9nXdSU&[US-*S[US9nXtUS&XC-$)	a�92Return the Discrete Fourier Transform sample frequencies.93 94The returned float array `f` contains the frequency bin centers in cycles95per unit of the sample spacing (with zero at the start).  For instance, if96the sample spacing is in seconds, then the frequency unit is cycles/second.97 98Given a window length `n` and a sample spacing `d`::99 100  f = [0, 1, ...,   n/2-1,     -n/2, ..., -1] / (d*n)   if n is even101  f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (d*n)   if n is odd102 103Parameters104----------105n : int106    Window length.107d : scalar, optional108    Sample spacing (inverse of the sampling rate). Defaults to 1.109device : str, optional110    The device on which to place the created array. Default: ``None``.111    For Array-API interoperability only, so must be ``"cpu"`` if passed.112 113    .. versionadded:: 2.0.0114 115Returns116-------117f : ndarray118    Array of length `n` containing the sample frequencies.119 120Examples121--------122>>> import numpy as np123>>> signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5], dtype=float)124>>> fourier = np.fft.fft(signal)125>>> n = signal.size126>>> timestep = 0.1127>>> freq = np.fft.fftfreq(n, d=timestep)128>>> freq129array([ 0.  ,  1.25,  2.5 , ..., -3.75, -2.5 , -1.25])130 131�n should be an integer��?)�device�rr��dtyper(N)rr�132ValueErrorr�intr)�n�dr(�val�results�N�p1�p2s        rrr}s���V�a��'�'��1�2�2�133
���-�C��A�s�6�*�G�	134�Q��1��q��A�	��1�C��	/�B��B�Q�K�	�!�q�&�	�1�C��	7�B��A�B�K��=�rc��[U[5(d[S5eSX--nUS-S-n[SU[US9nXS-$)a�135Return the Discrete Fourier Transform sample frequencies136(for usage with rfft, irfft).137 138The returned float array `f` contains the frequency bin centers in cycles139per unit of the sample spacing (with zero at the start).  For instance, if140the sample spacing is in seconds, then the frequency unit is cycles/second.141 142Given a window length `n` and a sample spacing `d`::143 144  f = [0, 1, ...,     n/2-1,     n/2] / (d*n)   if n is even145  f = [0, 1, ..., (n-1)/2-1, (n-1)/2] / (d*n)   if n is odd146 147Unlike `fftfreq` (but like `scipy.fftpack.rfftfreq`)148the Nyquist frequency component is considered to be positive.149 150Parameters151----------152n : int153    Window length.154d : scalar, optional155    Sample spacing (inverse of the sampling rate). Defaults to 1.156device : str, optional157    The device on which to place the created array. Default: ``None``.158    For Array-API interoperability only, so must be ``"cpu"`` if passed.159 160    .. versionadded:: 2.0.0161 162Returns163-------164f : ndarray165    Array of length ``n//2 + 1`` containing the sample frequencies.166 167Examples168--------169>>> import numpy as np170>>> signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5, -3, 4], dtype=float)171>>> fourier = np.fft.rfft(signal)172>>> n = signal.size173>>> sample_rate = 100174>>> freq = np.fft.fftfreq(n, d=1./sample_rate)175>>> freq176array([  0.,  10.,  20., ..., -30., -20., -10.])177>>> freq = np.fft.rfftfreq(n, d=1./sample_rate)178>>> freq179array([  0.,  10.,  20.,  30.,  40.,  50.])180 181r&r'rr)rr*)rrr,rr-)r.r/r(r0r2r1s      rr
r
�sN��d�a��'�'��1�2�2�182
���-�C�	�Q���183�A��Q���V�4�G��=�rr)r'N)�__doc__�numpy._corerrrrr�numpy._core.overridesrr	�__all__r-rrr184rrr
rrr�<module>r:s����>�=�E�;���g��
���-�k�B�6 �C�6 �r�-�k�B�, �C�, �^�K��3��3�l�K��6��6r
codekingpro/portable-devtools · Team Ai