
    !Цi'8                         S SK JrJr  S SKrSSKJrJrJrJ	r	J
r
JrJr  SSKJrJrJrJrJrJrJr  SSKJrJr  / SQr  SS jrS	 r  SS
 jrS r  SS jrS rg)    )partialreduceN   )_prep_axes_wavedecnwavedecwavedec2wavedecnwaverecwaverec2waverecn)iswtiswt2iswtnswtswt2swt_max_levelswtn)_modes_per_axis_wavelets_per_axis)mramra2mranimraimra2imranc           
      0   US:X  a<  US:w  a  [        S5      eXSS.n[        [        4USS.UD6n[        [        40 UD6nSn	O>US:X  a*  XUS.n[        [        4S	U0UD6n[        [
        40 UD6nS
n	O[        SU 35      eU" U 5      n
/ n[        U
5      nU	(       a   [        R                  " U
S   5      nU/U-  nO&U
 Vs/ s H  n[        R                  " U5      PM     nn[        U5       H  nU
U   UU'   U" U5      nUR                  U R                  :w  a2  U[        U R                   Vs/ s H  n[        U5      PM     sn5         nUR                  U5        U	(       a  WUU'   M~  [        R                  " UU   5      UU'   M     U$ s  snf s  snf )a  Forward 1D multiresolution analysis.

It is a projection onto the wavelet subspaces.

Parameters
----------
data: array_like
    Input data
wavelet : Wavelet object or name string
    Wavelet to use
level : int, optional
    Decomposition level (must be >= 0). If level is None (default) then it
    will be calculated using the `dwt_max_level` function.
axis: int, optional
    Axis over which to compute the DWT. If not given, the last axis is
    used. Currently only available when ``transform='dwt'``.
transform : {'dwt', 'swt'}
    Whether to use the DWT or SWT for the transforms.
mode : str, optional
    Signal extension mode, see `Modes` (default: 'symmetric'). This option
    is only used when transform='dwt'.

Returns
-------
[cAn, {details_level_n}, ... {details_level_1}] : list
    For more information, see the detailed description in `wavedec`

See Also
--------
imra, swt

Notes
-----
This is sometimes referred to as an additive decomposition because the
inverse transform (``imra``) is just the sum of the coefficient arrays
[1]_. The decomposition using ``transform='dwt'`` corresponds to section
2.2 while that using an undecimated transform (``transform='swt'``) is
described in section 3.2 and appendix A.

This transform does not share the variance partition property of ``swt``
with `norm=True`. It does however, result in coefficients that are
temporally aligned regardless of the symmetry of the wavelet used.

The redundancy of this transform is ``(level + 1)``.

References
----------
.. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal
    Coastal Sea Level Fluctuations Using Wavelets. Journal of the American
    Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880.
    https://doi.org/10.2307/2965551

r   periodization0transform swt only supports mode='periodization'T)waveletaxisnormleveltrim_approxdwt)r   moder    r#   Funrecognized transform: r   )
ValueErrorr   r   r   r   r
   lennp
zeros_likerangeshapetuplesliceappend)datar   r#   r    	transformr&   kwargsforwardinverseis_swt
wav_coeffs
mra_coeffsncztmpcjrecszs                      H/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/pywt/_mra.pyr   r      s   n E?"BD D$DA#GUGG$)&)	e	$DA'99&9',V,3I;?@@JJ	ZBMM*Q-(ebj *44Ar}}Q42YAA cl99

"e<2U2Y<=>C# CF]]3q6*CF   % 5 =s    F/Fc                     [        S U 5      $ )a  Inverse 1D multiresolution analysis via summation.

Parameters
----------
mra_coeffs : list of ndarray
    Multiresolution analysis coefficients as returned by `mra`.

Returns
-------
rec : ndarray
    The reconstructed signal.

See Also
--------
mra

References
----------
.. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal
    Coastal Sea Level Fluctuations Using Wavelets. Journal of the American
    Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880.
    https://doi.org/10.2307/2965551
c                 
    X-   $ N )xys     r@   <lambda>imra.<locals>.<lambda>   s    qu    )r   )r8   s    r@   r   r   {   s    0 $j11rI   c                    US:X  aY  US:w  a  [        S5      eUc  [        S U R                   5       5      nXSS.n[        [        4USS.UD6n[        [
        40 UD6nO<US:X  a(  XUS	.n[        [        4S
U0UD6n[        [        40 UD6nO[        SU 35      eU" U 5      n	/ n
[        U	5      n[        R                  " U	S   5      nU/n[        SU5       H;  nUR                  X    Vs/ s H  n[        R                  " U5      PM     sn5        M=     U	S   US'   U" U5      nUR                  U R                  :w  a2  U[        U R                   Vs/ s H  n[        U5      PM     sn5         nU
R                  U5        XS'   [        SU5       H  n/ n[        S5       H  nX   U   nX   U   X   U'   U" U5      nUR                  U R                  :w  a2  U[        U R                   Vs/ s H  n[        U5      PM     sn5         nUR                  U5        XU   U'   M     U
R                  [        U5      5        M     U
$ s  snf s  snf s  snf )aU  Forward 2D multiresolution analysis.

It is a projection onto wavelet subspaces.

Parameters
----------
data: array_like
    Input data
wavelet : Wavelet object or name string, or 2-tuple of wavelets
    Wavelet to use.  This can also be a tuple containing a wavelet to
    apply along each axis in `axes`.
level : int, optional
    Decomposition level (must be >= 0). If level is None (default) then it
    will be calculated using the `dwt_max_level` function.
axes : 2-tuple of ints, optional
    Axes over which to compute the DWT. Repeated elements are not allowed.
    Currently only available when ``transform='dwt2'``.
transform : {'dwt2', 'swt2'}
    Whether to use the DWT or SWT for the transforms.
mode : str or 2-tuple of str, optional
    Signal extension mode, see `Modes` (default: 'symmetric'). This option
    is only used when transform='dwt2'.

Returns
-------
coeffs : list
    For more information, see the detailed description in `wavedec2`

Notes
-----
This is sometimes referred to as an additive decomposition because the
inverse transform (``imra2``) is just the sum of the coefficient arrays
[1]_. The decomposition using ``transform='dwt'`` corresponds to section
2.2 while that using an undecimated transform (``transform='swt'``) is
described in section 3.2 and appendix A.

This transform does not share the variance partition property of ``swt2``
with `norm=True`. It does however, result in coefficients that are
temporally aligned regardless of the symmetry of the wavelet used.

The redundancy of this transform is ``3 * level + 1``.

See Also
--------
imra2, swt2

References
----------
.. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal
    Coastal Sea Level Fluctuations Using Wavelets. Journal of the American
    Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880.
    https://doi.org/10.2307/2965551
r   r   r   c              3   8   #    U  H  n[        U5      v   M     g 7frC   r   .0ss     r@   	<genexpr>mra2.<locals>.<genexpr>        =*Qa((*   Tr   axesr!   r"   dwt2r   r&   rU   r#   r'   r   r      )r(   minr-   r   r   r   r   r   r)   r*   r+   r,   r0   r.   r/   )r1   r   r#   rU   r2   r&   r3   r4   r5   r7   r8   r9   r:   r;   r=   r<   r>   r?   dcoeffsns                       r@   r   r      sB   n F?"BD D==$**==E$DA$HeHH%*6*	f	$DA(:%:6:(-f-3I;?@@JJ	ZB
jm$A#C1b\

jm<mBMM!$m<=  ]CF
#,C
yyDJJ%TZZ8ZrrZ89:cF1b\qAq	A"a(CF1I#,CyyDJJ&%TZZ @ZrrZ @ABNN3F1I  	%.)  9 = 9 !As   - I
I
1Ic                     U S   n[        S[        U 5      5       H  n[        S5       H  nXU   U   -  nM     M!     U$ )a  Inverse 2D multiresolution analysis via summation.

Parameters
----------
mra_coeffs : list
    Multiresolution analysis coefficients as returned by `mra2`.

Returns
-------
rec : ndarray
    The reconstructed signal.

See Also
--------
mra2

References
----------
.. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal
    Coastal Sea Level Fluctuations Using Wavelets. Journal of the American
    Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880.
    https://doi.org/10.2307/2965551
r   r   rX   )r,   r)   )r8   r>   r=   r[   s       r@   r   r     sH    0 Q-C1c*o&qAa=##C  ' JrI   c                 D   [        U R                  U5      u  p6n[        X5      nUS:X  aY  US:w  a  [        S5      eUc  [	        S U R                   5       5      nXSS.n	[        [        4USS.U	D6n
[        [        40 U	D6nOGUS:X  a3  [        XS5      nXUS	.n	[        [        4S
U0U	D6n
[        [        40 U	D6nO[        SU 35      eU
" U 5      n/ n[        U5      n[        R                  " US   5      nU/n[        SU5       HP  nUR                  UU   R!                  5        VVs0 s H  u  nnU[        R                  " U5      _M     snn5        MR     US   US'   U" U5      nUR                  U R                  :w  a2  U[#        U R                   Vs/ s H  n[%        U5      PM     sn5         nUR                  U5        UUS'   [        SU5       H  n0 n['        UU   R)                  5       5      nU Hz  nUU   U   nUU   U   UU   U'   U" U5      nUR                  U R                  :w  a2  U[#        U R                   Vs/ s H  n[%        U5      PM     sn5         nUUU'   UUU   U'   M|     UR                  U5        M     U$ s  snnf s  snf s  snf )a^  Forward nD multiresolution analysis.

It is a projection onto the wavelet subspaces.

Parameters
----------
data: array_like
    Input data
wavelet : Wavelet object or name string, or tuple of wavelets
    Wavelet to use. This can also be a tuple containing a wavelet to
    apply along each axis in `axes`.
level : int, optional
    Decomposition level (must be >= 0). If level is None (default) then it
    will be calculated using the `dwt_max_level` function.
axes : tuple of ints, optional
    Axes over which to compute the DWT. Repeated elements are not allowed.
transform : {'dwtn', 'swtn'}
    Whether to use the DWT or SWT for the transforms.
mode : str or tuple of str, optional
    Signal extension mode, see `Modes` (default: 'symmetric'). This option
    is only used when transform='dwtn'.

Returns
-------
coeffs : list
    For more information, see the detailed description in `wavedecn`.

See Also
--------
imran, swtn

Notes
-----
This is sometimes referred to as an additive decomposition because the
inverse transform (``imran``) is just the sum of the coefficient arrays
[1]_. The decomposition using ``transform='dwt'`` corresponds to section
2.2 while that using an undecimated transform (``transform='swt'``) is
described in section 3.2 and appendix A.

This transform does not share the variance partition property of ``swtn``
with `norm=True`. It does however, result in coefficients that are
temporally aligned regardless of the symmetry of the wavelet used.

The redundancy of this transform is ``(2**n - 1) * level + 1`` where ``n``
corresponds to the number of axes transformed.

References
----------
.. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal
    Coastal Sea Level Fluctuations Using Wavelets. Journal of the American
    Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880.
    https://doi.org/10.2307/2965551
r   r   r   c              3   8   #    U  H  n[        U5      v   M     g 7frC   rL   rM   s     r@   rP   mran.<locals>.<genexpr>a  rR   rS   TrT   r"   dwtnrW   r#   r'   r   r   )r   r-   r   r(   rY   r   r   r   r   r	   r   r)   r*   r+   r,   r0   itemsr.   r/   listkeys)r1   r   r#   rU   r2   r&   axes_shapesndim_transformwaveletsr3   r4   r5   modesr7   r8   r9   r:   r;   r=   kvr>   r?   rZ   dkeyss                            r@   r   r   "  s   n )<DJJ(M%D~!'0HF?"BD D==$**==E%TB$HeHH%*6*	f	+%dC(:%:6:(-f-3I;?@@JJ	ZB
jm$A#C1b\

JqM4G4G4IJ4IDAqAr}}Q''4IJK  ]CF
#,C
yyDJJ%TZZ8ZrrZ89:cCF1b\Z]'')*AAq	A"1a(CF1I #,CyyDJJ&%TZZ @ZrrZ @ABGAJCF1I  	'"# $ ? K 9" !As   ,$JJ
Jc                     U S   n[        S[        U 5      5       H"  nX   R                  5        H	  u  p4X-  nM     M$     U$ )a  Inverse nD multiresolution analysis via summation.

Parameters
----------
mra_coeffs : list
    Multiresolution analysis coefficients as returned by `mra2`.

Returns
-------
rec : ndarray
    The reconstructed signal.

See Also
--------
mran

References
----------
.. [1] Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal
    Coastal Sea Level Fluctuations Using Wavelets. Journal of the American
    Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880.
    https://doi.org/10.2307/2965551
r   r   )r,   r)   ra   )r8   r>   r=   rh   ri   s        r@   r   r     sG    0 Q-C1c*o&M'')DAHC * ' JrI   )Nr   r   )N)rl   r   r   )NNr   r   )	functoolsr   r   numpyr*   _multilevelr   r   r   r	   r
   r   r   _swtr   r   r   r   r   r   r   _utilsr   r   __all__r   r   r   r   r   r   rD   rI   r@   <module>rt      sl    %    E D D 7
; 7<dN26 >DjZ> :@qhrI   