403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/signal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/signal/__pycache__/_wavelets.cpython-311.pyc
�

d�c�6��l�ddlZddlmZddlmZddlmZgd�Zd�Z	d�Z
dd	�Zdd
�Zd�Z
dd�Zdd�ZdS)�N)�eig��comb)�convolve)�daub�qmf�cascade�morlet�ricker�morlet2�cwtc	����tj}�dkrtd����dkr$d|d��z}tj||g��S�dkr@|d��dz}|d��}|tjd|zd|zd|z
d|z
g��zS�dkr�d|d��z}d|d	|z��d
zzd|d	��||d	z
��zzd
zz
}tj|��}|d��dz}tjd|z
d|z
z��}tj||z��}dtj|��z}	||ztj|d|z|	z
d|zd|	zz
dz|d|	zz
dzd|	z
dg��zS�dk�rP�dkr9�fd
�t
���D��ddd�}
tj|
��}n;�fd�t
���D��ddd�}
tj|
��dz}tjddg���z}tjdg��}t
�dz
��D]K}
||
}d|||dz
z��z}dd|zz
}||z}t|��dkr||z
}|d|gz}�L|tj|��z}|tj
|��z|d��z}|jddd�Std���)aT
    The coefficients for the FIR low-pass filter producing Daubechies wavelets.

    p>=1 gives the order of the zero at f=1/2.
    There are 2p filter coefficients.

    Parameters
    ----------
    p : int
        Order of the zero at f=1/2, can have values from 1 to 34.

    Returns
    -------
    daub : ndarray
        Return

    �zp must be at least 1.�����
g�?����?�#c�@��g|]}t�dz
|z|d�����S)r��exactr��.0�k�ps  ��8/usr/lib/python3/dist-packages/scipy/signal/_wavelets.py�
<listcomp>zdaub.<locals>.<listcomp>2s0���?�?�?���a�!�e�a�i��!�,�,�,�?�?�?�N���c�L��g|] }t�dz
|z|d���d|zz��!S)rrg@rrs  �r r!zdaub.<locals>.<listcomp>5sI���$�$�$���a�!�e�a�i��!�,�,�,�s�A�v�5�$�$�$r"�z<Polynomial factorization does not work well for p too large.)�np�sqrt�
ValueError�array�conj�real�range�roots�poly1d�abs�sum�c)rr'r1�f�tmp�z1�z1c�d0�a0�a1�P�yj�qr�yval�part�consts`                r rr	sS���$�7�D��1�u�u��0�1�1�1��A�v�v�
���Q���K���x��A�����	
�a����D��G�G�a�K���D��G�G���2�8�Q��U�A��E�1�q�5�!�a�%�8�9�9�9�9�	
�a����4�4��8�8�m��
�4�4��S��>�>�A�%�
%��d�d�2�h�h���c�B�h���.G�(H�1�(L�
L���g�b�k�k���D��G�G�a�K��
�W�a�"�f��S��)�
*�
*��
�W�R�#�X�
�
��
������_���2�v���"�a�"�f�r�k�1�r�6�A��F�?�Q�3F�"$�q�2�v�+��/�1�r�6�1�">�?�?�?�	?�	
�R����r�6�6�?�?�?�?�e�A�h�h�?�?�?���"��E�A���!���B�B�$�$�$�$���(�(�$�$�$�$(�D�b�D�*�A���!���q��B�
�I�q�!�f���q� ���I�q�c�N�N���q�1�u���	�	�A��a�5�D��t�t�D�D�1�H�-�.�.�.�D���D��L�E����B��B���1�}�}��T�\���Q���H��A�A�
����
�
�N��
���q�	�	�M�D�D��G�G�#���s�4�4�R�4�y���1�2�2�	2r"c��t|��dz
}d�t|dz��D��}|ddd�tj|��zS)z�
    Return high-pass qmf filter from low-pass

    Parameters
    ----------
    hk : array_like
        Coefficients of high-pass filter.

    Returns
    -------
    array_like
        High-pass filter coefficients.

    rc�*�g|]}ddd�|dz��S)rr#�rrr�)rrs  r r!zqmf.<locals>.<listcomp>^s'��7�7�7�Q��b�M�M�!�a�%� �7�7�7r"Nr#)�lenr,r&r))�hk�N�asgns   r rrNsM��	�B���!��A�7�7�%��A��,�,�7�7�7�D�
