3
6Ad]{ã  ã               @   sÆ  d Z ddlmZ ddlmZ ddlZddlZddlmZ ddl	Z
ddlZddlmZ ddljZddlmZ ddljZddljZddljZddljZddlT dd	lmZmZm Z m!Z!m"Z"m#Z# ej$e%ƒZ&ej'ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1ej2ej3ej4ej5ej6ej7d
œZ8e9e8ƒZ:d*dd„Z;d+dd„Z<dd„ Z=G dd„ dej>ej?ƒZ@G dd„ de@ƒZAG dd„ deAƒZBG dd„ deAƒZCG dd„ de@ƒZDG dd„ de@ƒZEd,dd„ZFd-d!d"„ZGd#d$„ ZHd.d(d)„ZIdS )/zR
The image module supports basic image loading, rescaling and display
operations.
é    )ÚBytesIO)ÚceilN)ÚPath)ÚrcParams)ÚFigureCanvasBase)Ú*)ÚAffine2DÚBboxBaseÚBboxÚBboxTransformÚIdentityTransformÚTransformedBbox)ÚnoneÚnearestÚbilinearZbicubicZspline16Zspline36ÚhanningÚhammingÚhermiteÚkaiserZquadricZcatromZgaussianZbesselZmitchellÚsincZlanczosÚblackmanç      ð?c          	   C   sZ  t | ƒdkr"tjd	tjd�ddfS g }g }x€| D ]x}|j||ƒ\}}}}	|dk	r0||9 }||9 }|j||||jƒ ptdfƒ |jt||g||jd  ||jd  ggƒƒ q0W t |ƒdkrÎtjd
tjd�ddfS tj	|ƒ}
tj
t|
jƒt|
jƒdftjd�}xH|D ]@\}}}}tƒ j||
j ||
j ƒ}	tj|||	tjd|d� �q W ||
j| |
j| fS )aD  
    Composite a number of RGBA images into one.  The images are
    composited in the order in which they appear in the `images` list.

    Parameters
    ----------
    images : list of Images
        Each must have a `make_image` method.  For each image,
        `can_composite` should return `True`, though this is not
        enforced by this function.  Each image must have a purely
        affine transformation with no shear.

    renderer : RendererBase instance

    magnification : float
        The additional magnification to apply for the renderer in use.

    Returns
    -------
    tuple : image, offset_x, offset_y
        Returns the tuple:

        - image: A numpy array of the same type as the input images.

        - offset_x, offset_y: The offset of the image (left, bottom)
          in the output figure.
    r   é   )ÚdtypeNg      ð?é   F)ÚresampleÚalpha)r   r   r   )r   r   r   )ÚlenÚnpÚemptyÚuint8Ú
make_imageÚappendÚ	get_alphar
   ÚshapeÚunionÚzerosÚintÚheightÚwidthr   Ú	translateÚx0Úy0Ú_imager   ÚNEAREST)ZimagesÚrendererÚmagnificationÚpartsÚbboxesÚimageÚdataÚxÚyÚtransÚbboxÚoutputr   © r:   ú{/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/matplotlib-3.1.1-py3.6-linux-x86_64.egg/matplotlib/image.pyÚcomposite_images;   s,    
.
r<   c                s®   t dd„ |D ƒƒ}|dk	r|nˆjƒ }|s0| rJxx|D ]}|jˆƒ q6W n`g ‰ ˆjƒ ‰‡ ‡‡‡fdd„}x:|D ]2}t|tƒr�|jƒ r�ˆ j|ƒ qn|ƒ  |jˆƒ qnW |ƒ  dS )a  
    Draw a sorted list of artists, compositing images into a single
    image where possible.

    For internal matplotlib use only: It is here to reduce duplication
    between `Figure.draw` and `Axes.draw`, but otherwise should not be
    generally useful.
    c             s   s   | ]}t |tƒV  qd S )N)Ú
isinstanceÚ
_ImageBase)Ú.0r5   r:   r:   r;   ú	<genexpr>   s    z0_draw_list_compositing_images.<locals>.<genexpr>Nc                 s˜   t ˆ ƒdkrˆ d jˆƒ nnt ˆ ƒdkrŠtˆ ˆˆƒ\} }}| jdkrŠˆjƒ }|jˆjƒ |jˆjƒ ƒ ˆj	|t
j|ƒt
j|ƒ| ƒ |jƒ  ˆ d d …= d S )Nr   r   )r   Údrawr<   ÚsizeÚnew_gcÚset_clip_rectangler8   Úset_clip_pathÚget_clip_pathÚ
draw_imager   ÚroundÚrestore)r4   ÚlÚbÚgc)Úimage_groupÚmagÚparentr/   r:   r;   Úflush_images�   s    
z3_draw_list_compositing_images.<locals>.flush_images)ÚanyZoption_image_nocompositerA   Úget_image_magnificationr=   r>   Úcan_compositer"   )r/   rO   ÚartistsZsuppress_compositeZ
has_imagesZnot_compositeÚarP   r:   )rM   rN   rO   r/   r;   Ú_draw_list_compositing_imagesu   s    



rV   c             C   sz   t j| jd | jd df| jd�}| |dd…dd…dd…f< |jt jkr`d|dd…dd…df< nd|dd…dd…df< |S )	z\
    Convert an RGB image to RGBA, as required by the image resample C++
    extension.
    r   r   r   )r   Né   éÿ   g      ð?)r   r&   r$   r   r    )ÚAÚrgbar:   r:   r;   Ú_rgb_to_rgba£   s    "r[   c                   sä   e Zd ZdZdd„ Zd7dd	„Z‡ fd
d„Zdd„ Zdd„ Zdd„ Z	d8dd„Z
d9dd„Zdd„ Zdd„ Zej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+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Z‡  ZS ):r>   r   c             C   s   dt | jjjƒ S )NzAxesImage(%g,%g;%gx%g))ÚtupleÚaxesr8   Úbounds)Úselfr:   r:   r;   Ú__str__´   s    z_ImageBase.__str__NTç      @Fc	       
      K   sz   t jj| ƒ tjj| ||ƒ d| _|dkr2td }|| _| j|ƒ | j	|ƒ | j
