ó
±éRc           @  sð  d  Z  d d l m Z m Z d d l Z d d l Z d d l Z d d l Z d d l m	 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 j Z d d l Td d l m Z m Z m Z d d l j Z  d	 e j! e j" f d
 „  ƒ  YZ# d e# f d „  ƒ  YZ$ d e$ f d „  ƒ  YZ% d e j! e j" f d „  ƒ  YZ& d e j! e j" f d „  ƒ  YZ' d e# f d „  ƒ  YZ( e) d „ Z* e) e) e) e) e) d d „ Z+ d „  Z, d d e- d „ Z. d S(   sS   
The image module supports basic image loading, rescaling and display
operations.

iÿÿÿÿ(   t   divisiont   print_functionN(   t   ma(   t   rcParams(   t   allow_rasterization(   t   *(   t   BboxBaset   Bboxt   IdentityTransformt   _AxesImageBasec           B  sû  e  Z d  Z i e j d 6e j d 6e j d 6e j d 6e j d 6e j d 6e j	 d 6e j
 d 6e j d	 6e j d
 6e j d 6e j d 6e j d 6e j d 6e j d 6e j d 6e j d 6e j d 6Z e g  e j ƒ  D] \ Z Z e e f ^ qÖ ƒ Z e j ƒ  Z d „  Z d- d- d- d- d d e d „ Z  d „  Z! d „  Z" d „  Z# d d „ Z$ d „  Z% e& d „  ƒ Z' d „  Z( d „  Z) e* d  „  ƒ Z+ d! „  Z, e d" „ Z- d# „  Z. d$ „  Z/ d% „  Z0 d& „  Z1 d' „  Z2 d( „  Z3 d) „  Z4 d* „  Z5 d+ „  Z6 d, „  Z7 RS(.   i    t   nonet   nearestt   bilineart   bicubict   spline16t   spline36t   hanningt   hammingt   hermitet   kaisert   quadrict   catromt   gaussiant   besselt   mitchellt   sinct   lanczost   blackmanc         C  s   d t  |  j j j ƒ S(   Ns   AxesImage(%g,%g;%gx%g)(   t   tuplet   axest   bboxt   bounds(   t   self(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   __str__>   s    i   g      @c	   
      K  s±   t  j j |  ƒ t j j |  | | ƒ | d k r? t d } n  | |  _ |  j | ƒ |  j	 | ƒ | |  _
 |  j | ƒ |  j | ƒ | |  _ d |  _ d |  _ |  j |	 ƒ d S(   sÀ  
        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

        s   image.originN(   t   martistt   Artistt   __init__t   cmt   ScalarMappablet   NoneR   t   origint   set_filternormt   set_filterradt
   _filterradt   set_interpolationt   set_resampleR   t   _imcachet   _image_skew_coordinatet   update(
   R    t   axt   cmapt   normt   interpolationR(   t
   filternormt	   filterradt   resamplet   kwargs(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR$   A   s    					c         C  s,   |  j  d k r t d ƒ ‚ n  |  j  j d  S(   s+   Get the numrows, numcols of the input images"   You must first set the image arrayi   N(   t   _AR'   t   RuntimeErrort   shape(   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   get_sizep   s    c         C  s    t  j j |  | ƒ d |  _ d S(   sw   
        Set the alpha value used for blending - not supported on
        all backends

        ACCEPTS: float
        N(   R"   R#   t	   set_alphaR'   R.   (   R    t   alpha(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR=   w   s    c         C  s&   d |  _ d |  _ t j j |  ƒ d S(   sb   
        Call this whenever the mappable is changed so observers can
        update state
        N(   R'   R.   t
   _rgbacacheR%   R&   t   changed(   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR@   �   s    		g      ð?c         C  s   t  d ƒ ‚ d  S(   Ns)   The make_image method must be overridden.(   R:   (   R    t   magnification(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt
   make_imageŠ   s    c         C  sK  | \ } } } } | | } | | }	 | j  d k rJ | d k rJ d }
 n | | j  }
 | j d k r{ |	 d k r{ d } n |	 | j } | j d  \ } } |
 d k r\| j | | | } t d t | |  j ƒ ƒ } | j | | | } t | t | |  j ƒ ƒ } t	 | | ƒ } | } | | | | } | | | | } | | } | | j  }
 n t	 d | ƒ } | d k rU| j
 | |	 | } t d t | |  j ƒ ƒ } | j | |	 | } t | t | |  j ƒ ƒ } |  j d k rt	 | | | | ƒ } n t	 | | ƒ } | } | | |	 | } | | |	 | } | | }	 |	 | j } n t	 d | ƒ } | |  j k s‚| |  j k r d |  _ | |  _ | |  _ n  |  j d k r)|  j j t j k r
