+
    /i$8                         ^ RI Ht ^ RIHt ^ RIHtHtHt ^ RI	H
u Ht ^ RIHt ^ RIHt ^RIHt RRRR	R/R
 lltR tR tR tRR ltR# )    )float_factorial)numpy)array_namespacexp_swapaxes	xp_deviceN)
convolve1d)
_polyutils)
axis_slicexpdevicec               P   W8  d   \        R4      h\        V ^4      w  rVf   V	^ 8X  d   VR,
          pMTp^ Tu;8:  d   V 8  g   M \        R4      hVR9  d   \        R4      hVf   \        M\        VP	                  ^ 4      4      pW!8  d    VP                  WP                  VR7      p
V
# VP                  V) W,
          VP                  VR7      pVR8X  d   VP                  V4      pVP                  VP                  V^,           VP                  VR7      R	4      pW,          pVP                  V^,           VP                  VR7      p\        P                  ! W4      P                  \        V4      W2,          ,          4      p\        P                  ! WVR7      w  p
  pV
# )
a
  Compute the coefficients for a 1-D Savitzky-Golay FIR filter.

Parameters
----------
window_length : int
    The length of the filter window (i.e., the number of coefficients).
polyorder : int
    The order of the polynomial used to fit the samples.
    `polyorder` must be less than `window_length`.
deriv : int, optional
    The order of the derivative to compute. This must be a
    nonnegative integer. The default is 0, which means to filter
    the data without differentiating.
delta : float, optional
    The spacing of the samples to which the filter will be applied.
    This is only used if deriv > 0.
pos : int or None, optional
    If pos is not None, it specifies evaluation position within the
    window. The default is the middle of the window.
use : str, optional
    Either 'conv' or 'dot'. This argument chooses the order of the
    coefficients. The default is 'conv', which means that the
    coefficients are ordered to be used in a convolution. With
    use='dot', the order is reversed, so the filter is applied by
    dotting the coefficients with the data set.

Returns
-------
coeffs : 1-D ndarray
    The filter coefficients.

See Also
--------
savgol_filter

Notes
-----
.. versionadded:: 0.14.0

References
----------
A. Savitzky, M. J. E. Golay, Smoothing and Differentiation of Data by
Simplified Least Squares Procedures. Analytical Chemistry, 1964, 36 (8),
pp 1627-1639.
Jianwen Luo, Kui Ying, and Jing Bai. 2005. Savitzky-Golay smoothing and
differentiation filter for even number data. Signal Process.
85, 7 (July 2005), 1429-1434.

Examples
--------
>>> import numpy as np
>>> from scipy.signal import savgol_coeffs
>>> savgol_coeffs(5, 2)
array([-0.08571429,  0.34285714,  0.48571429,  0.34285714, -0.08571429])
>>> savgol_coeffs(5, 2, deriv=1)
array([ 2.00000000e-01,  1.00000000e-01,  2.07548111e-16, -1.00000000e-01,
       -2.00000000e-01])

Note that use='dot' simply reverses the coefficients.

>>> savgol_coeffs(5, 2, pos=3)
array([ 0.25714286,  0.37142857,  0.34285714,  0.17142857, -0.14285714])
>>> savgol_coeffs(5, 2, pos=3, use='dot')
array([-0.14285714,  0.17142857,  0.34285714,  0.37142857,  0.25714286])
>>> savgol_coeffs(4, 2, pos=3, deriv=1, use='dot')
array([0.45,  -0.85,  -0.65,  1.05])

`x` contains data from the parabola x = t**2, sampled at
t = -1, 0, 1, 2, 3.  `c` holds the coefficients that will compute the
derivative at the last position.  When dotted with `x` the result should
be 6.

>>> x = np.array([1, 0, 1, 4, 9])
>>> c = savgol_coeffs(5, 2, pos=4, deriv=1, use='dot')
>>> c.dot(x)
6.0
z*polyorder must be less than window_length.g      ?z4pos must be nonnegative and less than window_length.convz`use` must be 'conv' or 'dot'dtyper   r   )r   dot   )
ValueErrordivmod	np_compatr   emptyzerosfloat64arangeflipreshapexpxatsetr   _pu_lstsq)window_length	polyorderderivdeltaposuser   r   halflenremcoeffsxorderAy_s   &&&&&&$$        Z/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/signal/_savitzky_golay.pysavgol_coeffsr3      s{   x !EFF-+LG
{!8C-CC$}$ * + 	+ /!899 jobhhqk&BB-zz&I 			3$+2::f	MA
f}GGAJJJ
		)a-rzz&	A7E 	

