o
    i                     @   sn   d Z ddlZddlZddlmZ ddlmZ dd Zddd	Z	ej
d
g dej
dg ddd ZdS )zTests for spline filtering.    N)assert_almost_equal)ndimagec                 C   s.   dgdgddgddgg dg dd}||  S )z0Knot values to the right of a B-spline's center.         )   L   r   )B      r   r   r         r       )orderknot_valuesr   r   o/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/scipy/ndimage/tests/test_splines.pyget_spline_knot_values
   s   r   mirrorc                 C   sJ  t |}t| | f}t|D ]%\}}t|| }|dkr$||||f< q||||| f< |||| |f< q|d dt|dd   }|dkrLd\}	}
n|dkrUd\}	}
n|d	kr^d
\}	}
ntd| tt|d D ]3}t||d d D ]&\}}|||	|
|  f  |7  < || d |	 d |
|  f  |7  < qyqm|| S )z1Matrix to invert to find the spline coefficients.r   r   r   Nr   )r   r   reflect)r   r   	grid-wrap)r   zunsupported mode )	r   npZzeros	enumerateZarangesum
ValueErrorrangelen)nr   moder   matrixZdiagZ
knot_valueindicesZknot_values_sumstartsteprowidxr   r   r   make_spline_knot_matrix   s,   


*r&   r   r   r   )r   r   r   c                 C   sn   d}t j|td}tj|d| |d}tj|d| |d}t|| |d}t|t || t|t ||j d S )Nd   )Zdtyper   )Zaxisr   r   r   )r   )	r   eyefloatr   Zspline_filter1dr&   r   dotT)r   r   r   r(   Zspline_filter_axis_0Zspline_filter_axis_1r    r   r   r   %test_spline_filter_vs_matrix_solution6   s   

r,   )r   )__doc__numpyr   ZpytestZnumpy.testingr   Zscipyr   r   r&   markZparametrizer,   r   r   r   r   <module>   s    
 