|  j j d k r
t j |  j | | d d … f d ƒ } t | _ n÷ |  j d k r£|  j |  j d t ƒ} t j | |  j ƒ rU| j ƒ  } n  | d	 d d … f c | d	 d d
 … f 9<| d j t j ƒ } | |  _ n	 |  j } t j | | | d d … f d ƒ } |  j j d k rø|  j j  ƒ  | _ n	 t | _ | |  _ |  j d k r2| j! ƒ  q2n	 |  j } | | | | |	 |
 | f S(   s  
        convert numpy array A with given extents ([x1, x2, y1, y2] in
        data coordinate) into the Image, given the viewlim (should be a
        bbox instance).  Image will be clipped if the extents is
        significantly larger than the viewlim.
        g        g      ð?i   i    t   upperi   Nt   bytes.i   iÿ   ("   t   widtht   heightR;   t   x0t   maxt   intR+   t   x1t   mint   slicet   y0t   y1R(   t
   _oldxslicet
   _oldysliceR'   R.   R9   t   dtypet   npt   uint8t   ndimt   _imaget   frombytet   Falset   is_grayscaleR?   t   to_rgbat   may_share_memoryt   copyt   astypeR2   t   is_grayt	   flipud_in(   R    t   At   image_extentst   viewlimt   xmint   xmaxt   ymint   ymaxt   dxintvt   dyintvt   sxt   syt   numrowst   numcolsRG   t   ix0RJ   t   ix1t   xslicet   xmin_oldRM   t   iy0RN   t   iy1t   yslicet   ymin_oldt   imt   x(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   _get_unsampled_image�   sz    

		

		'(,	%			c         C  s,  t  j ƒ  } | j |  | ƒ | j | | f ƒ \ } } | j | | f ƒ \ }	 }
 d | |
 | |	 t j |
 | g |	 | g g ƒ } | t j | g | g g ƒ j \ } } | t j | g d g g ƒ j \ } } t  j j | | | | d d ƒ } | | t  j ƒ  j |  | ƒ j ƒ  j	 ƒ  } | S(   sh  
        Retuen a transform that does
         (x1, y1) -> (x1, y1)
         (x2, y2) -> (x2, y2)
         (x2, y1) -> (x3, y3)

        It was intended to derive a skew transform that preserve the
        lower-left corner (x1, y1) and top-right corner(x2,y2), but
        change the the lower-right-corner(x2, y1) to a new position
        (x3, y3).
        g      ð?i    (
   t   mtransformst   Affine2Dt	   translatet   transform_pointRR   t   matt   flatt   from_valuest   invertedt
   get_affine(   RJ   RN   t   x2t   y2t   x3t   y3t   tr1t   x2at   y2at   x3at   y3at   inv_matt   at   bt   ct   dt   tr2t   tr(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   _get_rotate_and_skew_transformå   s    7((!%c   +      C  sÄ  |  j  ƒ  } |  j ƒ  \ } } } } | j t j | | f | | f g ƒ ƒ } | d \ }	 }
 | d \ } } |	 | |
 | f } |  j rð |  j \ } } | j t j | | f g ƒ ƒ } | d \ } } |  j |	 |
 | | | | ƒ } | } n	 t ƒ  } |  j j	 j
 \ } } } } | j ƒ  } | j t j | | f | | f | | f | | f g ƒ ƒ } t | d d … d f ƒ t | d d … d f ƒ } } t | d d … d f ƒ t | d d … d f ƒ } } t j | | | | ƒ } |  j |  j | | ƒ \ }  }! }" }# }$ }% }& |  d k r#d S|  j j j ƒ  }' t j j |' d ƒ }( |  j |( Œ  |  j ƒ  |  j ƒ  \ }) }* |  j |* |) ƒ |  j ƒ  |  _ |  j ƒ  |  _ | j  | |! |" |  |# |$ | ƒ d S(   su   
        draw unsampled image. The renderer should support a draw_image method
        with scale parameter.
        i    i   N(!   t   get_transformt
   get_extentt	   transformRR   t   arrayR/   R�   R   R   R   t   extentsR~   RK   RH   R   t   from_extentsRv   R9   R'   t   patcht   get_facecolort   mcolorst   colorConverterRY   t   set_bgt   reset_matrixR<   t   resizet   get_urlt   _urlt   get_gidt   _gidt
   draw_image(+   R    t   renderert   gct   transt   x_llct   x_trct   y_llct   y_trct   xyt   _xx1t   _yy1t   _xx2t   _yy2t   extent_in_ict   x_lrct   y_lrct   xy2t   _xx3t   _yy3t   tr_rotate_skewt   trans_ic_to_canvasRJ   RN   R€   R�   t   trans_canvas_to_ict   xy_t   x1_t   x2_t   y1_t   y2_t   viewLim_in_icRt   Rb   Rd   Rf   Rg   Rh   Ri   t   fct   bgRj   Rk   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   _draw_unsampled_image  sL    
	!				99-
c         C  s   t  S(   s{   
        return True if the image is better to be drawn unsampled.
        The derived class needs to override it.
        (   RW   (   R    R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   _check_unsampled_imageP  s    c   
      O  sX  |  j  ƒ  s d  S|  j j ƒ  d k s: |  j j ƒ  d k rJ t j d ƒ n  |  j j j \ } } } } | j ƒ  } | j	 |  j j j
 ƒ  ƒ | j |  j ƒ  ƒ | j |  j ƒ  ƒ |  j | ƒ rÒ |  j | | ƒ nx |  j d  k	 rñ t j d ƒ n  |  j | j ƒ  ƒ }	 |	 d  k rd  S|  j ƒ  |	 _ |  j ƒ  |	 _ | j | | | |	 ƒ | j ƒ  d  S(   Nt   linears,   Images are not supported on non-linear axes.s4   Image will not be shown correctly with this backend.(   t   get_visibleR   t
   get_xscalet
   get_yscalet   warningst   warnR   R   t   new_gct   set_clip_rectanglet   frozent   set_clip_patht   get_clip_pathR=   t	   get_alphaRÁ   RÀ   R/   R'   RB   t   get_image_magnificationRž   RŸ   R    R¡   R¢   t   restore(
   R    R£   t   argsR8   t   lR‹   t   widthDisplayt   heightDisplayR¤   Rt   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   drawW  s*    c   	      C  sÝ   t  |  j ƒ r |  j |  | ƒ S| j | j } } |  j ƒ  \ } } } } | | k rf | | } } n  | | k r‚ | | } } n  | d k	 rÍ | d k	 rÍ | | k oÇ | | k oÇ | | k oÇ | | k } n t } | i  f S(   sH   
        Test whether the mouse event occured within the image.
        N(   t   callablet	   _containst   xdatat   ydataR’   R'   RW   (	   R    t
   mouseeventRu   t   yRb   Rc   Rd   Re   t   inside(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   containst  s    c   	      C  s—   |  j  ƒ  } | d k r d S| r^ | j ƒ  \ } } | j ƒ  | j d ƒ | j | | ƒ n  | j ƒ  | j ƒ  \ } } } t j	 | | | | ƒ d S(   s&   Write the image to png file with fnameNi    (
   RB   R'   R<   Rœ   R,   R�   t
   flipud_outt   as_rgba_strt   _pngt	   write_png(	   R    t   fnamet   noscaleRt   Rj   Rk   t   rowst   colst   buffer(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRà   �  s    

c         C  sä   t  | d ƒ r! t | ƒ |  _ n t j | ƒ |  _ |  j j t j k rs t j |  j j t j	 ƒ rs t
 d ƒ ‚ n  |  j j d	 k s­ |  j j d k r¼ |  j j d d
 k r¼ t
 d ƒ ‚ n  d |  _ d |  _ d |  _ d |  _ d S(   sI   
        Set the image array

        ACCEPTS: numpy/PIL Image A
        t   getpixels#   Image data can not convert to floati   i   iÿÿÿÿi   s!   Invalid dimensions for image dataN(   i   i   (   i   i   (   t   hasattrt   pil_to_arrayR9   t   cbookt   safe_masked_invalidRQ   RR   RS   t   can_castt   floatt	   TypeErrorRT   R;   R'   R.   R?   RO   RP   (   R    R_   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   set_data›  s    (			c         C  s   |  j  | ƒ d S(   sq   
        Retained for backwards compatibility - use set_data instead

        ACCEPTS: numpy array A or PIL ImageN(   Rî   (   R    R_   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt	   set_array´  s    	c         C  s   |  j  S(   s*  
        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'.

        (   t   _interpolation(   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   get_interpolation¿  s    	c         C  sP   | d k r t d } n  | j ƒ  } | |  j k rC t d ƒ ‚ n  | |  _ d S(   s7  
        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.

        ACCEPTS: ['nearest' | 'bilinear' | 'bicubic' | 'spline16' |
          'spline36' | 'hanning' | 'hamming' | 'hermite' | 'kaiser' |
          'quadric' | 'catrom' | 'gaussian' | 'bessel' | 'mitchell' |
          'sinc' | 'lanczos' | 'none' |]

        s   image.interpolations   Illegal interpolation stringN(   R'   R   t   lowert   _interpdt
   ValueErrorRð   (   R    t   s(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR,   Ê  s    c         C  s&   | d k r t d } n  | |  _ d S(   sZ   
        Set whether or not image resampling is used

        ACCEPTS: True|False
        s   image.resampleN(   R'   R   t	   _resample(   R    t   v(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR-   à  s    c         C  s   |  j  S(   s!   Return the image resample boolean(   Rö   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   get_resampleê  s    c         C  s   | r d |  _  n	 d |  _  d S(   sy   
        Set whether the resize filter norms the weights -- see
        help for imshow

        ACCEPTS: 0 or 1
        i   i    N(   t   _filternorm(   R    R5   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR)   î  s    c         C  s   |  j  S(   s   Return the filternorm setting(   Rù   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   get_filternormú  s    c         C  s+   t  | ƒ } | d k s t ‚ | |  _ d S(   sœ   
        Set the resize filter radius only applicable to some
        interpolation schemes -- see help for imshow

        ACCEPTS: positive float
        i    N(   Rì   t   AssertionErrorR+   (   R    R6   t   r(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR*   þ  s    c         C  s   |  j  S(   s   return the filterrad setting(   R+   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   get_filterrad	  s    N(8   t   __name__t
   __module__t   zorderRU   t   NEARESTt   BILINEARt   BICUBICt   SPLINE16t   SPLINE36t   HANNINGt   HAMMINGt   HERMITEt   KAISERt   QUADRICt   CATROMt   GAUSSIANt   BESSELt   MITCHELLt   SINCt   LANCZOSt   BLACKMANRó   t   dictt	   iteritemst   kR÷   t	   _interpdrt   keyst   interpnamesR!   R'   RW   R$   R<   R=   R@   RB   Rv   t   staticmethodR�   RÀ   RÁ   R   RÔ   RÜ   Rà   Rî   Rï   Rñ   R,   R-   Rø   R)   Rú   R*   Rý   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR	   !   sf   
















1	(		
			X	M							
				t	   AxesImagec        	   B  sY   e  Z d  „  Z d	 d	 d	 d	 d	 d d e d „ Z d d „ Z d „  Z d „  Z d „  Z	 RS(
   c         C  s   d t  |  j j j ƒ S(   Ns   AxesImage(%g,%g;%gx%g)(   R   R   R   R   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR!     s    i   g      @c
         K  sJ   | |  _  t j |  | d | d | d | d | d | d | d |	 |
 �d S(	   sÀ  
        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

        R2   R3   R4   R(   R5   R6   R7   N(   t   _extentR	   R$   (   R    R1   R2   R3   R4   R(   t   extentR5   R6   R7   R8   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR$     s    	g      ð?c   "      C  s¡  |  j  d  k r t d ƒ ‚ n  |  j ƒ  \ } } } } |  j ƒ  } | j t j | | f | | f g ƒ ƒ } | d \ } }	 | d \ }
 } t j	 |  j
 j | ƒ } |  j |  j  | |
 |	 | g | ƒ \ } } } } } } } |  j
 j j ƒ  } t j j | d ƒ } | j | Œ  | j ƒ  | j ƒ  \ } } | d k  sE| d k  rId  S| j |  j |  j ƒ | j |  j ƒ | d k r…d } n | | j | | } | d k r¯d } n | | j | | } | j | | ƒ |  j
 j j \ } } } } t | | ƒ d t | | ƒ d } t | | ƒ d t | | ƒ d } | | }  | | }! | j  |  | |! | ƒ | j! t" | d ƒ t" | d ƒ d |  j# d |  j$ ƒ| S(   Ns9   You must first set the image array or the image attributei    i   g        g      à?R3   t   radius(%   R9   R'   R:   R’   R‘   R“   RR   R”   Rw   t   TransformedBboxR   t   viewLimRv   R—   R˜   R™   Rš   RY   R›   Rœ   R<   R,   Ró   Rð   R-   Rö   RG   RM   t   apply_translationR   R•   t   roundt   apply_scalingR�   RI   Rù   R+   ("   R    RA   RJ   R€   RN   R�   R¥   Rª   t   _x1t   _y1t   _x2t   _y2t   transformed_viewLimRt   Rb   Rd   Rf   Rg   Rh   Ri   R¾   R¿   Rj   Rk   t   txt   tyRÑ   R‹   Rü   t   tRÒ   RÓ   t   rxt   ry(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRB   9  sN    	
		

#c         C  s=   |  j  ƒ  d k r9 | j ƒ  r" t St j d | j ƒ n  t S(   sK   
        return True if the image is better to be drawn unsampled.
        R
   sk   The backend (%s) does not support interpolation='none'. The image will be interpolated with 'nearest` mode.(   Rñ   t   option_scale_imaget   TrueRÆ   RÇ   t	   __class__RW   (   R    R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÁ   u  s    	c         C  s�   | |  _  | \ } } } } | | f | | f f } |  j j | ƒ |  j j rn |  j j | | f d d ƒn  |  j j r™ |  j j | | f d d ƒn  d S(   sc  
        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.

        t   autoN(   R  R   t   update_datalimt   _autoscaleXont   set_xlimR'   t   _autoscaleYont   set_ylim(   R    R  Rb   Rc   Rd   Re   t   corners(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt
   set_extent„  s    
	c         C  sq   |  j  d k	 r |  j  S|  j ƒ  } | \ } } |  j d k rU d | d | d d f Sd | d d | d f Sd S(   s.   Get the image extent: left, right, bottom, topRC   g      à¿g      à?N(   R  R'   R<   R(   (   R    t   szRj   Rk   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR’   ˜  s    N(
   Rþ   Rÿ   R!   R'   RW   R$   RB   RÁ   R6  R’   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR    s   	<		t   NonUniformImagec           B  sn   e  Z d  „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z RS(   c         K  s6   | j  d d ƒ } t j |  | | � |  j | ƒ d S(   s©   
        kwargs are identical to those for AxesImage, except
        that 'interpolation' defaults to 'nearest', and 'bilinear'
        is the only alternative.
        R4   R   N(   t   popR  R$   R,   (   R    R1   R8   t   interp(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR$   §  s    c         C  s   t  S(   s;   
        return False. Do not use unsampled image.
        (   RW   (   R    R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÁ   ²  s    g      ð?c         C  s©  |  j  d  k r t d ƒ ‚ n  |  j  } t | j ƒ d k rÔ | j t j k rx |  j | d t	 ƒ} |  j
 j ƒ  |  _ qšt j | d  d  … d  d  … t j f d d ƒ } d | d  d  … d  d  … d f <t	 |  _ nÆ | j t j k rÿ d | j t j ƒ } n  | j d d k r‘t j t t | j d d !ƒ d g ƒ t j ƒ } | | d  d  … d  d  … d d … f <d | d  d  … d  d  … d f <| } n  t |  _ |  j j j \ } } } } |  j j j \ } }	 }
 } t |
 ƒ d t | ƒ d } t | ƒ d t |	 ƒ d } | | 9} | | 9} t j |  j |  j | | | | | | | | | f |  j |  j ƒ } |  j j  j! ƒ  } t" j# j | d ƒ } | j$ | Œ  |  j | _ | S(	   Ns"   You must first set the image arrayi   RD   i   iÿ   i   i    g      à?(%   R9   R'   R:   t   lenR;   RQ   RR   RS   RY   R-  R2   R]   RX   t   repeatt   newaxisR\   t   zerosR   t   listRW   R   R  R   R   R•   R   RU   t   pcolort   _Axt   _AyRó   Rð   R—   R˜   R™   Rš   R›   (   R    RA   R_   t   BRG   RM   t   v_widtht   v_heightRÑ   R‹   Rü   R)  RE   RF   Rt   R¾   R¿   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRB   ¸  sB    	12%		

c         C  so  t  j | t  j ƒ } t  j | t  j ƒ } t j | ƒ } t | j ƒ d k s� t | j ƒ d k s� | j d d !| j d | j d f k rœ t d ƒ ‚ n  t | j ƒ d
 k rÀ t d ƒ ‚ n  t | j ƒ d k r÷ | j d d k r÷ t d ƒ ‚ n  t | j ƒ d k r5| j d d k r5| j d d !| _ n  | |  _ | |  _	 | |  _
 d	 |  _ d	 |  _ d	 |  _ d	 S(   sT  
        Set the grid for the pixel centers, and the pixel values.

          *x* and *y* are 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.
        i   i    i   s   Axes don't match array shapei   s   Can only plot 2D or 3D datai   s?   3D arrays must have three (RGB) or four (RGBA) color componentsN(   i   i   (   i   i   i   (   RR   t   asarrayt   float32Ré   Rê   R;  R;   Rí   R9   RA  RB  R'   R.   RO   RP   (   R    Ru   RÚ   R_   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRî   à  s$    **((					c         G  s   t  d ƒ ‚ d  S(   Ns   Method not supported(   t   NotImplementedError(   R    RÐ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRï     s    c         C  s;   | d  k	 r' | d k r' t d ƒ ‚ n  t j |  | ƒ d  S(   NR   R   s?   Only nearest neighbor and bilinear interpolations are supported(   s   nearests   bilinear(   R'   RH  R  R,   (   R    Rõ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR,     s    c         C  sJ   |  j  d  k r t d ƒ ‚ n  |  j d |  j d |  j d |  j d f S(   Ns   Must set data firsti    iÿÿÿÿ(   R9   R'   R:   RA  RB  (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR’     s    c         C  s   d  S(   N(    (   R    Rõ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR)     s    c         C  s   d  S(   N(    (   R    Rõ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR*     s    c         C  s5   |  j  d  k	 r t d ƒ ‚ n  t j j |  | ƒ d  S(   Ns'   Cannot change colors after loading data(   R9   R'   R:   R%   R&   t   set_norm(   R    R3   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRI    s    c         C  s5   |  j  d  k	 r t d ƒ ‚ n  t j j |  | ƒ d  S(   Ns'   Cannot change colors after loading data(   R9   R'   R:   R%   R&   t   set_cmap(   R    R2   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRJ    s    (   Rþ   Rÿ   R$   RÁ   RB   Rî   Rï   R,   R’   R)   R*   RI  RJ  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR8  ¦  s   		(	$						t   PcolorImagec           B  se   e  Z d  Z d	 d	 d	 d	 d	 d „ Z d d „ Z d „  Z e d „  ƒ Z d „  Z	 d „  Z
 d „  Z RS(
   sÉ   
    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.
    c         K  s\   t  j j |  ƒ t j j |  | | ƒ | |  _ d |  _ |  j | ƒ |  j	 | | | ƒ d S(   sÞ   
        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

        N(
   R"   R#   R$   R%   R&   R   R'   R?   R0   Rî   (   R    R1   Ru   RÚ   R_   R2   R3   R8   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR$   *  s    		g      ð?c      
   C  s�  |  j  d  k r t d ƒ ‚ n  |  j j j ƒ  } t j j | d ƒ } t	 j
 | ƒ d j t	 j ƒ } |  j j j \ } } } } t | ƒ d t | ƒ d } t | ƒ d t | ƒ d }	 | | } |	 | }	 |  j d  k r)|  j |  j  d t ƒ}
 |
 |  _ |  j  j d k r2|  j j ƒ  |  _ q2n	 |  j }
 |  j j } t j |  j |  j |
 |	 | | j | j | j | j f | ƒ } |  j | _ | S(   Ns"   You must first set the image arrayi    iÿ   g      à?RD   i   (   R9   R'   R:   R   R—   R˜   R™   Rš   RY   RR   R”   R\   RS   R   R•   R   R?   R-  RT   R2   R]   RX   R  RU   t   pcolor2RA  RB  RG   RJ   RM   RN   (   R    RA   R¾   R¿   RÑ   R‹   Rü   R)  RE   RF   R_   t   vlRt   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRB   E  s0    

			c         C  s   d  |  _ t j j |  ƒ d  S(   N(   R'   R?   R%   R&   R@   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR@   `  s    	c         O  s²   |  j  ƒ  s d  S|  j | j ƒ  ƒ } | j ƒ  } | j |  j j j ƒ  ƒ | j |  j	 ƒ  ƒ | j
 |  j ƒ  ƒ | j | t |  j j j ƒ t |  j j j ƒ | ƒ | j ƒ  d  S(   N(   RÃ   RB   RÎ   RÈ   RÉ   R   R   RÊ   RË   RÌ   R=   RÍ   R¢   R   Rb   Rd   RÏ   (   R    R£   RÐ   R8   Rt   R¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÔ   d  s    	c         C  sX  t  j | ƒ } | d  k rD t j d | j d d d t j ƒ} n t j | t j ƒ j ƒ  } | d  k r” t j d | j d d d t j ƒ} n t j | t j ƒ j ƒ  } | j d  | j	 d | j	 d f k rt
 | j ƒ t
 | j	 ƒ t
 | j	 ƒ t d ƒ ‚ n  | j d
 k r*t d ƒ ‚ n  | j d k r_| j d d k r_| j d  | _ n  t |  _ | j d k r0| 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-t |  _ q-q0t d	 ƒ ‚ n  | |  _ | |  _ | |  _ d  |  _ d  S(   Ni    i   RQ   i   s   Axes don't match array shapei   s   A must be 2D or 3Di   s+   3D arrays must have RGB or RGBA as last dim(   i   i   (   i   i   (   Ré   Rê   R'   RR   t   arangeR;   t   float64RF  t   ravelt   sizet   printRô   RT   RW   RX   t   allR-  R9   RA  RB  R?   (   R    Ru   RÚ   R_   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRî   s  s6    ))'"	DD			c         G  s   t  d ƒ ‚ d  S(   Ns   Method not supported(   RH  (   R    RÐ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRï   ”  s    c         C  s$   t  j j |  | ƒ t |  j d <d S(   sw   
        Set the alpha value used for blending - not supported on
        all backends

        ACCEPTS: float
        R”   N(   R"   R#   R=   R-  t   update_dict(   R    R>   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR=   —  s    N(   Rþ   Rÿ   t   __doc__R'   R$   RB   R@   R   RÔ   Rî   Rï   R=   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRK  #  s   		!	t   FigureImagec           B  sw   e  Z d  Z d d d  d  d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d d „ Z
 e d	 „  ƒ Z d
 „  Z RS(   i    c         K  s}   t  j j |  ƒ t j j |  | | ƒ | d k r? t d } n  | |  _ | |  _ | |  _	 | |  _
 |  j | ƒ d |  _ d S(   s´   
        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
        s   image.origing      ð?N(   R"   R#   R$   R%   R&   R'   R   R(   t   figuret   oxt   oyR0   RA   (   R    t   figR2   R3   t   offsetxt   offsetyR(   R8   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR$   ¥  s    				c   	      C  s¥   t  |  j ƒ r |  j |  | ƒ S|  j ƒ  \ } } } } | j | j } } | d k	 r• | d k	 r• | | k o� | | k o� | | k o� | | k } n t } | i  f S(   s6   Test whether the mouse event occured within the image.N(   RÕ   RÖ   R’   Ru   RÚ   R'   RW   (	   R    RÙ   Rb   Rc   Rd   Re   R×   RØ   RÛ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÜ   ¿  s    c         C  s,   |  j  d k r t d ƒ ‚ n  |  j  j d  S(   s+   Get the numrows, numcols of the input images"   You must first set the image arrayi   N(   R9   R'   R:   R;   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR<   Î  s    c         C  sF   |  j  ƒ  \ } } d |  j | d |  j d |  j | d |  j f S(   s.   Get the image extent: left, right, bottom, topg      à¿g      à?(   R<   RX  RY  (   R    Rj   Rk   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR’   Õ  s    c         C  s    t  j j |  t j | ƒ ƒ d S(   s   Set the image array.N(   R%   R&   Rï   Ré   Rê   (   R    R_   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRî   Û  s    c         C  s   |  j  | ƒ d S(   s@   Deprecated; use set_data for consistency with other image types.N(   Rî   (   R    R_   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRï   ß  s    g      ð?c   	      C  s9  |  j  d  k r t d ƒ ‚ n  |  j |  j  d t ƒ} | |  _ | d k } | rZ d } n d } t j | | ƒ } |  j j	 ƒ  } | j
 t j j | d ƒ Œ  |  j j d k oÄ t |  j  j ƒ d k | _ | r|  j ƒ  \ } } | | 9} | | 9} | j t j ƒ | j | | ƒ n  |  j d k r5| j ƒ  n  | S(   Ns"   You must first set the image arrayRD   i   i    t   grayi   RC   (   R9   R'   R:   RY   R-  RA   RU   RV   RW  R˜   R›   R™   Rš   R2   t   nameR;  R;   RX   R<   R,   R  R�   R(   RÝ   (	   R    RA   Ru   t   ismagt   isoutputRt   R¾   Rj   Rk   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRB   ã  s,    		

c         O  s    |  j  ƒ  s d  S|  j | j ƒ  ƒ } | j ƒ  } | j |  j j ƒ | j |  j ƒ  ƒ | j	 |  j
 ƒ  ƒ | j | t |  j ƒ t |  j ƒ | ƒ | j ƒ  d  S(   N(   RÃ   RB   RÎ   RÈ   RÉ   RW  R   RË   RÌ   R=   RÍ   R¢   R   RX  RY  RÏ   (   R    R£   RÐ   R8   Rt   R¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÔ     s    (c         C  s;   |  j  ƒ  } | j ƒ  \ } } } t j | | | | ƒ d S(   s&   Write the image to png file with fnameN(   RB   RÞ   Rß   Rà   (   R    Rá   Rt   Rã   Rä   Rå   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRà     s    N(   Rþ   Rÿ   R   R'   R$   RÜ   R<   R’   Rî   Rï   RB   R   RÔ   Rà   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRV  ¢  s   					t	   BboxImagec        	   B  sh   e  Z d  Z d
 d
 d
 d
 d d e e d „ Z d
 d „ Z d „  Z d „  Z	 d d „ Z
 e d	 „  ƒ Z RS(   s;   The Image class whose size is determined by the given bbox.i   g      @c
         K  sV   t  j |  d d	 d | d | d | d | d | d | d | |
 �| |  _ |	 |  _ d	 S(
   sG  
        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        interp_at_native is a flag that determines whether or not
        interpolation should still be applied when the image is
        displayed at its native resolution.  A common use case for this
        is when displaying an image for annotational purposes; it is
        treated similarly to Photoshop (interpolation is only used when
        displaying the image at non-native resolutions).


        kwargs are an optional list of Artist keyword args

        R1   R2   R3   R4   R(   R5   R6   R7   N(   R	   R$   R'   R   t   interp_at_native(   R    R   R2   R3   R4   R(   R5   R6   R7   Rb  R8   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR$     s    	c         C  sc   | d  k r |  j ƒ  j } n  t |  j t ƒ r7 |  j St |  j ƒ rS |  j | ƒ St d ƒ ‚ d  S(   Ns   unknown type of bbox(   R'   t
   get_figuret   _cachedRenderert
   isinstanceR   R   RÕ   Rô   (   R    R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   get_window_extent@  s    c         C  sj   t  |  j ƒ r |  j |  | ƒ S|  j ƒ  s5 t i  f S| j | j } } |  j ƒ  j | | ƒ } | i  f S(   s6   Test whether the mouse event occured within the image.(   RÕ   RÖ   RÃ   RW   Ru   RÚ   Rf  RÜ   (   R    RÙ   Ru   RÚ   RÛ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÜ   K  s    
c         C  s,   |  j  d k r t d ƒ ‚ n  |  j  j d  S(   s+   Get the numrows, numcols of the input images"   You must first set the image arrayi   N(   R9   R'   R:   R;   (   R    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyR<   X  s    g      ð?c         C  s]  |  j  d  k r t d ƒ ‚ n  |  j d  k r'|  j  j t j k r{ t |  j  j ƒ d k r{ t	 j
 |  j  d ƒ } t | _ n„ |  j d  k r® |  j |  j  d t ƒ} | |  _ n	 |  j } t	 j
 | d ƒ } t |  j  j ƒ d k rö |  j j ƒ  | _ n	 t | _ | |  _ |  j d k r0| j ƒ  q0n	 |  j } | j ƒ  | j |  j |  j ƒ | j |  j ƒ |  j | ƒ j \ } } } } t | ƒ t | ƒ }	 t | ƒ t | ƒ }
 |	 | 9}	 |
 | 9}
 |  j  j d  \ } } |  j r|	 | k r|
 | k r| j d ƒ n  |	 | } |
 | } | j | | ƒ | j t  |	 ƒ t  |
 ƒ d |  j! d |  j" ƒ| S(	   Ns9   You must first set the image array or the image attributei   i    RD   i   RC   R3   R  (#   R9   R'   R:   R.   RQ   RR   RS   R;  R;   RU   RV   RW   RX   R?   RY   R-  R2   R]   R(   R^   Rœ   R,   Ró   Rð   R-   Rö   Rf  R•   R   Rb  R!  R�   RI   Rù   R+   (   R    R£   RA   Rt   Ru   RÑ   R‹   Rü   R)  RÒ   RÓ   Rj   Rk   R*  R+  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRB   _  sH    -				