�d�d��d�8�b�h�t�n�n�$�$r"�c�n��t|��dz
}|dtj|dz��z
krtd���|dkrtd���tjd|�d|�f\}}tjd��}tj|df}t|��}tj|df}tjd|z|z
d|dz��}	tjd|z|z
dzd|dz��}
tj	dd||fd	��}tj
||	d��|d
<tj
||
d��|d<tj
||	d��|d<tj
||
d��|d
<||z}tjd|d|zzt���d|zz}d|z}
d|z}t|d
��\}}tjtj|dz
����}tj|dd�|f��}tj|��}|dkr|}|}d||zi}tj|d|d��|d<d|z}|d|
dd|�<|d|
d|dz
zd|�<tj|d|d��|dd|�<tj|d
|d��|d|dz
zd|�<dg�t'd|dz��D]�}�fd�dD��}d||z
z}|D]�}d}t'|��D]}||dkr|d|dz
|z
zz
}�||dd�}t)|d��}tj|d|f|��}|||<||
||zd|�<tj|d|f|��|||zd|�<��|���||
|fS)a�
    Return (x, phi, psi) at dyadic points ``K/2**J`` from filter coefficients.

    Parameters
    ----------
    hk : array_like
        Coefficients of low-pass filter.
    J : int, optional
        Values will be computed at grid points ``K/2**J``. Default is 7.

    Returns
    -------
    x : ndarray
        The dyadic points ``K/2**J`` for ``K=0...N * (2**J)-1`` where
        ``len(hk) = len(gk) = N+1``.
    phi : ndarray
        The scaling function ``phi(x)`` at `x`:
        ``phi(x) = sum(hk * phi(2x-k))``, where k is from 0 to N.
    psi : ndarray, optional
        The wavelet function ``psi(x)`` at `x`:
        ``phi(x) = sum(gk * phi(2x-k))``, where k is from 0 to N.
        `psi` is only returned if `gk` is not None.

    Notes
    -----
    The algorithm uses the vector cascade algorithm described by Strang and
    Nguyen in "Wavelets and Filter Banks".  It builds a dictionary of values
    and slices for quick reuse.  Then inserts vectors into final vector at the
    end.

    r�zToo many levels.zToo few levels.Nrrr#�d)rrrA)rr)rr��dtype�0�1c�(��g|]}�D]	}d||fz��
�S)z%d%srB)r�xx�yy�prevkeyss   �r r!zcascade.<locals>.<listcomp>�s/���I�I�I���I�I�"�6�R��H�$�I�I�I�Ir")rCr&�log2r(�ogridr'�r_r�clip�empty�take�arange�floatr�argmin�absoluter+r0�dotr,�int)rD�JrE�nn�kk�s2�thk�gk�tgk�indx1�indx2�m�x�phi�psi�lam�v�ind�sm�bitdic�step�level�newkeys�fac�key�num�pos�pastphi�ii�temprRs                              @r r	r	bs����@	�B���!��A�	�B����Q��������+�,�,�,�	�A����*�+�+�+��X�b�q�b�"�1�"�f�
�F�B��	�����B�
�%��A��,�C�	�R���B�
�%��A��,�C��G�A��F�R�K��Q��U�+�+�E��G�A��F�R�K�!�O�R��Q��/�/�E�
��!�Q��1��s�#�#�A��g�c�5�!�$�$�A�d�G��g�c�5�!�$�$�A�d�G��g�c�5�!�$�$�A�d�G��g�c�5�!�$�$�A�d�G���G�A�	�	�!�Q�!�q�&�\��/�/�/�1��6�:�A�
�a�%�C�
�a�%�C���4��\�\�F�C��
�)�B�K��a��(�(�
)�
)�C�	���!�!�!�S�&�	���A�
�����B�	�A�v�v�
�B���S���1�r�6�]�F��&��4��&��+�.�.�F�3�K���6�D���+�C���$��K� &�s��C��q�1�u�������&��4��&��+�.�.�C���$��K� "��q��w��s�� <� <�C��q�1�u������
�u�H��q�!�a�%������I�I�I�I�v�I�I�I���A��I����	=�	=�C��C��U�|�|�
4�
4���s�8�s�?�?��A�%�!�)�c�/�2�3�C���S����W�o�G��S��V���B��6�!�A�r�E�(�G�,�,�D��F�3�K�#'�C��c�	��4�� �#%�6�!�A�r�E�(�G�#<�#<�C��c�	��4�� � �����c�3�;�r"�@��?Tc�@�tj|dztjz|dztjz|��}tjd|z|z��}|r|tjd|dzz��z}|tjd|dzz��tjdzzz}|S)a)
    Complex Morlet wavelet.

    Parameters
    ----------
    M : int
        Length of the wavelet.
    w : float, optional
        Omega0. Default is 5
    s : float, optional
        Scaling factor, windowed from ``-s*2*pi`` to ``+s*2*pi``. Default is 1.
    complete : bool, optional
        Whether to use the complete or the standard version.

    Returns
    -------
    morlet : (M,) ndarray

    See Also
    --------
    morlet2 : Implementation of Morlet wavelet, compatible with `cwt`.
    scipy.signal.gausspulse

    Notes
    -----
    The standard version::

        pi**-0.25 * exp(1j*w*x) * exp(-0.5*(x**2))

    This commonly used wavelet is often referred to simply as the
    Morlet wavelet.  Note that this simplified version can cause
    admissibility problems at low values of `w`.

    The complete version::

        pi**-0.25 * (exp(1j*w*x) - exp(-0.5*(w**2))) * exp(-0.5*(x**2))

    This version has a correction
    term to improve admissibility. For `w` greater than 5, the
    correction term is negligible.

    Note that the energy of the return wavelet is not normalised
    according to `s`.

    The fundamental frequency of this wavelet in Hz is given
    by ``f = 2*s*w*r / M`` where `r` is the sampling rate.

    Note: This function was created before `cwt` and is not compatible
    with it.

    Examples
    --------
    >>> from scipy import signal
    >>> import matplotlib.pyplot as plt

    >>> M = 100
    >>> s = 4.0
    >>> w = 2.0
    >>> wavelet = signal.morlet(M, s, w)
    >>> plt.plot(wavelet)
    >>> plt.show()

    rr���п)r&�linspace�pi�exp)�M�w�s�completeri�outputs      r r
