§
    ¢éUgx7  ã                   óú   — d Z g d¢ZddlmZmZmZmZmZmZm	Z	m
Z
 ddlmZ ddlmZ i Zddefd„Z[i Zdefd	„Z[i Zdefd
„Z[i Zefd„Z[d„ Zi Zdefd„Z[i Zdefd„Z[i Zdefd„Z[i Zdefd„Z[i Zdefd„Z[dS )z1
Differential and pseudo-differential operators.
)
ÚdiffÚtilbertÚitilbertÚhilbertÚihilbertÚcs_diffÚcc_diffÚsc_diffÚss_diffÚshifté    )ÚpiÚasarrayÚsinÚcosÚsinhÚcoshÚtanhÚiscomplexobjé   )Úconvolve)Ú_datacopiedNc                 ó  — t          | ¦  «        }|dk    r|S t          |¦  «        r0t          |j        ||¦  «        dt          |j        ||¦  «        z  z   S |�dt
          z  |z  }nd}t          | ¦  «        }|                     |||f¦  «        }|€Qt          |¦  «        dk    r|r|                     ¦   «          |°||fd„}t          j
        |||d¬	¦  «        }|||||f<   t          || ¦  «        }	t          j	        |||dz  |	¬
¦  «        S )a*  
    Return kth derivative (or integral) of a periodic sequence x.

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = pow(sqrt(-1)*j*2*pi/period, order) * x_j
      y_0 = 0 if order is not 0.

    Parameters
    ----------
    x : array_like
        Input array.
    order : int, optional
        The order of differentiation. Default order is 1. If order is
        negative, then integration is carried out under the assumption
        that ``x_0 == 0``.
    period : float, optional
        The assumed period of the sequence. Default is ``2*pi``.

    Notes
    -----
    If ``sum(x, axis=0) = 0`` then ``diff(diff(x, k), -k) == x`` (within
    numerical accuracy).

    For odd order and even ``len(x)``, the Nyquist mode is taken zero.

    r   ù              ð?Né   ç      ð?é   c                 ó0   — | rt          || z  |¦  «        S dS ©Nr   )Úpow)ÚkÚorderÚcs      úZ/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/scipy/fftpack/_pseudo_diffs.pyÚkernelzdiff.<locals>.kernelA   s!   € Øð &Ý˜1˜Q™3˜u‘~”~Ð%Ø�1ó    r   ©ÚdÚzero_nyquist©Úswap_real_imagÚoverwrite_x)r   r   r   ÚrealÚimagr   ÚlenÚgetÚpopitemr   Úinit_convolution_kernelr   )
Úxr!   ÚperiodÚ_cacheÚtmpr"   ÚnÚomegar$   r+   s
             r#   r   r      sT  € õ: �!‰*Œ*€CØ�‚z€zØˆ