|ƒ | j|ƒ || _d| _| j|	ƒ dS )aÀ  
        interpolation and cmap default to their rc settings

        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        extent is data axes (left, right, bottom, top) for making image plots
        registered with data plots.  Default is to label the pixel
        centers with the zero-based row and column indices.

        Additional kwargs are matplotlib.artist properties

        TNzimage.origin)ÚmartistÚArtistÚ__init__ÚcmÚScalarMappableÚ
_mouseoverr   ÚoriginÚset_filternormÚset_filterradÚset_interpolationÚset_resampler]   Ú_imcacheÚupdate)
r_   ÚaxÚcmapÚnormÚinterpolationrh   Ú
filternormÚ	filterradr   Úkwargsr:   r:   r;   rd   ·   s    



z_ImageBase.__init__c                s   t ƒ jƒ }d |d< |S )Nrm   )ÚsuperÚ__getstate__)r_   Ústate)Ú	__class__r:   r;   rw   Þ   s    
z_ImageBase.__getstate__c             C   s"   | j dkrtdƒ‚| j jdd… S )z+Get the numrows, numcols of the input imageNz"You must first set the image arrayé   )Ú_AÚRuntimeErrorr$   )r_   r:   r:   r;   Úget_sizeä   s    
z_ImageBase.get_sizec             C   s   t jj| |ƒ d| _dS )z•
        Set the alpha value used for blending - not supported on all backends.

        Parameters
        ----------
        alpha : float
        N)rb   rc   Ú	set_alpharm   )r_   r   r:   r:   r;   r~   ë   s    z_ImageBase.set_alphac             C   s   d| _ d| _tjj| ƒ dS )zb
        Call this whenever the mappable is changed so observers can
        update state
        N)rm   Ú
_rgbacachere   rf   Úchanged)r_   r:   r:   r;   r€   ö   s    z_ImageBase.changedç      ð?c       %   	   C   s  |dkrt dƒ‚|jdkr"t dƒ‚tj||ƒ}|dkr:dS |j| }	|j| }
|	dks^|
dkrbdS | jdkrŒtƒ jd|j	d  ƒj
ddƒ}ntƒ }|tƒ j
|j|j	d  |j|j	d  ƒj|j|jƒ| jƒ  7 }|tƒ j|j |j ƒj
||ƒ }|j�rh|�rh|	d dk�s|
d dk�rhtt|	ƒƒ}tt|
ƒƒ}||	 |	 }||
 |
 }|tƒ j
d| d| ƒ7 }nt|	ƒ}t|
ƒ}|�s0|jdk�rštdj|j	ƒƒ‚|jd	k�rÈ|j}|jƒ }|jƒ }|tjjk�ràtjdƒtjdƒ }}|jdk�r.|j}|jtjtjfk�r^|jtjk�r&t j!dj|jƒƒ tj}n0|j"tjƒ|j"tjƒ }|dk�rXtj}ntj}tj#|j	|d�}||dd…< | j$j%|ƒ tj| j$j&ƒtj| j$j'ƒ }| j$j'|d	  }|tjk�rÂdnd}|||  }||k �râd}n
tj|ƒ}|||  }||k�rd}n
tj|ƒ}|dk	�s&|dk	�r4tj(|||ƒ}||8 }|j"|ƒj)ƒ }|j"|ƒj)ƒ }||k�rr||| d  }|d7 }tj*||f|jd�}t+j,|||t-| j.ƒ  | j/ƒ d| j0ƒ | j1ƒ ƒ ~|d8 }||k�rÞ||| d 9 }||7 }t2| j$t3j4ƒ�r|j"|jƒ}tj#|j	tjd�}|j5j	|j	k�rLtj6|j5tjtj7ƒtjdƒƒ|dd…< nd|dd…< tj*||f|jd�}t+j,|||t-| j.ƒ  dd| j0ƒ | j1ƒ ƒ ~tj8|ƒ}tj9|ƒ}d||< | j$tjj:||ƒƒ} nö|j	d	 d
k�rât;|ƒ}n |j	d	 dk�rtdj|j	ƒƒ‚tj*||df|jd�} tj*||f|jd�}!| j<ƒ }"|"dk�rBd}"|d }#t+j,|#|!|t-| j.ƒ  | j/ƒ |"| j0ƒ | j1ƒ ƒ t;|ddd
…f ƒ}t+j,|| |t-| j.ƒ  | j/ƒ |"| j0ƒ | j1ƒ ƒ |!| d< | j=| ddd�} |jd	k�rò| j<ƒ }"|"dk�rðd}"| dd…dd…d
f }#tj>tj>|#tjƒ| |" tj?ƒ|#dd…< nÂ| j@dk�rT| j=|d|jd	kd�| _@| j@} tA||jBƒ jCƒ ƒjBƒ }$| tt|$jDdƒƒtt|$jEd | j	d ƒƒ…tt|$jFdƒƒtt|$jGd | j	d ƒƒ…f } tƒ jtt|$jFdƒƒtt|$jDdƒƒƒ| }| |j|j|fS )aÊ  
        Normalize, rescale, and colormap the image *A* from the given *in_bbox*
        (in data space), to the given *out_bbox* (in pixel space) clipped to
        the given *clip_bbox* (also in pixel space), and magnified by the
        *magnification* factor.

        *A* may be a greyscale image (M, N) with a dtype of float32, float64,
        float128, uint16 or uint8, or an (M, N, 4) RGBA image with a dtype of
        float32, float64, float128, or uint8.

        If *unsampled* is True, the image will not be scaled, but an
        appropriate affine transformation will be returned instead.

        If *round_to_pixel_border* is True, the output image size will be
        rounded to the nearest pixel boundary.  This makes the images align
        correctly with the axes.  It should not be used if exact scaling is
        needed, such as for `FigureImage`.

        Returns
        -------
        image : (M, N, 4) uint8 array
            The RGBA image, resampled unless *unsampled* is True.
        x, y : float
            The upper left corner where the image should be drawn, in pixel
            space.
        trans : Affine2D
            The affine transformation from image to pixel space.
        Nz9You must first set the image array or the image attributer   zk_make_image must get a non-empty image. Your Artist's draw method must filter before this method is called.Úupperr   g      ð?g        rz   rW   zInvalid shape {} for image dataÚfz5Casting input data from '{0}' to 'float64' for imshowg    „×—A)r   g    ÐcAg     ˆÃ@gš™™™™™é?gš™™™™™¹?Tr   .F)Úbytesrq   )Nr   r   N)Nr   r   Néÿÿÿÿ)rz   rW   ).rW   ).rW   )Hr|   rB   r
   Úintersectionr)   r(   rh   r   r*   r$   Úscaler   r+   r,   Úget_transformÚ	is_affiner'   r   ÚndimÚ
ValueErrorÚformatr   ÚminÚmaxr   ÚmaÚmaskedÚint32ÚkindÚfloat32Úfloat16Úfloat64ÚcbookÚ_warn_externalÚastyper   rq   Úautoscale_NoneÚvmaxÚvminÚclipÚitemr&   r-   r   Ú	_interpd_Úget_interpolationÚget_resampleÚget_filternormÚget_filterradr=   ÚmcolorsÚNoNormÚmaskÚwhereÚnanÚarrayÚisnanÚmasked_arrayr[   r#   Úto_rgbaÚasarrayr    rm   r   ÚfrozenÚinvertedÚyminÚymaxÚxminÚxmax)%r_   rY   Zin_bboxZout_bboxZ	clip_bboxr0   Ú	unsampledÚround_to_pixel_borderZclipped_bboxZout_width_baseZout_height_baseÚt0ÚtZ	out_widthZ
out_heightZextra_widthZextra_heightZ	inp_dtypeÚa_minÚa_maxZscaled_dtypeÚdaZA_scaledÚdvZvmidÚfactZnewminZnewmaxZA_resampledr¥   Zout_maskZ	out_alphar9   Zoutput_ar   Zalpha_channelÚsubsetr:   r:   r;   Ú_make_imageÿ   s8   



 





	













	







 $z_ImageBase._make_imagec             C   s   t dƒ‚dS )am  
        Normalize, rescale, and colormap this image's data for rendering using
        *renderer*, with the given *magnification*.

        If *unsampled* is True, the image will not be scaled, but an
        appropriate affine transformation will be returned instead.

        Returns
        -------
        image : (M, N, 4) uint8 array
            The RGBA image, resampled unless *unsampled* is True.
        x, y : float
            The upper left corner where the image should be drawn, in pixel
            space.
        trans : Affine2D
            The affine transformation from image to pixel space.
        z(The make_image method must be overriddenN)ÚNotImplementedError)r_   r/   r0   r³   r:   r:   r;   r!   )  s    z_ImageBase.make_imagec             C   sV   | j |dd�\}}}}|dkr"dS tƒ j|jd |jd ƒ| }|j|||||ƒ dS )zu
        draw unsampled image. The renderer should support a draw_image method
        with scale parameter.
        T)r³   Nr   r   )r!   r   r‡   r$   rG   )r_   r/   rL   ÚimrJ   rK   r7   r:   r:   r;   Ú_draw_unsampled_image=  s
    z _ImageBase._draw_unsampled_imagec             C   s   dS )z{
        return True if the image is better to be drawn unsampled.
        The derived class needs to override it.
        Fr:   )r_   r/   r:   r:   r;   Ú_check_unsampled_imageL  s    z!_ImageBase._check_unsampled_imagec       	      O   sÊ   | j ƒ sd| _d S | jƒ jdkr*d| _d S |jƒ }| j|ƒ |j| jƒ ƒ |j| j	ƒ ƒ |j
