CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
_functions.cpython-310.pyc143 linesDownload Raw Back to __pycache__
1o

2��Yi��@s�dZddlZddlZddlmZddlmZmZm	Z	gd�Z3dZdd	�Zd4d�Z
dd
�Zdd�Zdd�Zddd�Zddd�Zddd�Zddd�Zdd�Zdd�ZdS) z"5Other wavelet related functions.6�N)�fft�)�ContinuousWavelet�DiscreteContinuousWavelet�Wavelet)7�integrate_wavelet�central_frequency�scale2frequency�frequency2scale�qmf�orthogonal_filter_bank�intwave�centrfrq�scal2frq�orthfiltzT`{old}` has been renamed to `{new}` and will be removed in a future version of pywt.cCst�|�}||9}|S)N)�npZcumsum)Zarr�stepZintegral�r�yE:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\pywt/_functions.py�8_integrates9rcO�(tjddd�}t�|t�t|i|��S)Nr
r��old�new)�_DEPRECATION_MSG�format�warnings�warn�DeprecationWarningr��args�kwargs�msgrrrr
"�r
cOr)Nrrr)rrrrrrrrrrr(r#rcOr)Nrr	r)rrrrrr	rrrrr.r#rcOr)Nrrr)rrrrrrrrrrr4r#r�cCs(t|�ttfvrd}t�|t�nt|ttf�st	|�}t|�ttfvrBt10�|d�t11�|d�}}|d|d}t||�|fS|�
|�}t|�dkr`|\}}|d|d}t||�|fSt|�dkrz|\}}}|d|d}t||�|fS|\}}	}12}}|d|d}t|	|�t||�|fS)ac13    Integrate `psi` wavelet function from -Inf to x using the rectangle14    integration method.15 16    Parameters17    ----------18    wavelet : Wavelet instance or str19        Wavelet to integrate.  If a string, should be the name of a wavelet.20    precision : int, optional21        Precision that will be used for wavelet function22        approximation computed with the wavefun(level=precision)23        Wavelet's method (default: 8).24 25    Returns26    -------27    [int_psi, x] :28        for orthogonal wavelets29    [int_psi_d, int_psi_r, x] :30        for other wavelets31 32 33    Examples34    --------35    >>> from pywt import Wavelet, integrate_wavelet36    >>> wavelet1 = Wavelet('db2')37    >>> [int_psi, x] = integrate_wavelet(wavelet1, precision=5)38    >>> wavelet2 = Wavelet('bior1.3')39    >>> [int_psi_d, int_psi_r, x] = integrate_wavelet(wavelet2, precision=5)40 41    z^Integration of a general signal is deprecated and will be removed in a future version of pywt.rr��)�type�tuple�listrrr�42isinstancerrrr�asarrayr�wavefun�len)�wavelet�	precisionr"�psi�xr�functions_approximations�phiZphi_dZpsi_dZphi_rZpsi_rrrrr:s*!4344rcCs�t|ttf�st|�}|�|�}t|�dkr|\}}n	|d|d}}t|d|d�}|dks4J�t�t	t45|�dd���d}|t|�dkrSt|�|d}d||dS)a�46    Computes the central frequency of the `psi` wavelet function.47 48    Parameters49    ----------50    wavelet : Wavelet instance, str or tuple51        Wavelet to integrate.  If a string, should be the name of a wavelet.52    precision : int, optional53        Precision that will be used for wavelet function54        approximation computed with the wavefun(level=precision)55        Wavelet's method (default: 8).56 57    Returns58    -------59    scalar60 61    r%r�����rNg�?)r*rrrr,r-�floatrZargmax�absr)r.r/r2r0r1�domain�indexrrrrys6263rcC�t||d�|S)a�Convert from CWT "scale" to normalized frequency.64 65    Parameters66    ----------67    wavelet : Wavelet instance or str68        Wavelet to integrate.  If a string, should be the name of a wavelet.69    scale : scalar70        The scale of the CWT.71    precision : int, optional72        Precision that will be used for wavelet function approximation computed73        with ``wavelet.wavefun(level=precision)``.  Default is 8.74 75    Returns76    -------77    freq : scalar78        Frequency normalized to the sampling frequency. In other words, for a79        sampling interval of `dt` seconds, the normalized frequency of 1.080        corresponds to (`1/dt` Hz).81 82    �r/�r)r.�scaler/rrrr	�sr	cCr9)aConvert from to normalized frequency to CWT "scale".83 84    Parameters85    ----------86    wavelet : Wavelet instance or str87        Wavelet to integrate.  If a string, should be the name of a wavelet.88    freq : scalar89        Frequency, normalized so that the sampling frequency corresponds to a90        value of 1.0.91    precision : int, optional92        Precision that will be used for wavelet function approximation computed93        with ``wavelet.wavefun(level=precision)``.  Default is 8.94 95    Returns96    -------97    scale : scalar98 99    r:r;)r.�freqr/rrrr100�sr101cCs2t�|�ddd�}|ddd�|ddd�<|S)ad102    Returns the Quadrature Mirror Filter(QMF).103 104    The magnitude response of QMF is mirror image about `pi/2` of that of the105    input filter.106 107    Parameters108    ----------109    filt : array_like110        Input filter for which QMF needs to be computed.111 112    Returns113    -------114    qm_filter : ndarray115        Quadrature mirror of the input filter.116 117    Nr4rr%)r�array)ZfiltZ	qm_filterrrrr�srcCstt|�ddkstd��tj|tjd�}t�d�|t�|�}|ddd�}t|�}|ddd�}||||f}|S)a,118    Returns the orthogonal filter bank.119 120    The orthogonal filter bank consists of the HPFs and LPFs at121    decomposition and reconstruction stage for the input scaling filter.122 123    Parameters124    ----------125    scaling_filter : array_like126        Input scaling filter (father wavelet).127 128    Returns129    -------130    orth_filt_bank : tuple of 4 ndarrays131        The orthogonal filter bank of the input scaling filter in the order :132        1] Decomposition LPF133        2] Decomposition HPF134        3] Reconstruction LPF135        4] Reconstruction HPF136 137    r%rz'`scaling_filter` length has to be even.)ZdtypeNr4)r-�138ValueErrorrr+Zfloat64�sqrt�sumr)Zscaling_filterZrec_loZdec_loZrec_hiZdec_hiZorth_filt_bankrrrr�sr)r$)�__doc__r�numpyrZ	numpy.fftrZ_extensions._pywtrrr�__all__rrr
rrrrrr	r139rrrrrr�<module>s$140141?142)143
Aluode/PerceptionLabPortable · CoolFace