A 	Qbjj@A 	q_U3u~FGA jj"-OFAq!M    c          
        V^ 8X  d   T pV# V P                   ^ ,          pWA8:  d   VP                  V R,          4      pV# VP                  V RV) 1R3,          RR7      p\        V4       F  pVP	                  WF,
          ^,
          W,
          ^,
          RV P
                  \        V 4      R7      pWRP                  WtV,
          3RV P                  ^,
          ,          ,           4      ,          pK  	  TpV# )	a4  Differentiate polynomials represented with coefficients.

p must be a 1-D or 2-D array.  In the 2-D case, each column gives
the coefficients of a polynomial; the first row holds the coefficients
associated with the highest power. m must be a nonnegative integer.
(numpy.polyder doesn't handle the 2-D case.)
.NT)copyr   ):Nr   N.r   )r   )	shape
zeros_likeasarrayranger   r   r   r   ndim)pmr   resultndpkrngs   &&$     r2   _polyderrC      s     	Av M GGAJ6]]1W:.F M Acrc3hKd3B1XiiEAIquqy"AGGIaL    jj1uh!1D&DEE	 
 FMr4   c
           
        \        V 4      p
\        WW%R7      pV^ 8X  g   WPP                  ) 8X  d   TpRpM\        W^ V
4      pRpV
P	                  WP
                  ^ ,          R34      p\        P                  ! V
P                  ^ W!,
          V P                  \        V 4      R7      WV
R7      pV^ 8  d   \        WV
R7      pV
P                  W1,
          WA,
          VP                  \        V4      R7      p\        P                  ! WP	                  VR	4      V
R7      W,          ,          p\        V	P
                  4      pVV,          V^ ,          uV^ &   VV&   V
P	                  VWC,
          .VR,          O54      pV'       d   \        V^ WZ4      p\        R4      .V	P                  ,          p\        W44      VV&   \        P                   ! V	\#        V4      4      P%                  V4      p	V	# )
a-  
Given an N-d array `x` and the specification of a slice of `x` from
`window_start` to `window_stop` along `axis`, create an interpolating
polynomial of each 1-D slice, and evaluate that polynomial in the slice
from `interp_start` to `interp_stop`. Put the result into the
corresponding slice of `y`.
)startstopaxisFTr   r   :r   NNNr   r   )r   r
   r;   r   r   r7   r"   polyfitr   r   r   rC   polyvallistslicer   r    tupler!   )r-   window_startwindow_stopinterp_startinterp_stoprG   r%   r&   r'   r0   r   x_edgexx_edgeswappedpoly_coeffsivaluesshpy_slices   &&&&&&&&&&         r2   	_fit_edgerY      s    
	B KKFqyDVVGOfAr2jj==#3R"89G ++
		{)1 	 	
"K qy{b9 			#[%?	+(> 	 	A [[jjG&<DWF qww-CD	3q6CFCIZZ!; Fc"g FGFVQ1T{maff$G,4GDMq%.!%%f-AHr4   c                    V^,          p\        V ^ V^ WuW#WF4
      pV P                  V,          p\        WV,
          WV,
          WW#WF4
      pV# )z
Use polynomial interpolation of x at the low and high ends of the axis
to fill in the halflen values in y.

This function just calls _fit_edge twice, once for each end of the axis.
)rY   r7   )	r-   r$   r%   r&   r'   rG   r0   r*   r?   s	   &&&&&&&  r2   _fit_edges_polyfitr[      sY     q G!Qq'	*A	A!&w;	*A Hr4   c           
        VR9  d   \        R4      h\        V 4      pVP                  V 4      p V P                  VP                  8w  d7   V P                  VP
                  8w  d   VP                  WP                  4      p \        WW4V\        V 4      R7      p	VR8X  dA   WP                  V,          8  d   \        R4      h\        W	VRR7      p
\        WW#WEV
4      p
V
# \        W	WVVR7      p
V
# )	a9  Apply a Savitzky-Golay filter to an array.

This is a 1-D filter. If `x`  has dimension greater than 1, `axis`
determines the axis along which the filter is applied.

Parameters
----------
x : array_like
    The data to be filtered. If `x` is not a single or double precision
    floating point array, it will be converted to type ``numpy.float64``
    before filtering.
