ó
 ‰\c           @   s8  d  d l  m Z d  d l Z d  d l m Z d  d l m Z d  d l j	 Z
 d „  Z e j d d g d d	 g g e j ƒ Z e j e j ƒ d
 Z e j e j ƒ Z e d Z e d Z e d Z d d d g Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e  d k r4e j! j" ƒ  n  d S(   iÿÿÿÿ(   t   divisionN(   t   io(   t   expected_warningsc           C   s   t  j ƒ  d  S(   N(   R   t   reset_plugins(    (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   setup	   s    i    i@   i€   ið   i   iÿ   iè  i
   s'   tight_layout : falling back to Agg|\A\Zs   np.asscalar|\A\Zs   CObject type is marked|\A\Zc         C   s   t  |  j ƒ  j ƒ  ƒ S(   s×  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.
    (   t   lent
   get_figuret   get_axes(   t   ax_im(    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt
   n_subplots#   s    c          C   s   t  j ƒ  t t ƒ  t j t ƒ }  Wd  QX|  j j d k sD t	 ‚ |  j
 ƒ  d k s\ t	 ‚ t |  ƒ d k st t	 ‚ |  j d  k s‰ t	 ‚ d  S(   Nt   grayi    iÿ   i   (   i    iÿ   (   t   pltt   figureR   t   imshow_expected_warningsR   t   imshowt   im8t   cmapt   namet   AssertionErrort   get_climR	   t   colorbart   None(   R   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt
   test_uint89   s    
c          C   s   t  j ƒ  t t ƒ  t j t ƒ }  Wd  QX|  j j d k sD t	 ‚ |  j
 ƒ  d k s\ t	 ‚ t |  ƒ d k st t	 ‚ |  j d  k s‰ t	 ‚ d  S(   NR
   i    iÿÿ  i   (   i    iÿÿ  (   R   R   R   R   R   R   t   im16R   R   R   R   R	   R   R   (   R   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   test_uint16C   s    
c          C   s   t  j ƒ  t t ƒ  t j t ƒ }  Wd  QX|  j j d k sD t	 ‚ |  j
 ƒ  d k s\ t	 ‚ t |  ƒ d k st t	 ‚ |  j d  k s‰ t	 ‚ d  S(   NR
   i    i   (   i    i   (   R   R   R   R   R   R   t   imfR   R   R   R   R	   R   R   (   R   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt
   test_floatM   s    
c          C   sl   t  t d g ƒ  t j t ƒ }  Wd  QX|  j ƒ  t j ƒ  t j ƒ  f k sS t ‚ |  j	 d  k	 sh t ‚ d  S(   Ns   Low image data range|\A\Z(   R   R   R   R   t   im_loR   t   mint   maxR   R   R   (   R   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   test_low_data_rangeW   s
    *c          C   sŽ   t  j ƒ  t t d g ƒ  t j t ƒ }  Wd  QX|  j ƒ  t j ƒ  t j	 ƒ  f k s] t
 ‚ t |  ƒ d k su t
 ‚ |  j d  k	 sŠ t
 ‚ d  S(   Ns   out of standard range|\A\Zi   (   R   R   R   R   R   R   t   im_hiR   R   R   R   R	   R   R   (   R   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   test_outside_standard_range`   s    
*c          C   sŽ   t  j ƒ  t t d g ƒ  t j t ƒ }  Wd  QX|  j ƒ  t j ƒ  t j	 ƒ  f k s] t
 ‚ t |  ƒ d k su t
 ‚ |  j d  k	 sŠ t
 ‚ d  S(   Ns   Low image data rangei   (   R   R   R   R   R   R   t   im64R   R   R   R   R	   R   R   (   R   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   test_nonstandard_typej   s    
*c          C   s–   t  j ƒ  t j d d g d d g g ƒ }  t t ƒ  t j |  ƒ } Wd  QX| j ƒ  d k se t	 ‚ t
 | ƒ d k s} t	 ‚ | j d  k	 s’ t	 ‚ d  S(   Ng      à¿gš™™™™™É¿gš™™™™™¹?gš™™™™™Ù?g      à?i   (   g      à¿g      à?(   R   R   t   npt   arrayR   R   R   R   R   R   R	   R   R   (   t	   im_signedR   (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   test_signed_imaget   s    
!t   __main__(#   t
   __future__R    t   numpyR#   t   skimageR   t   skimage._shared._warningsR   t   matplotlib.pyplott   pyplotR   R   R$   t   uint8R   t   astypet   uint16R   t   uint64R!   R   R   R   R   R	   R   R   R   R   R    R"   R&   t   __name__t   testingt   run_module_suite(    (    (    s?   lib/python2.7/site-packages/skimage/io/tests/test_mpl_imshow.pyt   <module>   s0   	'


			
	
	
			
	
	