c         O  s¨   |  j  ƒ  s d  S| j ƒ  } |  j | | ƒ } |  j | ƒ j \ } } } }	 | j ƒ  }
 |  j |
 ƒ |
 j |  j ƒ  ƒ | j	 |
 t
 | ƒ t
 | ƒ | ƒ |
 j ƒ  d  S(   N(   RÃ   RÎ   RB   Rf  R•   RÈ   t   _set_gc_clipR=   RÍ   R¢   R   RÏ   (   R    R£   RÐ   R8   t	   image_magRt   RÑ   R‹   Rü   R)  R¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRÔ   ˜  s    "N(   Rþ   Rÿ   RU  R'   RW   R-  R$   Rf  RÜ   R<   RB   R   RÔ   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRa    s   !		9c   	      C  s>  d „  } i t  j d 6} | d k r¥ t j |  ƒ r_ t j j |  ƒ \ } } | j ƒ  d } q« t	 |  d ƒ rœ t j j |  j
 ƒ \ } } | j ƒ  d } q« d } n | } | | j ƒ  k rò | |  ƒ } | d k rî t d | j ƒ  ƒ ‚ n  | S| | } t j |  ƒ r0t |  d ƒ � } | | ƒ SWd QXn
 | |  ƒ Sd S(   s  
    Read an image from a file into an array.

    *fname* may be a string path or a Python file-like object.  If
    using a file object, it must be opened in binary mode.

    If *format* is provided, will try to read file of that type,
    otherwise the format is deduced from the filename.  If nothing can
    be deduced, PNG is tried.

    Return value is a :class:`numpy.array`.  For grayscale images, the
    return array is MxN.  For RGB images, the return value is MxNx3.
    For RGBA images the return value is MxNx4.

    matplotlib can only read PNGs natively, but if `PIL
    <http://www.pythonware.com/products/pil/>`_ is installed, it will
    use it to load the image and return an array (if possible) which
    can be used with :func:`~matplotlib.pyplot.imshow`.
    c         S  s‰   y d d l  m } Wn t k
 r( d SXt j |  ƒ rl t |  d ƒ �  } | j | ƒ } t | ƒ SWd QXn | j |  ƒ } t | ƒ Sd S(   s-   try to load the image with PIL or return Noneiÿÿÿÿ(   t   Imaget   rbN(   t   PILRi  t   ImportErrorR'   Ré   t   is_string_liket   openRè   (   Rá   Ri  t   fht   image(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   pilread½  s    t   pngi   R^  s\   Only know how to handle extensions: %s; with PIL installed matplotlib can handle more imagesRj  N(   Rß   t   read_pngR'   Ré   Rm  t   ost   patht   splitextRò   Rç   R^  t   iterkeysRô   R  Rn  (	   Rá   t   formatRq  t   handlerst   basenamet   extRt   t   handlert   fd(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   imread¨  s,    		
id   c      
   C  sÈ   d d l  m } d d l m }	 g  | j d | j d f D] }
 |
 t | ƒ ^ q; } |	 d | d | d t ƒ } | | ƒ } | j | d	 | d
 | d | d | ƒ} | j |  d | d | d t	 ƒd S(   s'  
    Save an array as in image file.

    The output formats available depend on the backend being used.

    Arguments:
      *fname*:
        A string containing a path to a filename, or a Python file-like object.
        If *format* is *None* and *fname* is a string, the output
        format is deduced from the extension of the filename.
      *arr*:
        An MxN (luminance), MxNx3 (RGB) or MxNx4 (RGBA) array.
    Keyword arguments:
      *vmin*/*vmax*: [ None | scalar ]
        *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*:
        cmap is a colors.Colormap instance, eg cm.jet.
        If None, default to the rc image.cmap value.
      *format*:
        One of the file extensions supported by the active
        backend.  Most backends support png, pdf, ps, eps and svg.
      *origin*
        [ 'upper' | 'lower' ] Indicates where the [0,0] index of
        the array is in the upper left or lower left corner of
        the axes. Defaults to the rc image.origin value.
      *dpi*
        The DPI to store in the metadata of the file.  This does not affect the
        resolution of the output image.
    iÿÿÿÿ(   t   FigureCanvasAgg(   t   Figurei   i    t   figsizet   dpit   frameonR2   t   vmint   vmaxR(   Rx  t   transparentN(
   t   matplotlib.backends.backend_aggR  t   matplotlib.figureR€  R;   Rì   RW   t   figimaget   savefigR-  (   Rá   t   arrR„  R…  R2   Rx  R(   R‚  t   FigureCanvasR€  Ru   R�  RZ  t   canvasRt   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   imsaveí  s    "7'c         C  s†  t  j d „ } |  j d k r' |  } n/|  j d k ri |  } | | ƒ } | j d | j d f | _ | S|  j d k r® |  } | | ƒ } | j d | j d d f | _ | S|  j j d	 ƒ r#|  } | j j d
 ƒ rê | | d ƒ } n | | d ƒ } | j d | j d f | _ | j d ƒ Sy |  j d ƒ } Wn t	 k
 rUt
 d ƒ ‚ n X| | ƒ } | j d | j d d f | _ | S(   sÉ   
    Load a PIL image and return it as a numpy array.  For grayscale
    images, the return array is MxN.  For RGB images, the return value
    is MxNx3.  For RGBA images the return value is MxNx4
    c         S  s+   |  j  d |  j ƒ } t j | | ƒ } | S(   s   Teturn a 1D array of dtype.t   raw(   t   tostringt   modeRR   t
   fromstring(   Rt   RQ   t   x_strRu   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   toarray  s    t   RGBAt   RGBXt   Li   i    t   RGBi   s   I;16RC  s   >u2s   <u2s   =u2s   Unknown image modei   (   R•  R–  (   RR   RS   R‘  RQ  R;   t
   startswitht   endswithR\   t   convertRô   R:   (   t   pilImageR”  Rt   Ru   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyRè     s6    	  gš™™™™™¹?R   c      
   C  sß  t  j j |  ƒ \ } } t  j j | ƒ \ } } t |  ƒ }	 |	 j \ }
 } } d } t |
 ƒ | | } t | ƒ | | } | j ƒ  } | r¾ d d l j	 } | j
 d | | f d | ƒ } n  | d k rÝ d d l m } nJ | d k rü d d	 l m } n+ | d
 k rd d l m } n t d ƒ ‚ d d l m } | d | | f d | ƒ } | | ƒ } | j d d d d g d d d t d g  d g  ƒ} t  j j | ƒ \ } } | j |	 d d d t d d ƒ| j | d | ƒ| S(   sÂ  
    make a thumbnail of image in *infile* with output filename
    *thumbfile*.

      *infile* the image file -- must be PNG or PIL readable if you
         have `PIL <http://www.pythonware.com/products/pil/>`_ installed

      *thumbfile*
        the thumbnail filename

      *scale*
        the scale factor for the thumbnail

      *interpolation*
        the interpolation scheme used in the resampling


      *preview*
        if True, the default backend (presumably a user interface
        backend) will be used which will cause a figure to be raised
        if :func:`~matplotlib.pyplot.show` is called.  If it is False,
        a pure image backend will be used depending on the extension,
        'png'->FigureCanvasAgg, 'pdf'->FigureCanvasPdf,
        'svg'->FigureCanvasSVG


    See examples/misc/image_thumbnail.py.

    .. htmlonly::

        :ref:`misc-image_thumbnail`

    Return value is the figure instance containing the thumbnail

    id   iÿÿÿÿNR�  R‚  s   .png(   R  s   .pdf(   t   FigureCanvasPdfs   .svg(   t   FigureCanvasSVGs0   Can only handle extensions 'png', 'svg' or 'pdf'(   R€  i    i   t   aspectR/  Rƒ  t   xtickst   yticksR7   R4   R   (   Rt  Ru  t   splitRv  R~  R;   Rì   Rò   t   matplotlib.pyplott   pyplotRW  R‡  R  t   matplotlib.backends.backend_pdfR�  t   matplotlib.backends.backend_svgRž  Rô   Rˆ  R€  t   add_axesRW   t   imshowR-  RŠ  (   t   infilet	   thumbfilet   scaleR4   t   previewt   basedirRz  t   baseoutt   extoutRt   Rã   Rä   t   depthR‚  RF   RE   t	   extensiont   pltRZ  RŒ  R€  R�  R1   R{  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt	   thumbnailH  s6    %!(/   RU  t
   __future__R    R   Rt  RÆ   t   matht   numpyRR   R   t
   matplotlibR   t   matplotlib.artistt   artistR"   R   t   matplotlib.colorst   colorsR™   t   matplotlib.cmR%   t   matplotlib.cbookRé   t   matplotlib._imageRU   t   matplotlib._pngRß   t   matplotlib.transformsR   R   R   t
   transformsRw   R#   R&   R	   R  R8  RK  RV  Ra  R'   R~  RŽ  Rè   RW   R³  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/image.pyt   <module>   s<   
ÿ î˜}s“E+	/