o
    ðËhÈ  ã                   @   sn   d dl Zd dlmZmZ ejg d¢g d¢g d¢gedZej 	¡  ej
¡Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )é    N)Úpixel_graphÚcentral_pixel)é   r   r   )r   r   r   )r   r   r   )Údtypec                  C   sf   t tdd\} }| jdksJ ‚t| jƒdksJ ‚tj t | j¡dt 	d¡g¡ tj 
|g d¢¡ d S )Né   ©Úconnectivity)é   r	   é   r   ©r   r	   é   é   )r   ÚmaskÚshapeÚlenÚdataÚnpÚtestingÚassert_allcloseÚuniqueÚsqrtÚassert_array_equal)ÚgÚn© r   ú_/var/www/html/scripts/venv/lib/python3.10/site-packages/skimage/graph/tests/test_pixel_graph.pyÚtest_small_graph   s
    r   c                  C   s¤   t tdd\} }t| |tjd\}}tj |d¡ t d¡}tj ||d d |d |d d |d d g¡ t| |ƒ\}}|dksDJ ‚t| ƒ\}}|dksPJ ‚d S )Nr   r   )r   ©r   r   é   r	   r   )	r   r   r   r   r   r   r   r   r   )r   r   ÚpxÚdsÚs2Ú_r   r   r   Útest_central_pixel   s   
2r#   c                  C   sŒ   dd„ } t ttd| d\}}t d¡}tj |d t td td  ¡| ¡ tj |d t td td  ¡d	 ¡ tj |g d
¢¡ d S )Nc                 S   s   t  | | ¡| S )N)r   Úabs)Ú
values_srcÚ
values_dstÚ	distancesr   r   r   Ú	edge_func!   s   z%test_edge_function.<locals>.edge_funcr   )r   r   Úedge_function©r   r   ©r   r   r   )r   r   r   r   )	r   Úimager   r   r   r   r   r$   r   )r(   r   r   r!   r   r   r   Útest_edge_function    s   
ÿ
((r-   c               	   C   sv   t tt ddg¡d\} }t| jƒd }|dksJ ‚tj | d dt td td  ¡ ¡ tj 	|t 
tj¡¡ d S )Ngö(\Âõè?)Úspacingr   é   r*   r+   )r   r,   r   Úarrayr   r   r   Úassert_almost_equalr$   r   ÚarangeÚsize)r   r   Ú	num_edgesr   r   r   Útest_default_edge_func-   s   ÿr5   )Únumpyr   Úskimage.graph._graphr   r   r0   Úboolr   ÚrandomÚdefault_rngr   r,   r   r#   r-   r5   r   r   r   r   Ú<module>   s     