
    |h                     n   d dl ZddlmZmZ ddlmZ  ej                  d      j                  d      j                  e
      Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Z ej.                  de
      ZdZdZdZdee<   dee<   dee<   d Zd Zd Zd Zd Z d Z!d Z"d  Z#d! Z$d" Z%d# Z&d$ Z'd% Z(d& Z)y)'    N   )assert_equalassert_almost_equal   )profile_lined   )
   r	   c                  p    t        t        dddd      } t        j                  dd      }t	        | |       y )Nr   r   r      r   constantordermoder   	   r   imagenparanger   profexpected_profs     a/var/www/html/test/engine/venv/lib/python3.12/site-packages/skimage/measure/tests/test_profile.pytest_horizontal_rightwardr   	   s-    vvQZHDIIaOM}%    c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr   r   r   r   r   r      r   r   s     r   test_horizontal_leftwardr       s0    vvQZHDIIaB'M}%r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr      r   r#   r   r   r      _   r	   r   r   s     r   test_vertical_downwardr'      s0    vvQZHDIIb"b)M}%r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr$   r"   r   r   r   U      ir   r   s     r   test_vertical_upwardr+      s0    vvQZHDIIb"c*M}%r   c                  r    t        t        dddd      } t        j                  g d      }t	        | |       y )Nr   r   r   r   r   r   r   )
   !   r0   ,   7   r2   B   M   r4   X   )r   r   r   arrayr   r   s     r   test_45deg_right_downwardr7   !   s/    vvQZHDHHEFM m,r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr-   r.   r   r   r   r/   r5   r	   r   r   r   linspacer   r   s     r   &test_45deg_right_downward_interpolatedr;   ,   0    vvQZHDKKB+Mm,r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr   r   r   r   r   r   r   R      ir   r   r   r   r   r   s     r   test_45deg_right_upwardrC   2   s0    vvQZHDIIb"b)Mm,r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr.   r-   r   r   r   r5      gUUUUUUrB   r   s     r   test_45deg_left_upwardrF   8   s0    vvQZHDIIb"i0Mm,r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )	Nr?   r>   r   r   r      S      rB   r   s     r   test_45deg_left_downwardrK   >   s0    vvQZHDIIb"a(Mm,r   c                  r    t        t        dddd      } t        j                  g d      }t	        | |       y )Nr   r      r   r   r   r   )   r/      r0   "   -   8   9   C   D   O   )r   r   r   r6   r   r   s     r   (test_pythagorean_triangle_right_downwardrY   D   s-    vvQZHDHHIJM}%r   c                  r    t        t        dddd      } t        j                  ddd      }t	        | |       y )NrM   rN   r   r   r   rP   rX   r9   r   s     r   5test_pythagorean_triangle_right_downward_interpolatedr[   J   r<   r   )rJ   rO   ))r   r   r   r   r      )r   r   r   r   r\   r#   ))r   r   r   r\   r\   r#   )r   r   r   r   r\   r\   ))r   r   r   r   r   r   )r   r   r   r\   r#   rJ   g?g333333?c                  p    t        t        ddddd      } t        j                  d      }t	        | |       y )NrM   )r\   r#   r   r   r   	linewidthr   r   rJ   r   
