403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.148.217.26
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/numpy/fft/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/numpy/fft/__pycache__/helper.cpython-37.pyc
B

��Fd3%�@s�dZddlmZmZmZddlZddlZddlmZddl	m
Z
mZmZm
Z
mZmZdddd	gZeefZdd
d�Zddd�Zdd
d�Zddd	�ZGdd�de�ZdS)z*
Discrete Fourier Transforms - helper.py

�)�division�absolute_import�print_functionN)�
integer_types)�asarray�concatenate�arange�take�integer�empty�fftshift�	ifftshift�fftfreq�rfftfreqc	Cs�t|�}|j}|dkr$tt|��}nt|t�r4|f}|}xD|D]<}|j|}|dd}tt||�t|�f�}t	|||�}q>W|S)as
    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.,  4., -5., -4., -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.]])

    N��)
r�ndim�list�range�
isinstancer�shaperrr	)	�x�axes�tmpr�y�k�n�p2�mylist�r�C/opt/alt/python37/lib64/python3.7/site-packages/numpy/fft/helper.pyrs,


c	Cs�t|�}|j}|dkr$tt|��}nt|t�r4|f}|}xH|D]@}|j|}||dd}tt||�t|�f�}t	|||�}q>W|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.]])

    Nrr)
rrrrrrrrrr	)	rrrrrrrrrrrr r
Qs"


��?cCszt|t�std��d||}t|t�}|ddd}td|td�}||d|�<t|ddtd�}|||d�<||S)a6
    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, -5.  , -3.75, -2.5 , -1.25])

    zn should be an integerg�?rrr)�dtypeN)rr�
ValueErrorr�intr)r�d�val�results�N�p1rrrr r�s$

cCs@t|t�std��d||}|dd}td|td�}||S)aR
    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.,  40., -50., -40., -30., -20., -10.])
    >>> freq = np.fft.rfftfreq(n, d=1./sample_rate)
    >>> freq
    array([  0.,  10.,  20.,  30.,  40.,  50.])

    zn should be an integerg�?rrr)r")rrr#rr$)rr%r&r(r'rrr r�s+
c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�	_FFTCachea
    Cache for the FFT twiddle factors as an LRU (least recently used) cache.

    Parameters
    ----------
    max_size_in_mb : int
        Maximum memory usage of the cache before items are being evicted.
    max_item_count : int
        Maximum item count of the cache before items are being evicted.

    Notes
    -----
    Items will be evicted if either limit has been reached upon getting and
    setting. The maximum memory usages is not strictly the given
    ``max_size_in_mb`` but rather
    ``max(max_size_in_mb, 1.5 * size_of_largest_item)``. Thus the cache will
    never be completely cleared - at least one item will remain and a single
    large item can cause the cache to retain several smaller items even if the
    given maximum cache size has been exceeded.
    cCs(|d|_||_t��|_t��|_dS)Ni)�_max_size_in_bytes�_max_item_count�collections�OrderedDict�_dict�	threading�Lock�_lock)�selfZmax_size_in_mbZmax_item_countrrr �__init__�s

z_FFTCache.__init__c	Cs\|j�Ly|j�|�}Wntk
r0g}YnX|�|�||j|<|��WdQRXdS)aI
        Store twiddle factors for an FFT of length n in the cache.

        Putting multiple twiddle factors for a certain n will store it multiple
        times.

        Parameters
        ----------
        n : int
            Data length for the FFT.
        factors : ndarray
            The actual twiddle values.
        N)r2r/�pop�KeyError�append�_prune_cache)r3rZfactors�valuerrr �put_twiddle_factorss


z_FFTCache.put_twiddle_factorsc	CsP|j�@||jks|j|s dS|j�|�}|��}|rB||j|<|SQRXdS)a�
        Pop twiddle factors for an FFT of length n from the cache.

        Will return None if the requested twiddle factors are not available in
        the cache.

        Parameters
        ----------
        n : int
            Data length for the FFT.

        Returns
        -------
        out : ndarray or None
            The retrieved twiddle factors if available, else None.
        N)r2r/r5)r3rZ
all_valuesr9rrr �pop_twiddle_factorss
z_FFTCache.pop_twiddle_factorscCs>x8t|j�dkr8t|j�|jks(|��r8|jjdd�qWdS)NrF)�last)�lenr/r,�_check_size�popitem)r3rrr r87sz_FFTCache._prune_cachecCs<dd�|j��D�}|sdSt|jdt|��}t|�|kS)NcSs"g|]}|rtdd�|D���qS)css|]}|jVqdS)N)�nbytes)�.0Z_jrrr �	<genexpr>>sz3_FFTCache._check_size.<locals>.<listcomp>.<genexpr>)�sum)rA�_irrr �
<listcomp>>sz)_FFTCache._check_size.<locals>.<listcomp>Fg�?)r/�values�maxr+rC)r3Z
item_sizes�max_sizerrr r>=sz_FFTCache._check_sizeN)	�__name__�
__module__�__qualname__�__doc__r4r:r;r8r>rrrr r*�sr*)N)N)r!)r!)rL�
__future__rrrr-r0�numpy.compatrZ
numpy.corerrrr	r
r�__all__rr
rr�objectr*rrrr �<module>s 

;
1
1
3

Youez - 2016 - github.com/yon3zu
LinuXploit