window_length : int
    The length of the filter window (i.e., the number of coefficients).
    If `mode` is 'interp', `window_length` must be less than or equal
    to the size of `x`.
polyorder : int
    The order of the polynomial used to fit the samples.
    `polyorder` must be less than `window_length`.
deriv : int, optional
    The order of the derivative to compute. This must be a
    nonnegative integer. The default is 0, which means to filter
    the data without differentiating.
delta : float, optional
    The spacing of the samples to which the filter will be applied.
    This is only used if deriv > 0. Default is 1.0.
axis : int, optional
    The axis of the array `x` along which the filter is to be applied.
    Default is -1.
mode : str, optional
    Must be 'mirror', 'constant', 'nearest', 'wrap' or 'interp'. This
    determines the type of extension to use for the padded signal to
    which the filter is applied.  When `mode` is 'constant', the padding
    value is given by `cval`.  See the Notes for more details on 'mirror',
    'constant', 'wrap', and 'nearest'.
    When the 'interp' mode is selected (the default), no extension
    is used.  Instead, a degree `polyorder` polynomial is fit to the
    last `window_length` values of the edges, and this polynomial is
    used to evaluate the last `window_length // 2` output values.
cval : scalar, optional
    Value to fill past the edges of the input if `mode` is 'constant'.
    Default is 0.0.

Returns
-------
y : ndarray, same shape as `x`
    The filtered data.

See Also
--------
savgol_coeffs

Notes
-----
Details on the `mode` options:

    'mirror':
        Repeats the values at the edges in reverse order. The value
        closest to the edge is not included.
    'nearest':
        The extension contains the nearest input value.
    'constant':
        The extension contains the value given by the `cval` argument.
    'wrap':
        The extension contains the values from the other end of the array.

For example, if the input is [1, 2, 3, 4, 5, 6, 7, 8], and
`window_length` is 7, the following shows the extended data for
the various `mode` options (assuming `cval` is 0)::

    mode       |   Ext   |         Input          |   Ext
    -----------+---------+------------------------+---------
    'mirror'   | 4  3  2 | 1  2  3  4  5  6  7  8 | 7  6  5
    'nearest'  | 1  1  1 | 1  2  3  4  5  6  7  8 | 8  8  8
    'constant' | 0  0  0 | 1  2  3  4  5  6  7  8 | 0  0  0
    'wrap'     | 6  7  8 | 1  2  3  4  5  6  7  8 | 1  2  3

.. versionadded:: 0.14.0

Examples
--------
>>> import numpy as np
>>> from scipy.signal import savgol_filter
>>> np.set_printoptions(precision=2)  # For compact display.
>>> x = np.array([2, 2, 5, 2, 1, 0, 1, 4, 9])

Filter with a window length of 5 and a degree 2 polynomial.  Use
the defaults for all other parameters.

>>> savgol_filter(x, 5, 2)
array([1.66, 3.17, 3.54, 2.86, 0.66, 0.17, 1.  , 4.  , 9.  ])

Note that the last five values in x are samples of a parabola, so
when mode='interp' (the default) is used with polyorder=2, the last
three values are unchanged. Compare that to, for example,
`mode='nearest'`:

>>> savgol_filter(x, 5, 2, mode='nearest')
array([1.74, 3.03, 3.54, 2.86, 0.66, 0.17, 1.  , 4.6 , 7.97])

constantinterpz@mode must be 'mirror', 'constant', 'nearest' 'wrap' or 'interp'.)r&   r'   r   r   zOIf mode is 'interp', window_length must be less than or equal to the size of x.)rG   mode)rG   r_   cval)mirrorr]   nearestr^   wrap)r   r   r9   r   r   float32astyper3   r   r7   r   r[   )r-   r$   r%   r&   r'   rG   r_   r`   r   r,   r0   s   &&&&&&&&   r2   savgol_filterrf      s    L FF / 0 	0 
	B


1Aww"**BJJ!6IIa$r)TU,F x774=( ? @ @ qt*=q5PQR
 H qtTBHr4   )r         ?Nr   )r   rg   r   r^   g        )scipy._lib._utilr   scipy._lib.array_api_compatr   r   scipy._lib._array_apir   r   r   scipy._lib.array_api_extra_libarray_api_extrar   scipy.ndimager   scipy.signalr	   r"   _arraytoolsr
   r3   rC   rY   r[   rf    r4   r2   <module>rr      sO    , : I I ( ( $ * #M$(M15M`43n"Br4   