+
    nDj                        R t ^ RIt^ RIt^ RIHtHtHt ^ RIH	t	 ]P                  P                  tR tRR lt]! ]	P                  4      ]P                  P                  R. RO4      ]P                  P                  R. RO4      R 4       4       4       t]! ]	P                  4      ]! R	R
R7      ]P                  P                  R. RO4      ]P                  P                  R. RO4      R 4       4       4       4       tR# )zTests for spline filtering.N)assert_almost_equalxp_assert_closemake_xp_test_case)ndimagec                B    ^ ^.^^.^^^.^^^.^. RO^. RO/pW,          # )z0Knot values to the right of a B-spline's center.)   L      )B      r	    )orderknot_valuess   & Z/data/cameron/venvs/s3viz/lib/python3.14/site-packages/scipy/ndimage/tests/test_splines.pyget_spline_knot_valuesr      s>    qcqcq!fq!flk#K     c                   \        V4      p\        P                  ! W34      p\        V4       FA  w  rg\        P                  ! Wa4      pV^ 8X  d   WuW3&   K)  WuWV,
          3&   WuW,
          V3&   KC  	  V^ ,          ^\        VR,          4      ,          ,           p	VR8X  d   ^^rM$VR8X  d   ^ ^rMVR8X  d   RRrM\        RV 24      h\        \        V4      ^,
          4       Fv  p\        WL^,           R 4       F[  w  rW\WV,          ,           3;;,          V,          uu&   W\) ^,
          V
) ^,
          W,          ,
          3;;,          V,          uu&   K]  	  Kx  	  V P                  WY,          4      # )z1Matrix to invert to find the spline coefficients.:r	   NNmirrorreflect	grid-wrapzunsupported mode N)
r   npzeros	enumeratearangesum
ValueErrorrangelenasarray)xpnr   moder   matrixdiag
knot_valueindicesknot_values_sumstartsteprowidxs   &&&&          r   make_spline_knot_matrixr,      sT   (/K XXqfF%k2))D$19'17#$.87dN*+.87>7*+ 3 "!nq3{2+?'??Oxt		t		"t,TF344S%)*(1WX)>?OCS(()Z7)4!8eVaZ$(223zA3  @ +
 ::f.//r   r   r"   c                     ^dpVP                  W2P                  R7      p\        P                  ! V^ V VR7      p\        P                  ! V^V VR7      p\	        W#WR7      p\        WEV,          4       \        WFVP                  ,          4       R# )d   dtypeaxisr   r"   r"   N)eyefloat64r   spline_filter1dr,   r   T)r   r"   r    r!   r4   spline_filter_axis_0spline_filter_axis_1r#   s   &&&     r   %test_spline_filter_vs_matrix_solutionr:   ;   s{     	A
&&**&
%C"223Qe8<>"223Qe8<>$RE=FF:;FHH<=r   cupyz.CuPy spline_filter1d has the same aliasing bug)reasonr!   c                     VP                  WP                  R 7      p\        P                  ! V^ V RR7      p\	        W!V RR7      p\        WE,          VRR7       R# )r/   r   r1   r3   g-q=)atolN)r4   r5   r   r6   r,   r   )r   r!   r    r4   filteredr#   s   &&&   r   "test_spline_filter_reflect_small_nr@   J   sK     &&**&
%C&&s%iPH$RE	BFH%s7r   )r   )    r	               )r   r   r   )rB   rC   rD   rE   )__doc__pytestnumpyr   scipy._lib._array_apir   r   r   scipyr   markxfail_xp_backendsr   r,   r6   parametrizer:   r@   r   r   r   <module>rN      s    !    KK11 	0D 7**+"45!CD	> E 6 ,	> 7**+6"RS,/l+8 , 0 T ,8r   