
    !Цi                         S r SSKrSSKrSSKJr  SSKJrJrJ	r	  / SQr
SrS rS	 rS
 rS rS rSS jrSS jrSS jrSS jrS rS rg)z"
Other wavelet related functions.
    N)fft   )ContinuousWaveletDiscreteContinuousWaveletWavelet)
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.c                 :    [         R                  " U 5      nX!-  nU$ )N)npcumsum)arrstepintegrals      N/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/pywt/_functions.py
_integrater      s    yy~HHO    c                  v    [         R                  SSS9n[        R                  " U[        5        [        U 0 UD6$ )Nr   r   oldnew)_DEPRECATION_MSGformatwarningswarnDeprecationWarningr   argskwargsmsgs      r   r   r   "   s7    

!
!i5H
!
ICMM#)*d-f--r   c                  v    [         R                  SSS9n[        R                  " U[        5        [        U 0 UD6$ )Nr   r	   r   )r   r    r!   r"   r#   r	   r$   s      r   r   r   (   s7    

!
!j6I
!
JCMM#)*d-f--r   c                  v    [         R                  SSS9n[        R                  " U[        5        [        U 0 UD6$ )Nr   r
   r   )r   r    r!   r"   r#   r
   r$   s      r   r   r   .   s7    

!
!j6G
!
HCMM#)*D+F++r   c                  v    [         R                  SSS9n[        R                  " U[        5        [        U 0 UD6$ )Nr   r   r   )r   r    r!   r"   r#   r   r$   s      r   r   r   4   s7    

!
!j6N
!
OCMM#)*!42622r   c                    [        U 5      [        [        4;   a  Sn[        R                  " U[
        5        O&[        U [        [        45      (       d  [        U 5      n [        U 5      [        [        4;   aI  [        R                  " U S   5      [        R                  " U S   5      pCUS   US   -
  n[        X55      U4$ U R                  U5      n[        U5      S:X  a  Uu  p4US   US   -
  n[        X55      U4$ [        U5      S:X  a  Uu  psnUS   US   -
  n[        X55      U4$ Uu  ppnUS   US   -
  n[        X5      [        X5      U4$ )a  
Integrate `psi` wavelet function from -Inf to x using the rectangle
integration method.

Parameters
----------
wavelet : Wavelet instance or str
    Wavelet to integrate.  If a string, should be the name of a wavelet.
precision : int, optional
    Precision that will be used for wavelet function
    approximation computed with the wavefun(level=precision)
    Wavelet's method (default: 8).

Returns
-------
[int_psi, x] :
    for orthogonal wavelets
[int_psi_d, int_psi_r, x] :
    for other wavelets


Examples
--------
>>> from pywt import Wavelet, integrate_wavelet
>>> wavelet1 = Wavelet('db2')
>>> [int_psi, x] = integrate_wavelet(wavelet1, precision=5)
>>> wavelet2 = Wavelet('bior1.3')
>>> [int_psi_d, int_psi_r, x] = integrate_wavelet(wavelet2, precision=5)

z^Integration of a general signal is deprecated and will be removed in a future version of pywt.r   r         )typetuplelistr!   r"   r#   
isinstancer   r   r   r   asarrayr   wavefunlen)wavelet	precisionr'   psixr   functions_approximationsphiphi_dpsi_dphi_rpsi_rs               r   r   r   :   sO   B G}%Bc-.'+<!=>>+G4G}%GAJ'GAJ)?Qtad{#$a''&y9
#$))tad{#$a''	%	&!	+.!tad{#$a'' )A%eAtad{%&
5(?BBr   c                    [        U [        [        45      (       d  [        U 5      n U R	                  U5      n[        U5      S:X  a  Uu  p4O	US   US   pC[        US   US   -
  5      nUS:  d   e[        R                  " [        [        U5      SS 5      5      S-   nU[        U5      S-  :  a  [        U5      U-
  S-   nSXVS-
  -  -  $ )a  
Computes the central frequency of the `psi` wavelet function.

Parameters
----------
wavelet : Wavelet instance, str or tuple
    Wavelet to integrate.  If a string, should be the name of a wavelet.
precision : int, optional
    Precision that will be used for wavelet function
    approximation computed with the wavefun(level=precision)
    Wavelet's method (default: 8).

Returns
-------
scalar

r,   r   r   Ng      ?)r1   r   r   r   r3   r4   floatr   argmaxabsr   )r5   r6   r9   r7   r8   domainindexs          r   r	   r	   y   s    & g):;<<+G4&y9
#$))Q *!,.Fr.JQ1R51Q4< FA::IIc#c(12,'(1,Es3x!|C5 1$&AI&''r   c                     [        XS9U-  $ )aR  Convert from CWT "scale" to normalized frequency.

Parameters
----------
wavelet : Wavelet instance or str
    Wavelet to integrate.  If a string, should be the name of a wavelet.
scale : scalar
    The scale of the CWT.
precision : int, optional
    Precision that will be used for wavelet function approximation computed
    with ``wavelet.wavefun(level=precision)``.  Default is 8.

Returns
-------
freq : scalar
    Frequency normalized to the sampling frequency. In other words, for a
    sampling interval of `dt` seconds, the normalized frequency of 1.0
    corresponds to (`1/dt` Hz).

r6   r	   )r5   scaler6   s      r   r
   r
      s    * W:UBBr   c                     [        XS9U-  $ )a  Convert from to normalized frequency to CWT "scale".

Parameters
----------
wavelet : Wavelet instance or str
    Wavelet to integrate.  If a string, should be the name of a wavelet.
freq : scalar
    Frequency, normalized so that the sampling frequency corresponds to a
    value of 1.0.
precision : int, optional
    Precision that will be used for wavelet function approximation computed
    with ``wavelet.wavefun(level=precision)``.  Default is 8.

Returns
-------
scale : scalar

rG   rH   )r5   freqr6   s      r   r   r      s    & W:TAAr   c                 \    [         R                  " U 5      SSS2   nUSSS2   * USSS2'   U$ )a4  
Returns the Quadrature Mirror Filter(QMF).

The magnitude response of QMF is mirror image about `pi/2` of that of the
input filter.

Parameters
----------
filt : array_like
    Input filter for which QMF needs to be computed.

Returns
-------
qm_filter : ndarray
    Quadrature mirror of the input filter.

Nr@   r   r,   )r   array)filt	qm_filters     r   r   r      s<    $ tt$I A&IaddOr   c                 $   [        U 5      S-  S:X  d  [        S5      e[        R                  " U [        R                  S9n [        R
                  " S5      U -  [        R                  " U 5      -  nUSSS2   n[        U5      nUSSS2   nX$X4nU$ )a  
Returns the orthogonal filter bank.

The orthogonal filter bank consists of the HPFs and LPFs at
decomposition and reconstruction stage for the input scaling filter.

Parameters
----------
scaling_filter : array_like
    Input scaling filter (father wavelet).

Returns
-------
orth_filt_bank : tuple of 4 ndarrays
    The orthogonal filter bank of the input scaling filter in the order :
    1] Decomposition LPF
    2] Decomposition HPF
    3] Reconstruction LPF
    4] Reconstruction HPF

r,   r   z'`scaling_filter` length has to be even.)dtypeNr@   )r4   
ValueErrorr   r2   float64sqrtsumr   )scaling_filterrec_lodec_lorec_hidec_hiorth_filt_banks         r   r   r      s    , !#q(BCCZZbjjANWWQZ.(266.+AAFDbD\F[FDbD\Ff5Nr   )   )__doc__r!   numpyr   	numpy.fftr   _extensions._pywtr   r   r   __all__r   r   r   r   r   r   r   r	   r
   r   r   r    r   r   <module>rc      sf   
    T T:> ..,3<C~&(RC.B*."r   