r
�s���@	��Q�B��F�R�U�N�A��E�B�E�M�1�5�5�A�
�V�B��F�Q�J�
�
�F��(��"�&���A���'�'�'��
�b�f�T�Q��T�]�#�#�b�e�e�n�4�4�F��Mr"c��dtjd|z��tjdzzz}|dz}tjd|��|dz
dzz
}|dz}d||zz
}tj|d|zz��}||z|z}|S)a�
    Return a Ricker wavelet, also known as the "Mexican hat wavelet".

    It models the function:

        ``A * (1 - (x/a)**2) * exp(-0.5*(x/a)**2)``,

    where ``A = 2/(sqrt(3*a)*(pi**0.25))``.

    Parameters
    ----------
    points : int
        Number of points in `vector`.
        Will be centered around 0.
    a : scalar
        Width parameter of the wavelet.

    Returns
    -------
    vector : (N,) ndarray
        Array of length `points` in shape of ricker curve.

    Examples
    --------
    >>> from scipy import signal
    >>> import matplotlib.pyplot as plt

    >>> points = 100
    >>> a = 4.0
    >>> vec2 = signal.ricker(points, a)
    >>> print(len(vec2))
    100
    >>> plt.plot(vec2)
    >>> plt.show()

    rrg�?rr|r)r&r'r�rYr�)	�points�a�A�wsq�vec�xsq�mod�gauss�totals	         r rrs���J	
�R�W�Q��U�^�^�r�u�d�{�
+�,�A�
�Q�$�C�
�)�A�v�
�
�&�3�,�!�!3�
3�C�

�q�&�C��s�S�y�=�C��F�C�4�1�s�7�#�$�$�E�
��G�e�O�E��Lr"�c�
�tjd|��|dz
dzz
}||z}tjd|z|z��tjd|dzz��ztjdzz}tjd|z��|z}|S)aR
    Complex Morlet wavelet, designed to work with `cwt`.

    Returns the complete version of morlet wavelet, normalised
    according to `s`::

        exp(1j*w*x/s) * exp(-0.5*(x/s)**2) * pi**(-0.25) * sqrt(1/s)

    Parameters
    ----------
    M : int
        Length of the wavelet.
    s : float
        Width parameter of the wavelet.
    w : float, optional
        Omega0. Default is 5

    Returns
    -------
    morlet : (M,) ndarray

    See Also
    --------
    morlet : Implementation of Morlet wavelet, incompatible with `cwt`

    Notes
    -----

    .. versionadded:: 1.4.0

    This function was designed to work with `cwt`. Because `morlet2`
    returns an array of complex numbers, the `dtype` argument of `cwt`
    should be set to `complex128` for best results.

    Note the difference in implementation with `morlet`.
    The fundamental frequency of this wavelet in Hz is given by::

        f = w*fs / (2*s*np.pi)

    where ``fs`` is the sampling rate and `s` is the wavelet width parameter.
    Similarly we can get the wavelet width parameter at ``f``::

        s = w*fs / (2*f*np.pi)

    Examples
    --------
    >>> import numpy as np
    >>> from scipy import signal
    >>> import matplotlib.pyplot as plt

    >>> M = 100
    >>> s = 4.0
    >>> w = 2.0
    >>> wavelet = signal.morlet2(M, s, w)
    >>> plt.plot(abs(wavelet))
    >>> plt.show()

    This example shows basic use of `morlet2` with `cwt` in time-frequency
    analysis:

    >>> t, dt = np.linspace(0, 1, 200, retstep=True)
    >>> fs = 1/dt
    >>> w = 6.
    >>> sig = np.cos(2*np.pi*(50 + 10*t)*t) + np.sin(40*np.pi*t)
    >>> freq = np.linspace(1, fs/2, 100)
    >>> widths = w*fs / (2*freq*np.pi)
    >>> cwtm = signal.cwt(sig, signal.morlet2, widths, w=w)
    >>> plt.pcolormesh(t, freq, np.abs(cwtm), cmap='viridis', shading='gouraud')
    >>> plt.show()

    rr|rrr~rr)r&rYr�r�r')r�r�r�ri�waveletr�s      r rrFs~��P	�	�!�Q���1�s�7�a�-�'�A�	�A��A��f�R�!�V�a�Z� � �2�6�$��A��+�#6�#6�6�����G�G�
�W�Q�q�S�\�\�G�
#�F��Mr"c���|�Gtj|d|dfi|����jjdvr
tj}ntj}tjt|��t|��f|���}t|��D]e\}}tj	d|zt|��g��}tj
|||fi|��ddd���}	t||	d�	��||<�f|S)
a�	
    Continuous wavelet transform.

    Performs a continuous wavelet transform on `data`,
    using the `wavelet` function. A CWT performs a convolution
    with `data` using the `wavelet` function, which is characterized
    by a width parameter and length parameter. The `wavelet` function
    is allowed to be complex.

    Parameters
    ----------
    data : (N,) ndarray
        data on which to perform the transform.
    wavelet : function
        Wavelet function, which should take 2 arguments.
        The first argument is the number of points that the returned vector
        will have (len(wavelet(length,width)) == length).
        The second is a width parameter, defining the size of the wavelet
        (e.g. standard deviation of a gaussian). See `ricker`, which
        satisfies these requirements.
    widths : (M,) sequence
        Widths to use for transform.
    dtype : data-type, optional
        The desired data type of output. Defaults to ``float64`` if the
        output of `wavelet` is real and ``complex128`` if it is complex.

        .. versionadded:: 1.4.0

    kwargs
        Keyword arguments passed to wavelet function.

        .. versionadded:: 1.4.0

    Returns
    -------
    cwt: (M, N) ndarray
        Will have shape of (len(widths), len(data)).

    Notes
    -----

    .. versionadded:: 1.4.0

    For non-symmetric, complex-valued wavelets, the input signal is convolved
    with the time-reversed complex-conjugate of the wavelet data [1].

    ::

        length = min(10 * width[ii], len(data))
        cwt[ii,:] = signal.convolve(data, np.conj(wavelet(length, width[ii],
                                        **kwargs))[::-1], mode='same')

    References
    ----------
    .. [1] S. Mallat, "A Wavelet Tour of Signal Processing (3rd Edition)",
        Academic Press, 2009.

    Examples
    --------
    >>> import numpy as np
    >>> from scipy import signal
    >>> import matplotlib.pyplot as plt
    >>> t = np.linspace(-1, 1, 200, endpoint=False)
    >>> sig  = np.cos(2 * np.pi * 7 * t) + signal.gausspulse(t - 0.4, fc=2)
    >>> widths = np.arange(1, 31)
    >>> cwtmatr = signal.cwt(sig, signal.ricker, widths)

    .. note:: For cwt matrix plotting it is advisable to flip the y-axis

    >>> cwtmatr_yflip = np.flipud(cwtmatr)
    >>> plt.imshow(cwtmatr_yflip, extent=[-1, 1, 1, 31], cmap='PRGn', aspect='auto',
    ...            vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max())
    >>> plt.show()
    Nrr�FDGrKrr#�same)�mode)r&�asarrayrL�char�
complex128�float64rWrC�	enumerate�minr*r)
�datar��widthsrL�kwargsr�rn�widthrE�wavelet_datas
          r r
r
�s���X
�}�
�:�g�g�a����5�5�f�5�5�6�6�<�A�U�J�J��M�E�E��J�E�
�X�s�6�{�{�C��I�I�.�e�
<�
<�
<�F���'�'�@�@�
��U��F�B��J��D�	�	�*�+�+���w�w�w�q�%�:�:�6�:�:�4�4�R�4�@�A�A���t�\��?�?�?��s����Mr")rG)r{r|T)r�)N)�numpyr&�scipy.linalgr�
scipy.specialr�scipy.signalr�__all__rrr	r
rrr
rBr"r �<module>r�s�������������������!�!�!�!�!�!�
J�
J�
J��B2�B2�B2�J%�%�%�(g�g�g�g�TH�H�H�H�V,�,�,�^L�L�L�L�^W�W�W�W�W�Wr"

Youez - 2016 - github.com/yon3zu
LinuXploit