Ý�CÑÔð JÝ�C”H˜U 6Ñ*Ô*¨2­d°3´8¸EÀ&Ñ.IÔ.IÑ+IÑIÐIØÐØ�b‰D�‰KˆˆàˆÝˆA‰Œ€AØ�JŠJ˜˜% �{Ñ#Ô#€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ! 1ð 	ð 	ð 	ð 	õ Ô0°°6¸EØ>?ðAñ Aô Aˆà#ˆ��%˜ˆ{ÑÝ˜c 1Ñ%Ô%€KÝÔ˜S °e¸a±iØ)4ð6ñ 6ô 6ð 6r%   c                 óþ  — t          | ¦  «        }t          |¦  «        r0t          |j        ||¦  «        dt          |j        ||¦  «        z  z   S |�|dz  t
          z  |z  }t          | ¦  «        }|                     ||f¦  «        }|€Nt          |¦  «        dk    r|r|                     ¦   «          |°|fd„}t          j
        ||d¬¦  «        }||||f<   t          || ¦  «        }t          j	        ||d|¬¦  «        S )	a�  
    Return h-Tilbert transform of a periodic sequence x.

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

        y_j = sqrt(-1)*coth(j*h*2*pi/period) * x_j
        y_0 = 0

    Parameters
    ----------
    x : array_like
        The input array to transform.
    h : float
        Defines the parameter of the Tilbert transform.
    period : float, optional
        The assumed period of the sequence. Default period is ``2*pi``.

    Returns
    -------
    tilbert : ndarray
        The result of the transform.

    Notes
    -----
    If ``sum(x, axis=0) == 0`` and ``n = len(x)`` is odd, then
    ``tilbert(itilbert(x)) == x``.

    If ``2 * pi * h / period`` is approximately 10 or larger, then
    numerically ``tilbert == hilbert``
    (theoretically oo-Tilbert == Hilbert).

    For even ``len(x)``, the Nyquist mode of ``x`` is taken zero.

    r   Nr   r   c                 ó4   — | rdt          || z  ¦  «        z  S dS )Nr   r   ©r   ©r    Úhs     r#   r$   ztilbert.<locals>.kernel†   s#   € Øð %Ø�4  !¡™9œ9‘}Ð$à�1r%   r   ©r'   r)   )r   r   r   r,   r-   r   r.   r/   r0   r   r1   r   ©	r2   r<   r3   r4   r5   r6   r7   r$   r+   s	            r#   r   r   S   s+  € õH �!‰*Œ*€CÝ�CÑÔð 1Ý�s”x  FÑ+Ô+Ø•G˜CœH a¨Ñ0Ô0Ñ0ñ1ð 	1ð ÐØ�‰E•B‰J˜ÑˆåˆA‰Œ€AØ�JŠJ˜˜1�vÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ð 	ð 	ð 	ð 	õ Ô0°°F¸aÐ@Ñ@Ô@ˆØˆ��!ˆu‰å˜c 1Ñ%Ô%€KÝÔ˜S °aÀKÐPÑPÔPÐPr%   c                 óþ  — t          | ¦  «        }t          |¦  «        r0t          |j        ||¦  «        dt          |j        ||¦  «        z  z   S |�|dz  t
          z  |z  }t          | ¦  «        }|                     ||f¦  «        }|€Nt          |¦  «        dk    r|r|                     ¦   «          |°|fd„}t          j
        ||d¬¦  «        }||||f<   t          || ¦  «        }t          j	        ||d|¬¦  «        S )	a  
    Return inverse h-Tilbert transform of a periodic sequence x.

    If ``x_j`` and ``y_j`` are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = -sqrt(-1)*tanh(j*h*2*pi/period) * x_j
      y_0 = 0

    For more details, see `tilbert`.

    r   Nr   r   c                 ó0   — | rt          || z  ¦  «         S dS r   r:   r;   s     r#   r$   zitilbert.<locals>.kernel³   s!   € Øð "Ý˜Q˜q™S™	œ	�zÐ!Ø�1r%   r   r=   r)   )r   r   r   r,   r-   r   r.   r/   r0   r   r1   r   r>   s	            r#   r   r   ™   s'  € õ �!‰*Œ*€CÝ�CÑÔð .Ý˜œ  6Ñ*Ô*Ø•(˜3œ8 A fÑ-Ô-Ñ-ñ.ð 	.àÐØˆa‰C•‰F�6‰MˆÝˆA‰Œ€AØ�JŠJ˜˜!�uÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ð 	ð 	ð 	ð 	õ Ô0°°6¸AÐ>Ñ>Ô>ˆØˆ��!ˆu‰Ý˜c 1Ñ%Ô%€KÝÔ˜S °aÀKÐPÑPÔPÐPr%   c                 óÆ  — t          | ¦  «        }t          |¦  «        r,t          |j        ¦  «        dt          |j        ¦  «        z  z   S t          | ¦  «        }|                     |¦  «        }|€Jt          |¦  «        dk    r|r|                     ¦   «          |°d„ }t          j	        ||d¬¦  «        }|||<   t          || ¦  «        }t          j        ||d|¬¦  «        S )aú  
    Return Hilbert transform of a periodic sequence x.

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = sqrt(-1)*sign(j) * x_j
      y_0 = 0

    Parameters
    ----------
    x : array_like
        The input array, should be periodic.
    _cache : dict, optional
        Dictionary that contains the kernel used to do a convolution with.

    Returns
    -------
    y : ndarray
        The transformed input.

    See Also
    --------
    scipy.signal.hilbert : Compute the analytic signal, using the Hilbert
                           transform.

    Notes
    -----
    If ``sum(x, axis=0) == 0`` then ``hilbert(ihilbert(x)) == x``.

    For even len(x), the Nyquist mode of x is taken zero.

    The sign of the returned transform does not have a factor -1 that is more
    often than not found in the definition of the Hilbert transform. Note also
    that `scipy.signal.hilbert` does have an extra -1 factor compared to this
    function.

    r   Nr   c                 ó&   — | dk    rdS | dk     rdS dS )Nr   r   g      ð¿g        © )r    s    r#   r$   zhilbert.<locals>.kernelô   s#   € Ø�1ŠuˆuØ�sØ�Q’�Ø�tØ�3r%   r   r=   r)   )r   r   r   r,   r-   r.   r/   r0   r   r1   r   )r2   r4   r5   r6   r7   r$   r+   s          r#   r   r   Ã   sð   € õN �!‰*Œ*€CÝ�CÑÔð 6Ý�s”xÑ Ô  ¥G¨C¬HÑ$5Ô$5Ñ!5Ñ5Ð5ÝˆA‰Œ€AØ�JŠJ�q‰MŒM€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð	ð 	ð 	õ Ô0°°6¸AÐ>Ñ>Ô>ˆØˆˆq‰	Ý˜c 1Ñ%Ô%€KÝÔ˜S °aÀKÐPÑPÔPÐPr%   c                 ó"   — t          | ¦  «         S )zå
    Return inverse Hilbert transform of a periodic sequence x.

    If ``x_j`` and ``y_j`` are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = -sqrt(-1)*sign(j) * x_j
      y_0 = 0

    )r   )r2   s    r#   r   r     s   € õ �A‰JŒJˆ;Ðr%   c                 ó(  — t          | ¦  «        }t          |¦  «        r2t          |j        |||¦  «        dt          |j        |||¦  «        z  z   S |� |dz  t
          z  |z  }|dz  t
          z  |z  }t          | ¦  «        }|                     |||f¦  «        }|€Pt          |¦  «        dk    r|r|                     ¦   «          |°||fd„}t          j
        ||d¬¦  «        }|||||f<   t          || ¦  «        }	t          j	        ||d|	¬¦  «        S )	aô  
    Return (a,b)-cosh/sinh pseudo-derivative of a periodic sequence.

    If ``x_j`` and ``y_j`` are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = -sqrt(-1)*cosh(j*a*2*pi/period)/sinh(j*b*2*pi/period) * x_j
      y_0 = 0

    Parameters
    ----------
    x : array_like
        The array to take the pseudo-derivative from.
    a, b : float
        Defines the parameters of the cosh/sinh pseudo-differential
        operator.
    period : float, optional
        The period of the sequence. Default period is ``2*pi``.

    Returns
    -------
    cs_diff : ndarray
        Pseudo-derivative of periodic sequence `x`.

    Notes
    -----
    For even len(`x`), the Nyquist mode of `x` is taken as zero.

    r   Nr   r   c                 óV   — | r&t          || z  ¦  «         t          || z  ¦  «        z  S dS r   )r   r   ©r    ÚaÚbs      r#   r$   zcs_diff.<locals>.kernel@  s0   € Øð ,Ý˜Q˜q™S™	œ	�z¥$ q¨¡s¡)¤)Ñ+Ð+Ø�1r%   r   r=   r)   )r   r   r   r,   r-   r   r.   r/   r0   r   r1   r   ©
