U
    ?h                     @   s   d dl Zd dlZd dlmZ d dlmZ edZdd Z	e
d dgdd	ggejZeejd
 ZeejZed Zed Zed ZddddgZdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! ZdS )"    N)io)expected_warningszmatplotlib.pyplotc                   C   s   t   d S )N)r   Zreset_plugins r   r   R/var/www/html/venv/lib/python3.8/site-packages/skimage/io/tests/test_mpl_imshow.pysetup
   s    r   @               i  
   z'tight_layout : falling back to Agg|\A\Zz&tight_layout: falling back to Agg|\A\Zznp.asscalar|\A\Zz+The figure layout has changed to tight|\A\Zc                 C   s   t |   S )a  Return the number of subplots in the figure containing an ``AxesImage``.

    Parameters
    ----------
    ax_im : matplotlib.pyplot.AxesImage object
        The input ``AxesImage``.

    Returns
    -------
    n : int
        The number of subplots in the corresponding figure.

    Notes
    -----
    This function is intended to check whether a colorbar was drawn, in
    which case two subplots are expected. For standard imshows, one
    subplot is expected.
    )lenZ
get_figureZget_axesax_imr   r   r   
n_subplots!   s    r   c               	   C   sn   t   ttdg  tt} W 5 Q R X | jjdks<t	| 
 dksLt	t| dks\t	| jd ksjt	d S )NCObject type is marked|\A\Zgray)r   r      )pltfigurer   imshow_expected_warningsr   imshowim8cmapnameAssertionErrorget_climr   colorbarr   r   r   r   
test_uint87   s    r   c               	   C   sn   t   ttdg  tt} W 5 Q R X | jjdks<t	| 
 dksLt	t| dks\t	| jd ksjt	d S )Nr   r   )r   i  r   )r   r   r   r   r   r   im16r   r   r   r   r   r   r   r   r   r   test_uint16B   s    r    c               	   C   sn   t   ttdg  tt} W 5 Q R X | jjdks<t	| 
 dksLt	t| dks\t	| jd ksjt	d S )Nr   r   )r   r   r   )r   r   r   r   r   r   imfr   r   r   r   r   r   r   r   r   r   
test_floatM   s    r"   c               	   C   sR   t tdg  tt} W 5 Q R X |  t t fks@t| j	d k	sNtd S )N+Low image data range|CObject type is marked)
r   r   r   r   im_lor   minmaxr   r   r   r   r   r   test_low_data_rangeX   s    r'   c               	   C   sj   t   ttdg  tt} W 5 Q R X |  t t	 fksHt
t| dksXt
| jd k	sft
d S )Nz,out of standard range|CObject type is marked   )r   r   r   r   r   r   im_hir   r%   r&   r   r   r   r   r   r   r   test_outside_standard_rangea   s    r*   c               	   C   sj   t   ttdg  tt} W 5 Q R X |  t t	 fksHt
t| dksXt
| jd k	sft
d S )Nr#   r(   )r   r   r   r   r   r   im64r   r%   r&   r   r   r   r   r   r   r   test_nonstandard_typeo   s    r,   c               	   C   st   t   tddgddgg} ttdg  t| }W 5 Q R X | dksRt	t
|dksbt	|jd k	spt	d S )N      gɿg?g?r   )r-   g      ?r(   )r   r   nparrayr   r   r   r   r   r   r   r   )Z	im_signedr   r   r   r   test_signed_image}   s    r0   )numpyr.   ZpytestZskimager   Zskimage._shared._warningsr   Zimportorskipr   r   r/   Zuint8r   ZastypeZuint16r   Zuint64r+   r!   r$   r)   r   r   r   r    r"   r'   r*   r,   r0   r   r   r   r   <module>   s0   
	