pyth_imager   onesr   r   s     r   2test_pythagorean_triangle_right_downward_linewidthrc   Y   s2    FFaqzD GGAJMm,r   c                      t        t        d d dd d f   ddddd      } t        j                  d      }t	        | |       y )	Nr   )r\   r   )r   r#   r   r   r   r^   rJ   r`   r   s     r   0test_pythagorean_triangle_right_upward_linewidthre   a   s?    4R47VVq
D GGAJMm,r   c                      t        t        j                  d d d d df   ddddd      } t        j                  d      }t        | |       y )	Nr   )r   r\   )r#   r   r   r   r   r^   rJ   )r   ra   Tr   rb   r   r   s     r   7test_pythagorean_triangle_transpose_left_down_linewidthrh   i   sC    Q"Wvv!*D GGAJMm,r   c            	          t        t        ddddt        j                  d      } t        d dd df   j                  d      }t	        | |       y 	Nr   r   r   r   r   r   reflectr_   r   reduce_funcr   r\   r   r   ra   r   meanr   r   s     r   test_reduce_func_meanrr   q   sR    GGD rr2A2v&++A.Mm,r   c            	          t        t        ddddt        j                  d      } t        d dd df   j                  d      }t	        | |       y rj   )r   ra   r   maxr   r   s     r   test_reduce_func_maxru      R    FFD rr2A2v&**1-Mm,r   c            	          t        t        ddddt        j                  d      } t        d dd df   j                  d      }t	        | |       y rj   )r   ra   r   sumr   r   s     r   test_reduce_func_sumry      rv   r   c            	      ~    t        t        ddddt        j                  d      } t        d ddf   }t	        | |       y )Nrk   rl   r   r   r   rn   r\   rp   r   s     r   !test_reduce_func_mean_linewidth_1r{      sC    GGD rr1u%Mm,r   c            	          t        t        ddddd d      } t        dddt        j                  f   }t	        | |       y )	Nr   r   r\   r   r   r   r   rn   r#   r   )r   ra   r   newaxisr   r   s     r   !test_reduce_func_None_linewidth_1r      sF    D qsArzz12Mm,r   c            	      f    t        t        ddddd d      } t        dddd	f   }t        | |       y )
Nr}   r~   r   r   r   rn   r   r#   r\   )r   ra   r   r   s     r   !test_reduce_func_None_linewidth_3r      sC    D qsAaCx(Mm,r   c            	          d } t        t        dddd| d      }t        j                  | t        dd	dd
f   d      }t	        ||       y )Nc                     | | dz  z   S )Nr    xs    r   ro   z8test_reduce_func_lambda_linewidth_3.<locals>.reduce_func   s    1a4xr   r}   r~   r   r   r   rn   r   r#   r\   arraxisr   ra   r   apply_along_axisr   ro   r   r   s      r   #test_reduce_func_lambda_linewidth_3r      sZ     D ''AaC1H9MTUVMm,r   c            	          d } t        t        dddd| d      }t        j                  | t        dd	dd
f   d      }t	        ||       y )Nc                     | dz  S Ng      ?r   r   s    r   ro   z6test_reduce_func_sqrt_linewidth_3.<locals>.reduce_func   s    #vr   r}   r~   r   r   r   rn   r   r#   r\   r   r   r   s      r   !test_reduce_func_sqrt_linewidth_3r      sZ     D ''AaC1H9MTUVMm,r   c            	          d } t        t        dddd| d      }t        j                  | t        dd	dd
f   d      }t	        ||       y )Nc                 2    t        j                  | dz        S r   )r   rx   r   s    r   ro   z;test_reduce_func_sumofsqrt_linewidth_3.<locals>.reduce_func   s    vvaf~r   r}   r~   r   r   r   rn   r   r#   r\   r   r   r   s      r   &test_reduce_func_sumofsqrt_linewidth_3r      sZ     D ''AaC1H9MTUVMm,r   c            	      @   d} t         j                  d   | z   }t        t         |  df|dfddd d      }t        j                  t        j
                  | df      t         d d dt        j                  f   t        j
                  | dz   df      g      }t        ||       y )Nr   r   r   r   rn   )ra   shaper   r   vstackzerosr   r   )offsetidxr   r   s       r   test_oob_coodinatesr      s    F


1

&C
!	aD II	61+	
1a+; <bhhQR
TU>WXM m,r   c                  0   d} d\  }}d}t        j                  t        | d         t        | d               \  }}||z
  dz  ||z
  dz  z   |dz  k  }||f}dt         j                  z  dz  }d	t        j                  |      z  }	d	t        j
                  |      z  }
||	z   ||
z   f}t        |j                  t         j                        ||d
      }t        |d | dk(        sJ t        |||d
      }t        |d | dk(        sJ t        ||k(        sJ y )N)   r   )         r   r   r   r\   g      "@   rm   )r   )
r   meshgridrangepicossinr   astypeuint8all)r   center_xcenter_yradiusr   ymasksrcphidydxdst
profile_u8	profile_bs                 r   test_bool_array_inputr   
  s$   E#HhF;;uU1XeAh8DAqLQ!h,1!44vqy@DX
C
bee)c/C	bffSk	B	bffSk	Bb=(R-
(Cdkk"((3S#INJz'6"a'(((T3)<Iy&!Q&'''yJ&'''r   )*numpyr   _shared.testingr   r   profiler   r   reshaper   floatr   r   r    r'   r+   r7   r;   rC   rF   rK   rY   r[   r   ra   linebelowaboverc   re   rh   rr   ru   ry   r{   r   r   r   r   r   r   r   r   r   r   <module>r      s     @ "		#x(//6&&&&-----&- RXXfe$
/00
4 
5 
5 ----------"-"-"-$(r   