r2   rH   rI   r3   r4   r5   r6   r7   r$   r+   s
             r#   r   r     sB  € õ< �!‰*Œ*€CÝ�CÑÔð /Ý�s”x  ! FÑ+Ô+Ø•'˜#œ( 1 Q vÑ.Ô.Ñ.ñ/ð 	/àÐØˆa‰C•‰F�6‰MˆØˆa‰C•‰F�6‰MˆÝˆA‰Œ€AØ�JŠJ˜˜!˜A�wÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ˜1ð 	ð 	ð 	ð 	õ Ô0°°6¸AÐ>Ñ>Ô>ˆØˆ��!�Aˆw‰Ý˜c 1Ñ%Ô%€KÝÔ˜S °aÀKÐPÑPÔPÐPr%   c                 ó(  — t          | ¦  «        }t          |¦  «        r2t          |j        |||¦  «        dt          |j        |||¦  «        z  z   S |� |dz  t
          z  |z  }|dz  t
          z  |z  }t          | ¦  «        }|                     |||f¦  «        }|€Pt          |¦  «        dk    r|r|                     ¦   «          |°||fd„}t          j
        ||d¬¦  «        }|||||f<   t          || ¦  «        }	t          j	        ||d|	¬¦  «        S )	aˆ  
    Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x.

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j
      y_0 = 0

    Parameters
    ----------
    x : array_like
        Input array.
    a,b : float
        Defines the parameters of the sinh/cosh pseudo-differential
        operator.
    period : float, optional
        The period of the sequence x. Default is 2*pi.

    Notes
    -----
    ``sc_diff(cs_diff(x,a,b),b,a) == x``
    For even ``len(x)``, the Nyquist mode of x is taken as zero.

    r   Nr   r   c                 óT   — | r%t          || z  ¦  «        t          || z  ¦  «        z  S dS r   )r   r   rG   s      r#   r$   zsc_diff.<locals>.kernelx  s.   € Øð +Ý˜A˜a™C‘y”y¥ a¨¡c¡¤Ñ*Ð*Ø�1r%   r   r=   r)   )r   r   r	   r,   r-   r   r.   r/   r0   r   r1   r   rJ   s
             r#   r	   r	   P  sB  € õ4 �!‰*Œ*€CÝ�CÑÔð /Ý�s”x  ! FÑ+Ô+Ø•'˜#œ( 1 Q vÑ.Ô.Ñ.ñ/ð 	/àÐØˆa‰C•‰F�6‰MˆØˆa‰C•‰F�6‰MˆÝˆA‰Œ€AØ�JŠJ˜˜!˜A�wÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ˜1ð 	ð 	ð 	ð 	õ Ô0°°6¸AÐ>Ñ>Ô>ˆØˆ��!�Aˆw‰Ý˜c 1Ñ%Ô%€KÝÔ˜S °aÀKÐPÑPÔPÐPr%   c                 ó"  — t          | ¦  «        }t          |¦  «        r2t          |j        |||¦  «        dt          |j        |||¦  «        z  z   S |� |dz  t
          z  |z  }|dz  t
          z  |z  }t          | ¦  «        }|                     |||f¦  «        }|€Nt          |¦  «        dk    r|r|                     ¦   «          |°||fd„}t          j
        ||¦  «        }|||||f<   t          || ¦  «        }	t          j	        |||	¬¦  «        S )ac  
    Return (a,b)-sinh/sinh pseudo-derivative of a periodic sequence x.

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = sinh(j*a*2*pi/period)/sinh(j*b*2*pi/period) * x_j
      y_0 = a/b * x_0

    Parameters
    ----------
    x : array_like
        The array to take the pseudo-derivative from.
    a,b
        Defines the parameters of the sinh/sinh pseudo-differential
        operator.
    period : float, optional
        The period of the sequence x. Default is ``2*pi``.

    Notes
    -----
    ``ss_diff(ss_diff(x,a,b),b,a) == x``

    r   Nr   r   c                 ót   — | r%t          || z  ¦  «        t          || z  ¦  «        z  S t          |¦  «        |z  S ©N)r   ÚfloatrG   s      r#   r$   zss_diff.<locals>.kernel¯  s9   € Øð +Ý˜A˜a™C‘y”y¥ a¨¡c¡¤Ñ*Ð*Ý˜‘8”8˜A‘:Ðr%   ©r+   )r   r   r
   r,   r-   r   r.   r/   r0   r   r1   r   rJ   s
             r#   r
   r
   ˆ  s;  € õ2 �!‰*Œ*€CÝ�CÑÔð /Ý�s”x  ! FÑ+Ô+Ø•'˜#œ( 1 Q vÑ.Ô.Ñ.ñ/ð 	/àÐØˆa‰C•‰F�6‰MˆØˆa‰C•‰F�6‰MˆÝˆA‰Œ€AØ�JŠJ˜˜!˜A�wÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ˜1ð 	ð 	ð 	ð 	õ Ô0°°6Ñ:Ô:ˆØˆ��!�Aˆw‰Ý˜c 1Ñ%Ô%€KÝÔ˜S °;Ð?Ñ?Ô?Ð?r%   c                 ó"  — t          | ¦  «        }t          |¦  «        r2t          |j        |||¦  «        dt          |j        |||¦  «        z  z   S |� |dz  t
          z  |z  }|dz  t
          z  |z  }t          | ¦  «        }|                     |||f¦  «        }|€Nt          |¦  «        dk    r|r|                     ¦   «          |°||fd„}t          j
        ||¦  «        }|||||f<   t          || ¦  «        }	t          j	        |||	¬¦  «        S )a¶  
    Return (a,b)-cosh/cosh pseudo-derivative of a periodic sequence.

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

      y_j = cosh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j

    Parameters
    ----------
    x : array_like
        The array to take the pseudo-derivative from.
    a,b : float
        Defines the parameters of the sinh/sinh pseudo-differential
        operator.
    period : float, optional
        The period of the sequence x. Default is ``2*pi``.

    Returns
    -------
    cc_diff : ndarray
        Pseudo-derivative of periodic sequence `x`.

    Notes
    -----
    ``cc_diff(cc_diff(x,a,b),b,a) == x``

    r   Nr   r   c                 óL   — t          || z  ¦  «        t          || z  ¦  «        z  S rO   )r   rG   s      r#   r$   zcc_diff.<locals>.kernelê  s!   € Ý˜˜!™‘9”9�T ! A¡#™YœYÑ&Ð&r%   rQ   )r   r   r   r,   r-   r   r.   r/   r0   r   r1   r   rJ   s
             r#   r   r   ¿  s9  € õ: �!‰*Œ*€CÝ�CÑÔð /Ý�s”x  ! FÑ+Ô+Ø•'˜#œ( 1 Q vÑ.Ô.Ñ.ñ/ð 	/àÐØˆa‰C•‰F�6‰MˆØˆa‰C•‰F�6‰MˆÝˆA‰Œ€AØ�JŠJ˜˜!˜A�wÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ˜1ð 	'ð 	'ð 	'ð 	'åÔ0°°6Ñ:Ô:ˆØˆ��!�Aˆw‰Ý˜c 1Ñ%Ô%€KÝÔ˜S °;Ð?Ñ?Ô?Ð?r%   c                 óJ  — t          | ¦  «        }t          |¦  «        r0t          |j        ||¦  «        dt          |j        ||¦  «        z  z   S |�|dz  t
          z  |z  }t          | ¦  «        }|                     ||f¦  «        }|€ot          |¦  «        dk    r|r|                     ¦   «          |°|fd„}|fd„}t          j
        ||dd¬¦  «        }	t          j
        ||d	d¬¦  «        }