| jƒ ƒ | j|ƒrˆ| jƒ jrˆ| j||ƒ n0| j||jƒ ƒ\}}}}|d k	r¸|j||||ƒ |jƒ  d| _d S )NFr   )Úget_visibleÚstaleÚ	get_arrayrB   rC   Ú_set_gc_clipr~   r#   Úset_urlÚget_urlÚset_gidÚget_gidrÁ   rˆ   r‰   rÀ   r!   rR   rG   rI   )	r_   r/   Úargsru   rL   r¿   rJ   rK   r7   r:   r:   r;   rA   S  s(    


z_ImageBase.drawc       	      C   sº   | j dk	r| j | |ƒS | j|jk	r*di fS |j|j }}| jƒ \}}}}||krZ|| }}||krl|| }}|dk	r®|dk	r®||  koŽ|kn  oª||  ko¦|kn  }nd}|i fS )zI
        Test whether the mouse event occurred within the image.
        NF)Ú	_containsr]   ÚinaxesÚxdataÚydataÚ
get_extent)	r_   Ú
mouseeventr5   r6   r±   r²   r¯   r°   Úinsider:   r:   r;   Úcontainsq  s    


2z_ImageBase.containsc             C   sH   ddl m} | j| jdkr*| jddd… n| jddd�}|j||ƒ dS )	z&Write the image to png file with fnamer   )Ú_pngÚlowerNr   T)r„   rq   r…   )Ú
matplotlibrÓ   r«   rh   r{   Ú	write_png)r_   ÚfnamerÓ   r¿   r:   r:   r;   rÖ   �  s    "
z_ImageBase.write_pngc             C   sf  yddl m} W n tk
r$   Y nX t||jƒr:t|ƒ}tj|dd�| _| jjt	j
kr~t	j| jjtdƒ r~tdj| jjƒƒ‚| jjdkp¤| jjdko¤| jjd dks¸tdj| jjƒƒ‚| jjdk�rPt	j| jjt	jƒrÜdnd	}| jjƒ dk �s || jjƒ k �rtjdƒ t	j| jd|ƒ| _| jjt	j
k�rPt	j| jjt	jƒ�rP| jjt	j
ƒ| _d| _d| _d| _dS )zÄ
        Set the image array.

        Note that this function does *not* update the normalization used.

        Parameters
        ----------
        A : array-like or `PIL.Image.Image`
        r   )ÚImageT)ÚcopyÚ	same_kindz3Image data of dtype {} cannot be converted to floatrz   rW   r   r   zInvalid shape {} for image datarX   zmClipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).Nr…   )rW   r   )ÚPILrØ   ÚImportErrorr=   Úpil_to_arrayr–   Úsafe_masked_invalidr{   r   r   r    Úcan_castÚfloatÚ	TypeErrorrŒ   rŠ   r$   Ú
issubdtypeÚintegerr�   rŽ   Ú_logÚwarningrœ   r˜   rm   r   rÃ   )r_   rY   rØ   Úhighr:   r:   r;   Úset_data—  s6    
 
z_ImageBase.set_datac             C   s   | j |ƒ dS )zŒ
        Retained for backwards compatibility - use set_data instead.

        Parameters
        ----------
        A : array-like
        N)rç   )r_   rY   r:   r:   r;   Ú	set_arrayÉ  s    
