§ <ˆj ãóþ—dZddlmZmZmZmZmZddlmZm Z gd¢Z e efZ dd„Z ee d¬¦«dd „¦«Zee d¬¦«dd „¦«Ze d¦«dd „¦«Ze d¦«dd „¦«ZdS)z* Discrete Fourier Transforms - helper.py é)ÚintegerÚemptyÚarangeÚasarrayÚroll)Úarray_function_dispatchÚ set_module)ÚfftshiftÚ ifftshiftÚfftfreqÚrfftfreqNcó—|fS©N©)ÚxÚaxess úG/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/fft/helper.pyÚ_fftshift_dispatcherrs €Ø ˆ4€Kóz numpy.fft)Úmodulecó‡—t‰¦«Š|€3tt‰j¦«¦«}d„‰jD¦«}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|]}|dz‘ŒS©ér©Ú.0Údims rú zfftshift..Cs€Ð-Ð-Ð-˜c�˜‘Ð-Ð-Ð-rrcó0•—g|]}‰j|dz‘ŒSr©Úshape©rÚaxrs €rrzfftshift..Gs$ø€Ð1Ð1Ð1 b�”˜” Ñ!Ð1Ð1Ð1r©rÚtupleÚrangeÚndimr!Ú isinstanceÚ integer_typesr©rrÚshifts` rr r s‘ø€õZ �‰ Œ €AØ €|Ý•U˜1œ6‘]”]Ñ#Ô#ˆØ-Ð- Q¤WÐ-Ñ-Ô-ˆˆÝ �D�-Ñ (Ô (ð2Ø”˜”  Ñ"ˆˆà1Ð1Ð1Ð1¨DÐ1Ñ1Ô1ˆå ��5˜$Ñ Ô Ðrcó‡—t‰¦«Š|€3tt‰j¦«¦«}d„‰jD¦«}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|]}|dz ‘Œ Srrrs rrzifftshift..rs€Ð0Ð0Ð0 �3˜!‘8�Ð0Ð0Ð0rrcó2•—g|]}‰j|dz ‘ŒSrr r"s €rrzifftshift..vs'ø€Ð4Ð4Ð4¨�1”7˜2”; !Ñ#Ð$Ð4Ð4Ð4rr$r*s` rr r Ls”ø€õF �‰ Œ €AØ €|Ý•U˜1œ6‘]”]Ñ#Ô#ˆØ0Ð0¨¬Ð0Ñ0Ô0ˆˆÝ �D�-Ñ (Ô (ð5Ø”'˜$”- 1Ñ$Ð%ˆˆà4Ð4Ð4Ð4¨tÐ4Ñ4Ô4ˆå ��5˜$Ñ Ô Ðrçð?có$—t|t¦«std¦«‚d||zz }t|t¦«}|dz dzdz}t d|t¬¦«}||d|…<t |dz dt¬¦«}|||d…<||zS)a- Return the Discrete Fourier Transform sample frequencies. The returned float array `f` contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second. Given a window length `n` and a sample spacing `d`:: f = [0, 1, ..., n/2-1, -n/2, ..., -1] / (d*n) if n is even f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (d*n) if n is odd Parameters ---------- n : int Window length. d : scalar, optional Sample spacing (inverse of the sampling rate). Defaults to 1. Returns ------- f : ndarray Array of length `n` containing the sample frequencies. Examples -------- >>> signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5], dtype=float) >>> fourier = np.fft.fft(signal) >>> n = signal.size >>> timestep = 0.1 >>> freq = np.fft.fftfreq(n, d=timestep) >>> freq array([ 0. , 1.25, 2.5 , ..., -3.75, -2.5 , -1.25]) ún should be an integerr/érr©ÚdtypeN)r(r)Ú ValueErrorrÚintr)ÚnÚdÚvalÚresultsÚNÚp1Úp2s rr r {s£€õJ �a�Ñ 'Ô 'ð3ÝÐ1Ñ2Ô2Ð2Ø ��Q‘‰-€CÝ�A•s‰mŒm€GØ ˆ1‰ˆq‰�1‰ €AÝ ��1�CÐ Ñ Ô €BØ€GˆBˆQˆB�KÝ �!�Q‘$�˜¥#Ð &Ñ &Ô &€BØ€GˆAˆBˆB�KØ �S‰=Ðrcó¢—t|t¦«std¦«‚d||zz }|dzdz}td|t¬¦«}||zS)a? Return the Discrete Fourier Transform sample frequencies (for usage with rfft, irfft). The returned float array `f` contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second. Given a window length `n` and a sample spacing `d`:: f = [0, 1, ..., n/2-1, n/2] / (d*n) if n is even f = [0, 1, ..., (n-1)/2-1, (n-1)/2] / (d*n) if n is odd Unlike `fftfreq` (but like `scipy.fftpack.rfftfreq`) the Nyquist frequency component is considered to be positive. Parameters ---------- n : int Window length. d : scalar, optional Sample spacing (inverse of the sampling rate). Defaults to 1. Returns ------- f : ndarray Array of length ``n//2 + 1`` containing the sample frequencies. Examples -------- >>> signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5, -3, 4], dtype=float) >>> fourier = np.fft.rfft(signal) >>> n = signal.size >>> sample_rate = 100 >>> freq = np.fft.fftfreq(n, d=1./sample_rate) >>> freq array([ 0., 10., 20., ..., -30., -20., -10.]) >>> freq = np.fft.rfftfreq(n, d=1./sample_rate) >>> freq array([ 0., 10., 20., 30., 40., 50.]) r1r/rr2rr3)r(r)r5rr6)r7r8r9r;r:s rr r ¬s^€õX �a�Ñ 'Ô 'ð3ÝÐ1Ñ2Ô2Ð2Ø ˆq�‰s‰)€CØ ˆ1‰ˆq‰€AÝ�Q˜¥Ð%Ñ%Ô%€GØ �S‰=Ðrr)r/)Ú__doc__Ú numpy.corerrrrrÚnumpy.core.overridesrr Ú__all__r6r)rr r r r rrrúrCsFðððð=Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<ØDÐDÐDÐDÐDÐDÐDÐDð ;Ð :Ð :€à�g�€ ðððððÐÐ-°kÐBÑBÔBð5 ð5 ð5 ñCÔBð5 ðpÐÐ-°kÐBÑBÔBð+ ð+ ð+ ñCÔBð+ ð\ €ˆKÑÔð-ð-ð-ñÔð-ð` €ˆKÑÔð0ð0ð0ñÔð0ð0ð0r