|	|
f|||f<   n|\  }	}
t          || ¦  «        }t          j        ||	|
|¬
¦  «        S )aò  
    Shift periodic sequence x by a: y(u) = x(u+a).

    If x_j and y_j are Fourier coefficients of periodic functions x
    and y, respectively, then::

          y_j = exp(j*a*2*pi/period*sqrt(-1)) * x_f

    Parameters
    ----------
    x : array_like
        The array to take the pseudo-derivative from.
    a : float
        Defines the parameters of the sinh/sinh pseudo-differential
    period : float, optional
        The period of the sequences x and y. Default period is ``2*pi``.
    r   Nr   r   c                 ó&   — t          || z  ¦  «        S rO   )r   ©r    rH   s     r#   Úkernel_realzshift.<locals>.kernel_real  ó   € Ý�q˜‘s‘8”8ˆOr%   c                 ó&   — t          || z  ¦  «        S rO   )r   rV   s     r#   Úkernel_imagzshift.<locals>.kernel_imag  rX   r%   r   r&   r   rQ   )r   r   r   r,   r-   r   r.   r/   r0   r   r1   r   Ú
convolve_z)r2   rH   r3   r4   r5   r6   r7   rW   rZ   Ú
omega_realÚ
omega_imagr+   s               r#   r   r   ø  sƒ  € õ$ �!‰*Œ*€CÝ�CÑÔð DÝ�S”X˜a Ñ'Ô'¨­5°´¸!¸FÑ+CÔ+CÑ(CÑCÐCØÐØˆa‰C•‰F�6‰MˆÝˆA‰Œ€AØ�JŠJ˜˜!�uÑÔ€EØ€}Ýˆv‰;Œ;˜ÒÐØð !Ø—’Ñ Ô Ð ð ð !ð ð 	ð 	ð 	ð 	ð ð 	ð 	ð 	ð 	åÔ5°a¸ÀaØCDðFñ Fô Fˆ
åÔ5°a¸ÀaØCDðFñ Fô Fˆ
à" :Ð-ˆ��!ˆu‰ˆà %Ñˆ
�:Ý˜c 1Ñ%Ô%€KÝÔ˜s :¨jØ+6ð8ñ 8ô 8ð 8r%   )Ú__doc__Ú__all__Únumpyr   r   r   r   r   r   r   r   Ú r   Úscipy.fft._pocketfft.helperr   r4   r   r   r   r   r   r   r	   r
   r   r   rC   r%   r#   ú<module>rc      s  ððð ð
ð ð €ð
 HÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ Ð Ð Ð Ð Ð à 3Ð 3Ð 3Ð 3Ð 3Ð 3ð 
€ð ˜$ vð 66ð 66ð 66ð 66ðr ð 
€ð  fð =Qð =Qð =Qð =Qð@ ð 
€ð  Vð !Qð !Qð !Qð !QðH ð 
€ð ð :Qð :Qð :Qð :Qðz ðð ð ð 
€ð !¨ð 3Qð 3Qð 3Qð 3Qðl ð 
€ð !¨ð /Qð /Qð /Qð /Qðd ð 
€ð !¨ð .@ð .@ð .@ð .@ðb ð 
€ð !¨ð 0@ð 0@ð 0@ð 0@ðf ð 
€ð  Fð ,8ð ,8ð ,8ð ,8ð^ €F€Fr%   