z_ImageBase.set_arrayc             C   s   | j S )a*  
        Return the interpolation method the image uses when resizing.

        One of 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
        'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom',
        'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', or 'none'.

        )Ú_interpolation)r_   r:   r:   r;   rŸ   Õ  s    	z_ImageBase.get_interpolationc             C   s8   |dkrt d }|jƒ }|tkr(tdƒ‚|| _d| _dS )a(  
        Set the interpolation method the image uses when resizing.

        if None, use a value from rc setting. If 'none', the image is
        shown as is without interpolating. 'none' is only supported in
        agg, ps and pdf backends and will fall back to 'nearest' mode
        for other backends.

        Parameters
        ----------
        s : {'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', 'none'}

        Nzimage.interpolationzIllegal interpolation stringT)r   rÔ   rž   r‹   ré   rÃ   )r_   Úsr:   r:   r;   rk   à  s    z_ImageBase.set_interpolationc             C   s   | j ƒ }| jdko|jo|jS )z>Return whether the image can be composited with its neighbors.r   )rˆ   ré   r‰   Úis_separable)r_   r7   r:   r:   r;   rS   ø  s    
z_ImageBase.can_compositec             C   s    |dkrt d }|| _d| _dS )z­
        Set whether image resampling is used.

        Parameters
        ----------
        v : bool or None
            If None, use :rc:`image.resample` = True.
        Nzimage.resampleT)r   Ú	_resamplerÃ   )r_   Úvr:   r:   r;   rl      s    	z_ImageBase.set_resamplec             C   s   | j S )z(Return whether image resampling is used.)rì   )r_   r:   r:   r;   r      s    z_ImageBase.get_resamplec             C   s   t |ƒ| _d| _dS )z¯
        Set whether the resize filter normalizes the weights.

        See help for `~.Axes.imshow`.

        Parameters
        ----------
        filternorm : bool
        TN)ÚboolÚ_filternormrÃ   )r_   rs   r:   r:   r;   ri     s    

z_ImageBase.set_filternormc             C   s   | j S )z8Return whether the resize filter normalizes the weights.)rï   )r_   r:   r:   r;   r¡     s    z_ImageBase.get_filternormc             C   s(   t |ƒ}|dkrtdƒ‚|| _d| _dS )zÅ
        Set the resize filter radius only applicable to some
        interpolation schemes -- see help for imshow

        Parameters
        ----------
        filterrad : positive float
        r   z+The filter radius must be a positive numberTN)rà   r‹   Ú
_filterradrÃ   )r_   rt   Úrr:   r:   r;   rj   #  s
    	z_ImageBase.set_filterradc             C   s   | j S )zReturn the filterrad setting.)rð   )r_   r:   r:   r;   r¢   2  s    z_ImageBase.get_filterrad)NNNNTra   F)r�   FT)r�   F)Ú__name__Ú
__module__Ú__qualname__Úzorderr`   rd   rw   r}   r~   r€   r½   r!   rÀ   rÁ   rb   Úallow_rasterizationrA   rÒ   rÖ   rç   rè   rŸ   rk   rS   rl   r    ri   r¡   rj   r¢   Ú__classcell__r:   r:   )ry   r;   r>   ±   sD         
 	 
  +
2r>   c                   sf   e Zd Zdd„ Zd‡ fdd„	Zdd	d
„Zddd„Zdd„ Zdd„ Zdd„ Z	dd„ Z
‡ fdd„Z‡  ZS )Ú	AxesImagec             C   s   dt | jjjƒ S )NzAxesImage(%g,%g;%gx%g))r\   r]   r8   r^   )r_   r:   r:   r;   r`   8  s    zAxesImage.__str__Nr   ç      @Fc
          
      s.   || _ tƒ j|f|||||||	dœ|
—Ž dS )aÀ  
        interpolation and cmap default to their rc settings

        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        extent is data axes (left, right, bottom, top) for making image plots
        registered with data plots.  Default is to label the pixel
        centers with the zero-based row and column indices.

        Additional kwargs are matplotlib.artist properties

        )rp   rq   rr   rh   rs   rt   r   N)Ú_extentrv   rd   )r_   ro   rp   rq   rr   rh   Úextentrs   rt   r   ru   )ry   r:   r;   rd   ;  s    zAxesImage.__init__c             C   s.   | j \}}}}tj||||gƒ}|j| jjƒS )N)rú   r
   Úfrom_extentsÚtransformedr]   Ú	transData)r_   r/   r+   Úx1r,   Úy1r8   r:   r:   r;   Úget_window_extentc  s    zAxesImage.get_window_extentç      ð?c             C   sX   | j ƒ }| jƒ \}}}}ttj||g||ggƒƒ}	t|	|ƒ}
| j| j|	|
| jj	||d�S )N)r³   )
rˆ   rÏ   r
   r   r¨   r   r½   r{   r]   r8   )r_   r/   r0   r³   r7   rÿ   Úx2r   Úy2r8   Ztransformed_bboxr:   r:   r;   r!   h  s    
zAxesImage.make_imagec             C   s   | j ƒ dko|jƒ S )zK
        Return whether the image would be better drawn unsampled.
        r   )rŸ   Zoption_scale_image)r_   r/   r:   r:   r;   rÁ   s  s    z AxesImage._check_unsampled_imagec             C   s˜   | | _ \}}}}||f||ff}| jj|ƒ ||g| jjdd…< ||g| jjdd…< | jjrr| jj||fdd� | jjrŽ| jj	||fdd� d| _
dS )ab  
        extent is data axes (left, right, bottom, top) for making image plots

        This updates ax.dataLim, and, if autoscaling, sets viewLim
        to tightly fit the image, regardless of dataLim.  Autoscaling
        state is not changed, so following this with ax.autoscale_view
        will redo the autoscaling in accord with dataLim.
        N)ÚautoT)rú   r]   Úupdate_datalimÚsticky_edgesr5   r6   Z_autoscaleXonÚset_xlimZ_autoscaleYonÚset_ylimrÃ   )r_   rû   r±   r²   r¯   r°   Úcornersr:   r:   r;   Ú
set_extentz  s    	zAxesImage.set_extentc             C   sV   | j dk	r| j S | jƒ }|\}}| jdkr>d|d |d dfS d|d d|d fS dS )z.Get the image extent: left, right, bottom, topNr‚   g      à?g      à¿g      à¿g      à¿g      à¿)rú   r}   rh   )r_   ÚszÚnumrowsÚnumcolsr:   r:   r;   rÏ   Ž  s    

zAxesImage.get_extentc             C   sö   | j ƒ \}}}}| jdkr$|| }}| jƒ }t||g||ggƒ}tddg|jdd… gƒ}t||d�}	|j|j }
}|	j|
|gƒ}t	t
j|ƒƒr”dS |jtƒ\}}d|  koº|jd k n   sâd|  koÚ|jd k n   rædS |||f S dS )zÇ
        Return the image value at the event position or *None* if the event is
        outside the image.

        See Also
        --------
        matplotlib.artist.Artist.get_cursor_data
        r‚   r   Nrz   )ÚboxinÚboxoutr   )rÏ   rh   rÄ   r
   r$   r   rÎ   rÍ   Útransform_pointrQ   r   r©   r˜   r'   )r_   Úeventr±   r²   r¯   r°   ÚarrZdata_extentZarray_extentr7   r6   r5   ÚpointÚiÚjr:   r:   r;   Úget_cursor_dataš  s    	

@zAxesImage.get_cursor_datac                sD   t j|ƒdkr4| jr4dtj| jjj|ƒƒjƒ  d S tƒ j	|ƒS d S )Nr   ú[ú])
r   rŠ   Úcolorbarr–   Ú
strip_mathÚ	formatterÚformat_data_shortÚstriprv   Úformat_cursor_data)r_   r4   )ry   r:   r;   r  µ  s     zAxesImage.format_cursor_data)NNNNNr   rù   F)N)r  F)rò   ró   rô   r`   rd   r  r!   rÁ   r  rÏ   r  r  r÷   r:   r:   )ry   r;   rø   7  s            

rø   c                   s|   e Zd Zddœ‡ fdd„
Zdd„ Zdd	d
„Zdd„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dd„ Z‡ fdd„Z‡ fdd„Z‡  ZS )ÚNonUniformImager   )rr   c               s   t ƒ j|f|Ž | j|ƒ dS )z£
        kwargs are identical to those for AxesImage, except
        that 'nearest' and 'bilinear' are the only supported 'interpolation'
        options.
        N)rv   rd   rk   )r_   ro   rr   ru   )ry   r:   r;   rd   Á  s    zNonUniformImage.__init__c             C   s   dS )z;
        return False. Do not use unsampled image.
        Fr:   )r_   r/   r:   r:   r;   rÁ   Ê  s    z&NonUniformImage._check_unsampled_imageç      ð?Fc             C   sÎ  | j d krtdƒ‚|rtdƒ‚| j }|jdkr–|jtjkrV| j|dd�}| jj	ƒ | _
n>tj|d d …d d …tjf ddƒ}d|d d …d d …df< d| _
n†|jtjkr²d| jtjƒ}|jd dk�rtjt|jd	d… d•ƒtjƒ}||d d …d d …d	d…f< d|d d …d d …df< |}d
| _
| jjj\}}}}	| jjj\}
}}}tj|ƒd tj|
ƒd  }tj|ƒd tj|ƒd  }||9 }||9 }tj| j| j|t|ƒt|ƒ||| |||	 ft| j ƒ}||
|tƒ fS )Nz"You must first set the image arrayz*unsampled not supported on NonUniformImagerz   T)r„   r   rX   rW   r   Fg      à?)r   )r{   r|   r‹   rŠ   r   r   r    r«   rp   Úis_grayÚis_grayscaleÚrepeatÚnewaxisr˜   r$   r&   r\   r]   ÚviewLimr^   r8   ÚextentsrH   r-   ÚpcolorÚ_AxÚ_Ayr'   rž   ré   r   )r_   r/   r0   r³   rY   ÚBr+   r,   Zv_widthZv_heightrJ   rK   rñ   r¶   r)   r(   r¿   r:   r:   r;   r!   Ð  s>    

" zNonUniformImage.make_imagec             C   sä   t j|t jƒ}t j|t jƒ}tj|dd�}|j|j  ko@dkn  o^|jdd… |j|j kshtdƒ‚|jdkrztdƒ‚|jdkrš|jd dkrštd
ƒ‚|jdkrÂ|jd dkrÂ|jdd… |_|| _|| _	|| _
d| _d| _dS )a^  
        Set the grid for the pixel centers, and the pixel values.

          *x* and *y* are monotonic 1-D ndarrays of lengths N and M,
             respectively, specifying pixel centers

          *A* is an (M,N) ndarray or masked array of values to be
            colormapped, or a (M,N,3) RGB array, or a (M,N,4) RGBA
            array.
        T)rÙ   r   r   rz   zAxes don't match array shaperW   zCan only plot 2D or 3D datar   z?3D arrays must have three (RGB) or four (RGBA) color componentsN)rz   rW   )r   rW   r   )r   r¨   r“   r–   rÞ   rŠ   r$   rá   r{   r)  r*  rm   rÃ   )r_   r5   r6   rY   r:   r:   r;   rç   ô  s     6
zNonUniformImage.set_datac             G   s   t dƒ‚d S )NzMethod not supported)r¾   )r_   rÊ   r:   r:   r;   rè     s    zNonUniformImage.set_arrayc             C   s(   |dk	r|dkrt dƒ‚tj| |ƒ dS )z|
        Parameters
        ----------
        s : str, None
            Either 'nearest', 'bilinear', or ``None``.
        Nr   r   z?Only nearest neighbor and bilinear interpolations are supported)r   r   )r¾   rø   rk   )r_   rê   r:   r:   r;   rk     s    z!NonUniformImage.set_interpolationc             C   s6   | j d krtdƒ‚| jd | jd | jd | jd fS )NzMust set data firstr   r   r…   r…   )r{   r|   r)  r*  )r_   r:   r:   r;   rÏ   !  s    
zNonUniformImage.get_extentc             C   s   d S )Nr:   )r_   rê   r:   r:   r;   ri   &  s    zNonUniformImage.set_filternormc             C   s   d S )Nr:   )r_   rê   r:   r:   r;   rj   )  s    zNonUniformImage.set_filterradc                s"   | j d k	rtdƒ‚tƒ j|ƒ d S )Nz'Cannot change colors after loading data)r{   r|   rv   Úset_norm)r_   rq   )ry   r:   r;   r,  ,  s    
zNonUniformImage.set_normc                s"   | j d k	rtdƒ‚tƒ j|ƒ d S )Nz'Cannot change colors after loading data)r{   r|   rv   Úset_cmap)r_   rp   )ry   r:   r;   r-  1  s    
zNonUniformImage.set_cmap)r!  F)rò   ró   rô   rd   rÁ   r!   rç   rè   rk   rÏ   ri   rj   r,  r-  r÷   r:   r:   )ry   r;   r   À  s   	
$r   c                   sL   e Zd ZdZd‡ fdd„	Zddd„Zd	d
„ Zdd„ Zdd„ Zdd„ Z	‡  Z
S )ÚPcolorImagezÉ
    Make a pcolor-style plot with an irregular rectangular grid.

    This uses a variation of the original irregular image code,
    and it is used by pcolorfast for the corresponding grid type.
    Nc                s6   t ƒ j|||d� | j|ƒ |dk	r2| j|||ƒ dS )zÝ
        cmap defaults to its rc setting

        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        Additional kwargs are matplotlib.artist properties
        )rq   rp   N)rv   rd   rn   rç   )r_   ro   r5   r6   rY   rp   rq   ru   )ry   r:   r;   rd   >  s    
zPcolorImage.__init__ç      ð?Fc          
   C   s:  | j d krtdƒ‚|rtdƒ‚| jjjƒ }tj|dƒ}tj	|ƒd j
tjƒ}| jjj\}}}}	tj|ƒd tj|ƒd  }
tj|	ƒd tj|ƒd  }ttj|
| ƒƒ}
ttj|| ƒƒ}| jd krô| j| j dd�}|| _| j jdkrú| jjƒ | _n| j}| jj}tj| j| j|||
|j|j|j|jf|ƒ}|||tƒ fS )	Nz"You must first set the image arrayz&unsampled not supported on PColorImager   rX   g      à?T)r„   rz   )r{   r|   r‹   r]   ÚpatchÚget_facecolorr£   r«   r   r¨   r˜   r    r8   r'  rH   r'   r   rŠ   rp   r"  r#  r&  r-   Zpcolor2r)  r*  r+   rÿ   r,   r   r   )r_   r/   r0   r³   ÚfcÚbgrJ   rK   rñ   r¶   r)   r(   rY   Zvlr¿   r:   r:   r;   r!   S  s2    

zPcolorImage.make_imagec             C   s   dS )NFr:   )r_   r/   r:   r:   r;   rÁ   q  s    z"PcolorImage._check_unsampled_imagec             C   s"  t j|dd�}|dkr4tjd|jd d tjd�}ntj|tjƒjƒ }|dkrltjd|jd d tjd�}ntj|tjƒjƒ }|jdd… |jd |jd fkrÊt	d|jdd… |jd |jd ff ƒ‚|j
dkrÜt	d
ƒ‚|j
d	koò|jd dk�r|jdd… |_d| _|j
d	k�rœ|jd dk�r”|dd…dd…df |dd…dd…df kjƒ �rœ|dd…dd…df |dd…dd…df kjƒ �rœd| _nt	dƒ‚|d |d k �rÒ|ddd… }|dd…ddd…f }|d |d k �r |ddd… }|ddd… }|| _|| _|| _d| _d| _dS )aì  
        Set the grid for the rectangle boundaries, and the data values.

          *x* and *y* are monotonic 1-D ndarrays of lengths N+1 and M+1,
             respectively, specifying rectangle boundaries.  If None,
             they will be created as uniform arrays from 0 through N
             and 0 through M, respectively.

          *A* is an (M,N) ndarray or masked array of values to be
            colormapped, or a (M,N,3) RGB array, or a (M,N,4) RGBA
            array.

        T)rÙ   Nr   r   )r   rz   z2Axes don't match array shape. Got %s, expected %s.rW   zA must be 2D or 3DFr   z+3D arrays must have RGB or RGBA as last dim)rz   rW   )rW   r   r…   r…   r…   r…   r…   r…   )r–   rÞ   r   Úaranger$   r•   r¨   ÚravelrB   r‹   rŠ   r#  Úallr{   r)  r*  r   rÃ   )r_   r5   r6   rY   r:   r:   r;   rç   t  sB    "&
22zPcolorImage.set_datac             G   s   t dƒ‚d S )NzMethod not supported)r¾   )r_   rÊ   r:   r:   r;   rè   «  s    zPcolorImage.set_arrayc             C   s–   |j |j }}|| jd k sF|| jd ksF|| jd k sF|| jd krJd S tj| j|ƒd }tj| j|ƒd }y| j||f S  tk
r�   d S X d S )Nr   r   r…   r…   )rÍ   rÎ   r)  r*  r   Úsearchsortedr{   Ú
IndexError)r_   r  r5   r6   r  r  r:   r:   r;   r  ®  s    zPcolorImage.get_cursor_data)NNNNN)r/  F)rò   ró   rô   Ú__doc__rd   r!   rÁ   rç   rè   r  r÷   r:   r:   )ry   r;   r.  7  s       
7r.  c                   s@   e Zd ZdZdZd‡ fdd„	Zdd„ Zdd
d„Zdd„ Z‡  Z	S )ÚFigureImager   r   Nc                s:   t ƒ jd|||d� || _|| _|| _| j|ƒ d| _dS )z´
        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        kwargs are an optional list of Artist keyword args
        N)rq   rp   rh   g      ð?)rv   rd   ÚfigureÚoxÚoyrn   r0   )r_   Úfigrp   rq   ÚoffsetxÚoffsetyrh   ru   )ry   r:   r;   rd   Á  s    
zFigureImage.__init__c             C   s8   | j ƒ \}}d| j |d | j d| j |d | j fS )z.Get the image extent: left, right, bottom, topg      à?g      à¿g      à¿)r}   r<  r=  )r_   r  r  r:   r:   r;   rÏ   Û  s    zFigureImage.get_extentç      ð?Fc       	   	   C   s¦   |j | jj  }t| j| | j| g| j| | jjd  | j| | jjd  ggƒ}| jjƒ \}}||j 9 }||j 9 }tddg||ggƒ}| j| j||||| |dd�S )Nr   r   F)r0   r³   r´   )	Údpir;  r
   r<  r=  r{   r$   Úget_size_inchesr½   )	r_   r/   r0   r³   Úfacr8   r)   r(   rœ   r:   r:   r;   r!   á  s    

zFigureImage.make_imagec             C   s"   t jj| tj|dd�ƒ d| _dS )zSet the image array.T)rÙ   N)re   rf   rè   r–   rÞ   rÃ   )r_   rY   r:   r:   r;   rç   ò  s    zFigureImage.set_data)NNr   r   N)rA  F)
rò   ró   rô   rõ   ré   rd   rÏ   r!   rç   r÷   r:   r:   )ry   r;   r:  ¼  s       
r:  c            	       sh   e Zd ZdZejddƒd‡ fd	d
„	ƒZejdƒedd„ ƒƒZ	dd„ Z
ddd„Zdd„ Zddd„Z‡  ZS )Ú	BboxImagez;The Image class whose size is determined by the given bbox.z3.1Úinterp_at_nativeNr   ç      @FTc
          
      s:   t ƒ jd|||||||dœ|
—Ž || _|	| _tƒ | _dS )z´
        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        kwargs are an optional list of Artist keyword args
        N)rp   rq   rr   rh   rs   rt   r   )N)rv   rd   r8   Ú_interp_at_nativer   Ú
_transform)r_   r8   rp   rq   rr   rh   rs   rt   r   rF  ru   )ry   r:   r;   rd   ü  s    zBboxImage.__init__c             C   s   | j S )N)rH  )r_   r:   r:   r;   rF    s    zBboxImage.interp_at_nativec             C   s   | j S )N)rI  )r_   r:   r:   r;   rˆ   #  s    zBboxImage.get_transformc             C   sD   |d kr| j ƒ j}t| jtƒr$| jS t| jƒr8| j|ƒS tdƒ‚d S )Nzunknown type of bbox)Ú
get_figureÚ_cachedRendererr=   r8   r	   Úcallabler‹   )r_   r/   r:   r:   r;   r  &  s    


zBboxImage.get_window_extentc             C   sL   | j dk	r| j | |ƒS | jƒ s&di fS |j|j }}| jƒ j||ƒ}|i fS )z7Test whether the mouse event occurred within the image.NF)rË   rÂ   r5   r6   r  rÒ   )r_   rÐ   r5   r6   rÑ   r:   r:   r;   rÒ   1  s    
zBboxImage.containsç      ð?c       	      C   s~   |j ƒ \}}| j|ƒjƒ }| j||g  _| j|ƒ}tddg||ggƒ}ttddgddggƒ|ƒ| _| j| j|||||d�S )Nr   r   )r³   )	Úget_canvas_width_heightr  r­   Ú_pointsr
   r   rI  r½   r{   )	r_   r/   r0   r³   r)   r(   Zbbox_inZbbox_outrœ   r:   r:   r;   r!   >  s    
zBboxImage.make_image)NNNNr   rG  FT)N)rM  F)rò   ró   rô   r9  r–   Ú_delete_parameterrd   Ú
deprecatedÚpropertyrF  rˆ   r  rÒ   r!   r÷   r:   r:   )ry   r;   rE  ù  s    
       
rE  c             C   sr  dd„ }d|i}|dkr˜t | tƒrdtjj| ƒ}t|jƒdkrBd}q–tjj	| ƒ\}}|j
ƒ dd… }qœt| dƒr’tjj	| jƒ\}}|j
ƒ dd… }qœd}n|}||krôyddlm} W n$ tk
rØ   td	t|ƒ ƒ‚Y nX |j| ƒ�
}t|ƒS Q R X || }	t | tƒ�rftjj| ƒ}t|jƒdk�rJdd
lm}
 t|
j| ƒjƒ ƒ}|	|ƒS t| dƒ�
}|	|ƒS Q R X n|	| ƒS dS )aâ  
    Read an image from a file into an array.

    Parameters
    ----------
    fname : str or file-like
        The image file to read. This can be a filename, a URL or a Python
        file-like object opened in read-binary mode.
    format : str, optional
        The image file format assumed for reading the data. If not
        given, the format is deduced from the filename.  If nothing can
        be deduced, PNG is tried.

    Returns
    -------
    imagedata : :class:`numpy.array`
        The image data. The returned array has shape

        - (M, N) for grayscale images.
        - (M, N, 3) for RGB images.
        - (M, N, 4) for RGBA images.

    Notes
    -----
    Matplotlib can only read PNGs natively. Further image formats are
    supported via the optional dependency on Pillow. Note, URL strings
    are not compatible with Pillow. Check the `Pillow documentation`_
    for more information.

    .. _Pillow documentation: http://pillow.readthedocs.io/en/latest/
    c              _   s   ddl m} |j| |ŽS )Nr   )rÓ   )rÕ   rÓ   Úread_png)rÊ   ru   rÓ   r:   r:   r;   rS  l  s    zimread.<locals>.read_pngÚpngNr   Únamer   )rØ   z_Only know how to handle extensions: %s; with Pillow installed matplotlib can handle more images)ÚrequestÚrb)r=   ÚstrÚurllibÚparseÚurlparser   ÚschemeÚosÚpathÚsplitextrÔ   ÚhasattrrU  rÛ   rØ   rÜ   r‹   ÚlistÚopenrÝ   rV  r   ÚurlopenÚread)r×   rŒ   rS  ÚhandlersÚparsedÚextÚbasenamerØ   r3   ÚhandlerrV  Úfdr:   r:   r;   ÚimreadK  s@    !

rk  éd   c             C   sØ  ddl m} ddlm}	 t| tjƒr.tj| ƒ} |dkr^t| tƒrRt	| ƒj
dd… ntd jƒ }|d"krž||dd�}
|
j|||||dd� |
j| ||dd� �n6tj|d�}|j||ƒ |dkrÆtd }|dkrÜ|ddd#… }|j|dd�}|dk�r|	j|| |d� nÎyddlm} W n6 tk
�rL } ztd|› d�ƒ|‚W Y dd}~X nX |jd |jd f}|jd||ddddƒ}|d$k�rÀd}tdd„ tjtd ƒD ƒƒ}|jd ||ƒ}|j||ƒ |}|j| |||fd!� dS )%aþ  
    Save an array as an image file.

    Parameters
    ----------
    fname : str or PathLike file-like
        A path or a Python file-like object to store the image in.
        If *format* is not set, then the output format is inferred from the
        extension of *fname*, if any, and from :rc:`savefig.format` otherwise.
        If *format* is set, it determines the output format.
    arr : array-like
        The image data. The shape can be one of
        MxN (luminance), MxNx3 (RGB) or MxNx4 (RGBA).
    vmin, vmax : scalar, optional
        *vmin* and *vmax* set the color scaling for the image by fixing the
        values that map to the colormap color limits. If either *vmin*
        or *vmax* is None, that limit is determined from the *arr*
        min/max value.
    cmap : str or `~matplotlib.colors.Colormap`, optional
        A Colormap instance or registered colormap name. The colormap
        maps scalar data to colors. It is ignored for RGB(A) data.
        Defaults to :rc:`image.cmap` ('viridis').
    format : str, optional
        The file format, e.g. 'png', 'pdf', 'svg', ...  The behavior when this
        is unset is documented under *fname*.
    origin : {'upper', 'lower'}, optional
        Indicates whether the ``(0, 0)`` index of the array is in the upper
        left or lower left corner of the axes.  Defaults to :rc:`image.origin`
        ('upper').
    dpi : int
        The DPI to store in the metadata of the file.  This does not affect the
        resolution of the output image.
    r   )ÚFigure)rÓ   Nr   zsavefig.formatÚpdfÚpsÚepsÚsvgF)rB  ÚframeonT)rp   r›   rš   rh   Úresize)rB  rŒ   Ztransparent)rp   zimage.originrÔ   )r„   rT  )rB  )rØ   z
Saving to z requires PillowÚRGBAÚrawÚjpgÚjpegc             s   s   | ]}t |d  ƒV  qdS )rX   N)r'   )r?   r5   r:   r:   r;   r@   ç  s   zimsave.<locals>.<genexpr>zsavefig.facecolorÚRGB)rŒ   rB  )rn  ro  rp  rq  r…   )rv  rw  )Úmatplotlib.figurerm  rÕ   rÓ   r=   r]  ÚPathLikeÚfspathrX  r   Úsuffixr   rÔ   ÚfigimageÚsavefigre   rf   Úset_climr«   rÖ   rÛ   rØ   rÜ   r$   Ú
frombufferr\   r£   Úto_rgbÚnewZpasteÚsave)r×   r  r›   rš   rp   rŒ   rh   rB  rm  rÓ   r>  ZsmrZ   rØ   ÚexcZ	pil_shaper3   ÚcolorZ
backgroundr:   r:   r;   ÚimsaveŸ  sL    #

"
r†  c             C   sª   | j dkrtj| ƒS | j jdƒrp| jd| j ƒ}| j jdƒrHtj|dƒ}ntj|d	ƒ}|j| jd
d
d… ƒj	dƒS y| j
dƒ} W n tk
rš   tdƒ‚Y nX tj| ƒS d
S )aX  Load a `PIL image`_ and return it as a numpy array.

    .. _PIL image: https://pillow.readthedocs.io/en/latest/reference/Image.html

    Returns
    -------
    numpy.array

        The array shape depends on the image type:

        - (M, N) for grayscale images.
        - (M, N, 3) for RGB images.
        - (M, N, 4) for RGBA images.

    rt  ÚRGBXrx  ÚLzI;16ru  r+  z>u2z<u2Nr   z=u2zUnknown image mode)rt  r‡  rx  rˆ  r…   )Úmoder   r¬   Ú
startswithÚtobytesÚendswithr€  ÚreshaperB   r˜   Úconvertr‹   r|   )ZpilImageru  r5   r:   r:   r;   rÝ   ï  s    

rÝ   çš™™™™™¹?r   Fc             C   s¶   t | ƒ}|j\}}}d}	||	 | }
||	 | }|rRddlj}|j||
f|	d�}n$ddlm} |||
f|	d�}t|ƒ |jddddgddg g d	�}|j	|dd
|d� |j
||	d� |S )aw  
    Make a thumbnail of image in *infile* with output filename *thumbfile*.

    See :doc:`/gallery/misc/image_thumbnail_sgskip`.

    Parameters
    ----------
    infile : str or file-like
        The image file -- must be PNG, or Pillow-readable if you have Pillow_
        installed.

        .. _Pillow: http://python-pillow.org/

    thumbfile : str or file-like
        The thumbnail filename.

    scale : float, optional
        The scale factor for the thumbnail.

    interpolation : str, optional
        The interpolation scheme used in the resampling. See the
        *interpolation* parameter of `~.Axes.imshow` for possible values.

    preview : bool, optional
        If True, the default backend (presumably a user interface
        backend) will be used which will cause a figure to be raised if
        `~matplotlib.pyplot.show` is called.  If it is False, the figure is
        created using `FigureCanvasBase` and the drawing backend is selected
        as `~matplotlib.figure.savefig` would normally do.

    Returns
    -------
    figure : `~.figure.Figure`
        The figure instance containing the thumbnail.
    rl  r   N)ÚfigsizerB  )rm  r   r  F)Úaspectrr  ÚxticksÚyticksT)r‘  r   rr   )rB  )rk  r$   Úmatplotlib.pyplotÚpyplotr;  ry  rm  r   Úadd_axesÚimshowr~  )ÚinfileZ	thumbfiler‡   rr   Úpreviewr¿   ÚrowsÚcolsÚdepthrB  r(   r)   Úpltr>  rm  ro   r:   r:   r;   Ú	thumbnail  s     &
rž  )r   )N)N)NNNNNrl  )r�  r   F)Jr9  Úior   Úmathr   r]  ÚloggingÚpathlibr   Úurllib.parserY  Únumpyr   rÕ   r   Úmatplotlib.artistÚartistrb   Úmatplotlib.backend_basesr   Úmatplotlib.colorsÚcolorsr£   Úmatplotlib.cmre   Úmatplotlib.cbookr–   Zmatplotlib._imager-   Úmatplotlib.transformsr   r	   r
   r   r   r   Ú	getLoggerrò   rä   r.   ZBILINEARZBICUBICZSPLINE16ZSPLINE36ZHANNINGZHAMMINGZHERMITEZKAISERZQUADRICZCATROMZGAUSSIANZBESSELZMITCHELLZSINCZLANCZOSZBLACKMANrž   ÚsetZinterpolations_namesr<   rV   r[   rc   rf   r>   rø   r   r.  r:  rE  rk  r†  rÝ   rž  r:   r:   r:   r;   Ú<module>   st   




 


;
-      
w =R
T 
O# 