ó
ÄCõRc           @  sL  d  Z  d d l m Z m Z d d l Z d d l Z d d l m Z d d l j	 Z	 e j
 j d ƒ Z e e e d  ƒ \ Z Z e d k o“ e d k Z iŒ d d	 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d  d! 6d" d# 6d$ d% 6d& d' 6d( d) 6d* d+ 6d, d- 6d. d/ 6d d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6dO dP 6dQ dR 6dS dT 6dU dV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d_ d` 6da db 6dc dd 6de df 6dg dh 6di dj 6dk dl 6dm dn 6do dp 6dq dr 6ds dt 6du dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6d d€ 6d� d‚ 6dƒ d„ 6d… d† 6d‡ dˆ 6d‰ dŠ 6d‹ dŒ 6d� dŽ 6d� d� 6d‘ d’ 6d“ d” 6d• d– 6d— d˜ 6d™ dš 6d› dœ 6d� dž 6dŸ d  6d¡ d¢ 6d£ d¤ 6da d¥ 6d¦ d§ 6d¨ d© 6dª d« 6d¬ d­ 6d® d¯ 6d° d± 6d² d³ 6d´ dµ 6d¶ d· 6d¸ d¹ 6dº d» 6d¼ d½ 6d¾ d¿ 6dÀ dÁ 6dÂ dÃ 6dÄ dÅ 6dÆ dÇ 6dÈ dÉ 6dÊ dË 6dÌ dÍ 6dÎ dÏ 6dÐ dÑ 6dÒ dÓ 6dÔ dÕ 6dÖ d× 6dØ dÙ 6dÚ dÛ 6dÜ dÝ 6dÞ dß 6dà dá 6dâ dã 6dä då 6dæ dç 6dè dé 6dê dë 6dì dí 6dî dï 6dð dñ 6dò dó 6dô dõ 6dö d÷ 6dø dù 6dú dû 6dü dý 6dþ dÿ 6d d6dd6dd6dd6dd	6d
d6dd6dd6dd6dd6dd6dd6dd6dd6dd6Z xN e j ƒ  D]@ \ Z Z e j dl ƒ dk r}e j dl dƒ Z e e e <q}q}Wd „  Z d!„  Z e j d"ƒ Z d#„  Z d$e f d%„  ƒ  YZ e ƒ  Z d&d'„ Z  d(e f d)„  ƒ  YZ! d*e! f d+„  ƒ  YZ" d,e! f d-„  ƒ  YZ# d.e f d/„  ƒ  YZ$ d0e$ f d1„  ƒ  YZ% d2e$ f d3„  ƒ  YZ& d4e$ f d5„  ƒ  YZ' d6e$ f d7„  ƒ  YZ( e	 j) d8d9d.d:d;d<d=ƒe$ ƒ Z* e	 j) d8d9d6d:d>d<d=ƒe( ƒ Z+ d?„  Z, d@„  Z- dAe f dB„  ƒ  YZ. dCdD„ Z/ d S(E  sÖ  
A module for converting numbers or color arguments to *RGB* or *RGBA*

*RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the
range 0-1.

This module includes functions and classes for color specification
conversions, and for mapping numbers to colors in a 1-D array of colors called
a colormap. Colormapping typically involves two steps: a data array is first
mapped onto the range 0-1 using an instance of :class:`Normalize` or of a
subclass; then this number in the 0-1 range is mapped to a color using an
instance of a subclass of :class:`Colormap`.  Two are provided here:
:class:`LinearSegmentedColormap`, which is used to generate all the built-in
colormap instances, but is also useful for making custom colormaps, and
:class:`ListedColormap`, which is used for generating a custom colormap from a
list of color specifications.

The module also provides a single instance, *colorConverter*, of the
:class:`ColorConverter` class providing methods for converting single color
specifications or sequences of them to *RGB* or *RGBA*.

Commands which take color arguments can use several formats to specify
the colors.  For the basic built-in colors, you can use a single letter

    - b: blue
    - g: green
    - r: red
    - c: cyan
    - m: magenta
    - y: yellow
    - k: black
    - w: white

Gray shades can be given as a string encoding a float in the 0-1 range, e.g.::

    color = '0.75'

For a greater range of colors, you have two options.  You can specify the
color using an html hex string, as in::

      color = '#eeefff'

or you can pass an *R* , *G* , *B* tuple, where each of *R* , *G* , *B* are in
the range [0,1].

Finally, legal html names for colors, like 'red', 'burlywood' and 'chartreuse'
are supported.
iÿÿÿÿ(   t   print_functiont   divisionN(   t   mat   .i   i   s   #F0F8FFt	   aliceblues   #FAEBD7t   antiquewhites   #00FFFFt   aquas   #7FFFD4t
   aquamarines   #F0FFFFt   azures   #F5F5DCt   beiges   #FFE4C4t   bisques   #000000t   blacks   #FFEBCDt   blanchedalmonds   #0000FFt   blues   #8A2BE2t
   blueviolets   #A52A2At   browns   #DEB887t	   burlywoods   #5F9EA0t	   cadetblues   #7FFF00t
   chartreuses   #D2691Et	   chocolates   #FF7F50t   corals   #6495EDt   cornflowerblues   #FFF8DCt   cornsilks   #DC143Ct   crimsont   cyans   #00008Bt   darkblues   #008B8Bt   darkcyans   #B8860Bt   darkgoldenrods   #A9A9A9t   darkgrays   #006400t	   darkgreens   #BDB76Bt	   darkkhakis   #8B008Bt   darkmagentas   #556B2Ft   darkolivegreens   #FF8C00t
   darkoranges   #9932CCt
   darkorchids   #8B0000t   darkreds   #E9967At
   darksalmons   #8FBC8Ft   darkseagreens   #483D8Bt   darkslateblues   #2F4F4Ft   darkslategrays   #00CED1t   darkturquoises   #9400D3t
   darkviolets   #FF1493t   deeppinks   #00BFFFt   deepskyblues   #696969t   dimgrays   #1E90FFt
   dodgerblues   #B22222t	   firebricks   #FFFAF0t   floralwhites   #228B22t   forestgreens   #FF00FFt   fuchsias   #DCDCDCt	   gainsboros   #F8F8FFt
   ghostwhites   #FFD700t   golds   #DAA520t	   goldenrods   #808080t   grays   #008000t   greens   #ADFF2Ft   greenyellows   #F0FFF0t   honeydews   #FF69B4t   hotpinks   #CD5C5Ct	   indianreds   #4B0082t   indigos   #FFFFF0t   ivorys   #F0E68Ct   khakis   #E6E6FAt   lavenders   #FFF0F5t   lavenderblushs   #7CFC00t	   lawngreens   #FFFACDt   lemonchiffons   #ADD8E6t	   lightblues   #F08080t
   lightcorals   #E0FFFFt	   lightcyans   #FAFAD2t   lightgoldenrodyellows   #90EE90t
   lightgreens   #D3D3D3t	   lightgrays   #FFB6C1t	   lightpinks   #FFA07At   lightsalmons   #20B2AAt   lightseagreens   #87CEFAt   lightskyblues   #778899t   lightslategrays   #B0C4DEt   lightsteelblues   #FFFFE0t   lightyellows   #00FF00t   limes   #32CD32t	   limegreens   #FAF0E6t   linent   magentas   #800000t   maroons   #66CDAAt   mediumaquamarines   #0000CDt
   mediumblues   #BA55D3t   mediumorchids   #9370DBt   mediumpurples   #3CB371t   mediumseagreens   #7B68EEt   mediumslateblues   #00FA9At   mediumspringgreens   #48D1CCt   mediumturquoises   #C71585t   mediumvioletreds   #191970t   midnightblues   #F5FFFAt	   mintcreams   #FFE4E1t	   mistyroses   #FFE4B5t   moccasins   #FFDEADt   navajowhites   #000080t   navys   #FDF5E6t   oldlaces   #808000t   olives   #6B8E23t	   olivedrabs   #FFA500t   oranges   #FF4500t	   orangereds   #DA70D6t   orchids   #EEE8AAt   palegoldenrods   #98FB98t	   palegreens   #AFEEEEt   paleturquoises   #DB7093t   palevioletreds   #FFEFD5t
   papayawhips   #FFDAB9t	   peachpuffs   #CD853Ft   perus   #FFC0CBt   pinks   #DDA0DDt   plums   #B0E0E6t
   powderblues   #800080t   purples   #FF0000t   reds   #BC8F8Ft	   rosybrowns   #4169E1t	   royalblues   #8B4513t   saddlebrowns   #FA8072t   salmons   #FAA460t
   sandybrowns   #2E8B57t   seagreens   #FFF5EEt   seashells   #A0522Dt   siennas   #C0C0C0t   silvers   #87CEEBt   skyblues   #6A5ACDt	   slateblues   #708090t	   slategrays   #FFFAFAt   snows   #00FF7Ft   springgreens   #4682B4t	   steelblues   #D2B48Ct   tans   #008080t   teals   #D8BFD8t   thistles   #FF6347t   tomatos   #40E0D0t	   turquoises   #EE82EEt   violets   #F5DEB3t   wheats   #FFFFFFt   whites   #F5F5F5t
   whitesmokes   #FFFF00t   yellows   #9ACD32t   yellowgreeni    t   greyc         C  s.   y t  j |  ƒ t SWn t k
 r) t SXd S(   s.   Return *True* if *c* can be converted to *RGB*N(   t   colorConvertert   to_rgbt   Truet
   ValueErrort   False(   t   c(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   is_color_likeÒ   s
    c         C  s2   d t  g  |  d  D] } t j | d ƒ ^ q ƒ S(   sB   Given an rgb or rgba sequence of 0-1 floats, return the hex strings   #%02x%02x%02xi   iÿ   (   t   tuplet   npt   round(   t   rgbt   val(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   rgb2hexÛ   s    s   \A#[a-fA-F0-9]{6}\Zc         C  sŽ   t  |  t ƒ s t d ƒ ‚ n  t j |  ƒ d	 k rF t d |  ƒ ‚ n  t g  |  d d !|  d d !|  d d !f D] } t | d ƒ d ^ qn ƒ S(
   s|   
    Take a hex string *s* and return the corresponding rgb 3-tuple
    Example: #efefef -> (0.93725, 0.93725, 0.93725)
    s$   hex2color requires a string arguments   invalid hex color string "%s"i   i   i   i   i   g     ào@N(	   t
   isinstancet
   basestringt	   TypeErrort   hexColorPatternt   matcht   NoneR”   R˜   t   int(   t   st   n(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt	   hex2colorâ   s
    t   ColorConverterc           B  ss   e  Z d  Z i d d 6d d 6d d 6d d 6d d
 6d d 6d d 6d d 6Z i  Z d „  Z d d „ Z d d „ Z RS(   s  
    Provides methods for converting color specifications to *RGB* or *RGBA*

    Caching is used for more efficient conversion upon repeated calls
    with the same argument.

    Ordinarily only the single instance instantiated in this module,
    *colorConverter*, is needed.
    g        g      ð?t   bg      à?t   gt   rg      è?R–   i    t   mt   yt   kt   wc         C  sD  y |  j  | SWny t k
 r" ni t k
 rŠ t | ƒ } y |  j  | SWq‹ t k
 r] q‹ t k
 r† t d t | ƒ f ƒ ‚ q‹ Xn Xyzt j | ƒ rF| j ƒ  } |  j	 j
 | d ƒ } | d k r÷t j
 | | ƒ } | j d ƒ rú t | ƒ } qCt | ƒ } | d k  s| d k r-t d ƒ ‚ n  t | g d ƒ } q÷n± t j | ƒ rët | ƒ d k syt | ƒ d k  r’t d t | ƒ ƒ ‚ n  t | d  ƒ } g  | D]* } t | ƒ d k  sÍ| d k r©| ^ q©r÷t d	 ƒ ‚ q÷n t d
 ƒ ‚ | |  j  | <Wn8 t t t f k
 r?} t d t | ƒ | f ƒ ‚ n X| S(   s²  
        Returns an *RGB* tuple of three floats from 0-1.

        *arg* can be an *RGB* or *RGBA* sequence or a string in any of
        several forms:

            1) a letter from the set 'rgbcmykw'
            2) a hex color string, like '#00FFFF'
            3) a standard name, like 'aqua'
            4) a float, like '0.4', indicating gray on a 0-1 scale

        if *arg* is *RGBA*, the *A* will simply be discarded.
        s2   to_rgb: arg "%s" is unhashable even inside a tuplet   #i    i   s"   gray (string) must be in range 0-1i   i   s%   sequence length is %d; must be 3 or 4s(   number in rbg sequence outside 0-1 ranges'   cannot convert argument to rgb sequences   to_rgb: Invalid rgb arg "%s"
%sN(   t   cachet   KeyErrorR    R˜   R”   t   strt   cbookt   is_string_liket   lowert   colorst   getR£   t   cnamest
   startswithR§   t   floatt   iterablet   len(   t   selft   argt   arglt   colort   str1t   flt   xt   exc(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR’     sT    $7	c         C  sà  y | j  ƒ  d k r d SWn t k
 r- n Xyvt j | ƒ rft j | ƒ rft | ƒ d k rg  | D]* } t | ƒ d k  s� | d k ri | ^ qi r¨ t d ƒ ‚ n  | d k r¾ t	 | ƒ S| d k  sÖ | d k rå t d ƒ ‚ n  | d | d | d	 | f S| d
  \ } } } g  | | | f D]* } t | ƒ d k  sH| d k r$| ^ q$r~t d ƒ ‚ q~n |  j
 | ƒ \ } } } | d k r“d } n  | | | | f SWn5 t t f k
 rÛ} t d t | ƒ | f ƒ ‚ n Xd S(   sU  
        Returns an *RGBA* tuple of four floats from 0-1.

        For acceptable values of *arg*, see :meth:`to_rgb`.
        In addition, if *arg* is "none" (case-insensitive),
        then (0,0,0,0) will be returned.
        If *arg* is an *RGBA* sequence and *alpha* is not *None*,
        *alpha* will replace the original *A*.
        t   noneg        i   i    i   s)   number in rbga sequence outside 0-1 rangeg      ð?s   alpha must be in range 0-1i   i   s(   number in rbg sequence outside 0-1 ranges!   to_rgba: Invalid rgba arg "%s"
%sN(   g        g        g        g        (   R¶   t   AttributeErrorR´   Rµ   R¼   R½   R»   R”   R£   R˜   R’   R    R³   (   R¾   R¿   t   alphaRÄ   R«   Rª   R©   RÅ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   to_rgbaF  s6    
7
@	c         C  s6  y t  | ƒ } Wn' t k
 r9 t d t | ƒ ƒ ‚ n Xy8 | d k s[ | j ƒ  d k rq t j d d t j ƒSWn t k
 r… n Xy) t j	 |  j
 | | ƒ g d t j ƒSWn€t k
 r1t | t j ƒ rÜ| j d k r| j j d k rt d ƒ ‚ n  | j d k rÜ| j d	 d k rÜ| j j d
 k rÜ| j ƒ  d	 k j ƒ  se| j ƒ  d k  j ƒ  rtt d ƒ ‚ n  t j | t j ƒ } | d k	 rÕ| d	 k s­| d k  r¼t d ƒ ‚ n  | | d d … d f <n  | Sn  t j | d f d t j ƒ} x0 t | ƒ D]" \ } } |  j
 | | ƒ | | <qW| SXd S(   s  
        Returns a numpy array of *RGBA* tuples.

        Accepts a single mpl color spec or a sequence of specs.

        Special case to handle "no color": if *c* is "none" (case-insensitive),
        then an empty array will be returned.  Same for an empty list.
        s-   Cannot convert argument type %s to rgba arrayi    RÆ   i   t   dtypei   t   SUs#   Color array must be two-dimensionali   t   fs,   number in rgba sequence is outside 0-1 ranges   alpha must be in 0-1 rangeNi   (   i    i   (   R½   R    R”   t   typeR¶   R™   t   zerosR»   RÇ   t   arrayRÉ   Rž   t   ndarrayt   ndimRÊ   t   kindt   shapet   ravelt   anyt   asarrayR£   t	   enumerate(   R¾   R–   RÈ   t   nct   resultt   it   cc(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   to_rgba_arrayo  s<    	)!40(   g        g        g      ð?(   g        g      à?g        (   g      ð?g        g        (   g        g      è?g      è?(   g      è?i    g      è?(   g      è?g      è?i    (   g        g        g        (   g      ð?g      ð?g      ð?N(	   t   __name__t
   __module__t   __doc__R·   R±   R’   R£   RÉ   RÜ   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR¨   î   s   	
	B)g      ð?c         C  s<  t  | ƒ rV t j d d |  ƒ | } t j t j | | ƒ d t j ƒd d ƒ } | Sy t j | ƒ } Wn t d ƒ ‚ n X| j } t | ƒ d k r¹ | d d k r¹ t	 d ƒ ‚ n  | d d … d f } | d d … d f } | d d … d f }	 | d d	 k s| d
 d k r*t	 d ƒ ‚ n  t j
 t j | ƒ | ƒ rUt	 d ƒ ‚ n  | |  d } t j |  f t j ƒ } |  d t j d d |  ƒ | } t j | | ƒ d d
 !}
 | d d
 !| |
 d | |
 | |
 d | |
 |	 |
 d |	 |
 d | d d
 +|	 d | d <| d
 | d
 <t j | d	 d ƒ | S(   sª  Create an *N* -element 1-d lookup table

    *data* represented by a list of x,y0,y1 mapping correspondences.
    Each element in this list represents how a value between 0 and 1
    (inclusive) represented by x is mapped to a corresponding value
    between 0 and 1 (inclusive). The two values of y are to allow
    for discontinuous mapping functions (say as might be found in a
    sawtooth) where y0 represents the value of y for values of x
    <= to that given, and y1 is the value to be used for x > than
    that given). The list must start with x=0, end with x=1, and
    all values of x must be in increasing order. Values between
    the given mapping points are determined by simple linear interpolation.

    Alternatively, data can be a function mapping values between 0 - 1
    to 0 - 1.

    The function returns an array "result" where ``result[x*(N-1)]``
    gives the closest value for values of x between 0 and 1.
    i    i   RÊ   s$   data must be convertable to an arrayi   i   s   data must be nx3 formatNg        iÿÿÿÿg      ð?s9   data mapping points must start with x=0. and end with x=1s3   data mapping points must have x in increasing order(   t   callableR™   t   linspacet   clipRÏ   R»   R    RÓ   R½   R”   t   sometruet   sortRÎ   t   searchsorted(   t   Nt   datat   gammat   xindt   lutt   adataRÓ   RÄ   t   y0t   y1t   ind(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   makeMappingArray¢  s<    -	" !**t   Colormapc           B  sq   e  Z d  Z d d „ Z d e d „ Z d d d „ Z d d d „ Z d d d „ Z	 d „  Z
 d	 „  Z d
 „  Z RS(   sÛ  
    Baseclass for all scalar to RGBA mappings.

    Typically Colormap instances are used to convert data values (floats) from
    the interval ``[0, 1]`` to the RGBA color that the respective Colormap
    represents. For scaling of data into the ``[0, 1]`` interval see
    :class:`matplotlib.colors.Normalize`. It is worth noting that
    :class:`matplotlib.cm.ScalarMappable` subclasses make heavy use of this
    ``data->normalize->map-to-color`` processing chain.

    i   c         C  sf   | |  _  | |  _ d |  _ d |  _ d |  _ | |  _ | d |  _ | d |  _ t	 |  _
 t	 |  _ d S(   s¬   
        Parameters
        ----------
        name : str
            The name of the colormap.
        N : int
            The number of rgb quantization levels.

        g        i   i   N(   g        g        g        g        (   t   nameRæ   t	   _rgba_badR£   t   _rgba_undert
   _rgba_overt   _i_undert   _i_overt   _i_badR•   t   _isinitt   colorbar_extend(   R¾   Rñ   Ræ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   __init__ë  s    
							c         C  s%  |  j  s |  j ƒ  n  d } t j | ƒ sF d } t j | g ƒ } n3 d } t j | d t ƒ} | j	 } | j
 ƒ  } ~ | j j sš | j ƒ  j ƒ  } n  | j j d k rgt j d d g d | j ƒ} t j | Œ  }	 t j | | d k |	 ƒ | |  j 9} t r$t j | d	 |  j d
 | ƒn t j | d	 |  j ƒ } t j | | d k  d	 ƒ | j t ƒ } n  t j | | |  j d k |  j ƒ t j | | d k  |  j ƒ | d k	 rù| j | j k rÝt j | | |  j ƒ qù| rù| j |  j ƒ qùn  | r|  j d j t j ƒ }
 n |  j j ƒ  }
 | d k	 rµt | d ƒ } t  | d ƒ } | rmt | d ƒ } n  |
 d	 d k j! ƒ  rœ| |
 d d	 … d	 f <qµ| |
 d d … d	 f <n  t j" d | j d d |
 j ƒ } |
 j# | d d d d d
 | ƒ| d k r!t$ | d d d … f ƒ } n  | S(   sm  
        Parameters
        ----------
        X : scalar, ndarray
            The data value(s) to convert to RGBA.
            For floats, X should be in the interval ``[0.0, 1.0]`` to
            return the RGBA values ``X*100`` percent along the Colormap line.
            For integers, X should be in the interval ``[0, Colormap.N)`` to
            return RGBA values *indexed* from the Colormap with index ``X``.
        alpha : float, None
            Alpha must be a scalar between 0 and 1, or None.
        bytes : bool
            If False (default), the returned RGBA values will be floats in the
            interval ``[0, 1]`` otherwise they will be uint8s in the interval
            ``[0, 255]``.

        Returns
        -------
        Tuple of RGBA values if X is scalar, othewise an array of
        RGBA values with a shape of ``X.shape + (4, )``.

        t   scalarRÏ   t   copyRÌ   i   i    RÊ   g      ð?iÿÿÿÿt   outg        iÿ   NRÓ   i   t   axist   modeRâ   (   i   (%   Rø   t   _initR£   R´   R¼   R™   RÏ   R   R“   t   maskt   filledRÊ   t   isnativet   byteswapt   newbyteorderRÒ   t	   nextaftert   _putmaskRæ   t   NP_CLIP_OUTRâ   t   astypeR¤   Rö   Rõ   RÓ   R÷   t   fillt   _lutt   uint8Rü   t   mint   maxt   allt   emptyt   takeR˜   (   R¾   t   XRÈ   t   bytest   mask_badt   vtypet   xat   xmat   valst
   almost_oneRê   t   rgba(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   __call__  s\    		#"R®   c         C  s/   t  j | | ƒ |  _ |  j r+ |  j ƒ  n  d S(   s0   Set color to be used for masked values.
        N(   R‘   RÉ   Rò   Rø   t   _set_extremes(   R¾   RÁ   RÈ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   set_badh  s    	c         C  s/   t  j | | ƒ |  _ |  j r+ |  j ƒ  n  d S(   s`   Set color to be used for low out-of-range values.
           Requires norm.clip = False
        N(   R‘   RÉ   Ró   Rø   R  (   R¾   RÁ   RÈ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt	   set_undero  s    	c         C  s/   t  j | | ƒ |  _ |  j r+ |  j ƒ  n  d S(   sa   Set color to be used for high out-of-range values.
           Requires norm.clip = False
        N(   R‘   RÉ   Rô   Rø   R  (   R¾   RÁ   RÈ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   set_overw  s    	c         C  sŠ   |  j  r |  j  |  j |  j <n |  j d |  j |  j <|  j rU |  j |  j |  j <n |  j |  j d |  j |  j <|  j |  j |  j <d  S(   Ni    i   (   Ró   R  Rõ   Rô   Rö   Ræ   Rò   R÷   (   R¾   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR    s    		c         C  s   t  d ƒ ‚ d S(   s$   Generate the lookup table, self._luts   Abstract class onlyN(   t   NotImplementedError(   R¾   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR   Š  s    c         C  sŠ   |  j  s |  j ƒ  n  t j |  j d  d  … d f |  j d  d  … d f k ƒ o‰ t j |  j d  d  … d f |  j d  d  … d f k ƒ S(   Ni    i   i   (   Rø   R   R™   t   alltrueR  (   R¾   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   is_grayŽ  s    	;N(   RÝ   RÞ   Rß   Rú   R£   R•   R  R  R  R  R  R   R"  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRð   ß  s   c		t   LinearSegmentedColormapc           B  sD   e  Z d  Z d d d „ Z d „  Z d „  Z e d d d „ ƒ Z RS(   sÚ   Colormap objects based on lookup tables using linear segments.

    The lookup table is generated using linear interpolation for each
    primary color, with the 0-1 domain divided into any number of
    segments.
    i   g      ð?c         C  s2   t  |  _ t j |  | | ƒ | |  _ | |  _ d S(   s  Create color map from linear mapping segments

        segmentdata argument is a dictionary with a red, green and blue
        entries. Each entry should be a list of *x*, *y0*, *y1* tuples,
        forming rows in a table. Entries for alpha are optional.

        Example: suppose you want red to increase from 0 to 1 over
        the bottom half, green to do the same over the middle half,
        and blue over the top half.  Then you would use::

            cdict = {'red':   [(0.0,  0.0, 0.0),
                               (0.5,  1.0, 1.0),
                               (1.0,  1.0, 1.0)],

                     'green': [(0.0,  0.0, 0.0),
                               (0.25, 0.0, 0.0),
                               (0.75, 1.0, 1.0),
                               (1.0,  1.0, 1.0)],

                     'blue':  [(0.0,  0.0, 0.0),
                               (0.5,  0.0, 0.0),
                               (1.0,  1.0, 1.0)]}

        Each row in the table for a given color is a sequence of
        *x*, *y0*, *y1* tuples.  In each sequence, *x* must increase
        monotonically from 0 to 1.  For any input value *z* falling
        between *x[i]* and *x[i+1]*, the output value of a given color
        will be linearly interpolated between *y1[i]* and *y0[i+1]*::

            row i:   x  y0  y1
                           /
                          /
            row i+1: x  y0  y1

        Hence y0 in the first row and y1 in the last row are never used.


        .. seealso::

               :meth:`LinearSegmentedColormap.from_list`
               Static method; factory function for generating a
               smoothly-varying LinearSegmentedColormap.

               :func:`makeMappingArray`
               For information about making a mapping array.
        N(   R•   t
   monochromeRð   Rú   t   _segmentdatat   _gamma(   R¾   Rñ   t   segmentdataRæ   Rè   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRú   œ  s    0		c         C  s  t  j |  j d d f t  j ƒ |  _ t |  j |  j d |  j ƒ |  j d  d … d f <t |  j |  j d |  j ƒ |  j d  d … d f <t |  j |  j d |  j ƒ |  j d  d … d	 f <d
 |  j k rü t |  j |  j d
 d ƒ |  j d  d … d f <n  t |  _	 |  j
 ƒ  d  S(   Ni   i   Ru   iýÿÿÿi    R7   i   R   i   RÈ   (   R™   t   onesRæ   R»   R  Rï   R%  R&  R“   Rø   R  (   R¾   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR   Ñ  s    %////	c         C  s   | |  _  |  j ƒ  d S(   sA   
        Set a new gamma value and regenerate color map.
        N(   R&  R   (   R¾   Rè   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt	   set_gammaß  s    	c      	   C  sb  t  j | ƒ s t d ƒ ‚ n  t  j | d ƒ rp t | d ƒ d k rp t  j | d ƒ rp t | Œ  \ } } n t j d d t | ƒ ƒ } t d g  d g  d g  d	 g  ƒ } x  t | | ƒ D]� \ } } t	 j
 | ƒ \ } }	 }
 } | d j | | | f ƒ | d j | |	 |	 f ƒ | d j | |
 |
 f ƒ | d	 j | | | f ƒ q¼ Wt |  | | | ƒ S(
   sT  
        Make a linear segmented colormap with *name* from a sequence
        of *colors* which evenly transitions from colors[0] at val=0
        to colors[-1] at val=1.  *N* is the number of rgb quantization
        levels.
        Alternatively, a list of (value, color) tuples can be given
        to divide the range unevenly.
        s   colors must be iterablei    i   g        g      ð?Ru   R7   R   RÈ   (   R´   R¼   R”   R½   Rµ   t   zipR™   Rá   t   dictR‘   RÉ   t   appendR#  (   Rñ   R·   Ræ   Rè   R  t   cdictRœ   RÁ   R«   Rª   R©   t   a(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt	   from_listæ  s    )!(   RÝ   RÞ   Rß   Rú   R   R)  t   staticmethodR/  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR#  •  s   5		t   ListedColormapc           B  s&   e  Z d  Z d d d „ Z d „  Z RS(   sÎ   Colormap object generated from a list of colors.

    This may be most useful when indexing directly into a colormap,
    but it can also be used to generate special colormaps for ordinary
    mapping.
    R/  c         C  s8  | |  _  t |  _ | d k r0 t |  j  ƒ } nñ t j |  j  ƒ ra |  j  g | |  _  t |  _ nÀ t j |  j  ƒ rá t	 |  j  ƒ |  _  t |  j  ƒ d k r¦ t |  _ n  t |  j  ƒ | k  rÔ t	 |  j  ƒ | |  _  n  |  j  | 3n@ y t
 |  j  ƒ } Wn t k
 rn X| g | |  _  t |  _ t j |  | | ƒ d S(   s�  
        Make a colormap from a list of colors.

        *colors*
            a list of matplotlib color specifications,
            or an equivalent Nx3 or Nx4 floating point array
            (*N* rgb or rgba values)
        *name*
            a string to identify the colormap
        *N*
            the number of entries in the map.  The default is *None*,
            in which case there is one colormap entry for each
            element in the list of colors.  If::

                N < len(colors)

            the list will be truncated at *N*.  If::

                N > len(colors)

            the list will be extended by repetition.
        i   N(   R·   R•   R$  R£   R½   R´   Rµ   R“   R¼   t   listR»   R    Rð   Rú   (   R¾   R·   Rñ   Ræ   R6   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRú     s*    			c         C  s[   t  j |  j ƒ } t j |  j d d f t j ƒ |  _ | |  j d *t |  _	 |  j
 ƒ  d  S(   Ni   i   iýÿÿÿ(   R‘   RÜ   R·   R™   RÎ   Ræ   R»   R  R“   Rø   R  (   R¾   R  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR   >  s
    %	N(   RÝ   RÞ   Rß   R£   Rú   R   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR1    s   1t	   Normalizec           B  s_   e  Z d  Z d d e d „ Z e d „  ƒ Z d d „ Z d „  Z	 d „  Z
 d „  Z d „  Z RS(	   s_   
    A class which, when called, can normalize data into
    the ``[0.0, 1.0]`` interval.

    c         C  s   | |  _  | |  _ | |  _ d S(   s£  
        If *vmin* or *vmax* is not given, they are taken from the input's
        minimum and maximum value respectively.  If *clip* is *True* and
        the given value falls outside the range, the returned value
        will be 0 or 1, whichever is closer. Returns 0 if::

            vmin==vmax

        Works with scalars or arrays, including masked arrays.  If
        *clip* is *True*, masked values are set to 1; otherwise they
        remain masked.  Clipping silently defeats the purpose of setting
        the over, under, and masked colors in the colormap, so it is
        likely to lead to surprises; therefore the default is
        *clip* = *False*.
        N(   t   vmint   vmaxRâ   (   R¾   R4  R5  Râ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRú   L  s    		c         C  sÄ   t  j |  ƒ r– t } t j |  ƒ } | j j d k rZ t |  t j	 ƒ r“ | j
 ƒ  } q“ qº | j j d k r� | j t j ƒ } qº | j t j ƒ } n$ t } t j |  g ƒ j t j ƒ } | | f S(   sY  
        Homogenize the input *value* for easy and efficient normalization.

        *value* can be a scalar or sequence.

        Returns *result*, *is_scalar*, where *result* is a
        masked array matching *value*.  Float dtypes are preserved;
        integer types with two bytes or smaller are converted to
        np.float32, and larger types are converted to np.float.
        Preserving float32 when possible, and using in-place operations,
        can greatly improve speed for large arrays.

        Experimental; we may want to add an option to force the
        use of float32.
        RÌ   i   (   R´   R¼   R•   R   RÖ   RÊ   RÒ   Rž   R™   RÐ   Rü   t   itemsizeR	  R»   t   float32R“   RÏ   (   t   valuet	   is_scalarRÙ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   process_value`  s    c   	      C  s:  | d  k r |  j } n  |  j | ƒ \ } } |  j | ƒ |  j |  j } } | | k ri | j d ƒ nº | | k r„ t d ƒ ‚ nŸ t | ƒ } t | ƒ } | rá t	 j
 | ƒ } t	 j t j | j | ƒ | | ƒ d | ƒ} n  | j } | | 8} | | | } t j	 j | d | j d t ƒ} | r6| d } n  | S(   Ni    s/   minvalue must be less than or equal to maxvalueR  Rü   (   R£   Râ   R:  t   autoscale_NoneR4  R5  R
  R”   R»   R   t   getmaskRÏ   R™   R  Rç   R  R•   (	   R¾   R8  Râ   RÙ   R9  R4  R5  R  t   resdat(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR  €  s,    $	
!c         C  s{   |  j  ƒ  s t d ƒ ‚ n  t |  j ƒ } t |  j ƒ } t j | ƒ rg t j | ƒ } | | | | S| | | | Sd  S(   Ns   Not invertible until scaled(	   t   scaledR”   R»   R4  R5  R´   R¼   R   RÖ   (   R¾   R8  R4  R5  Rœ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   inverseœ  s    c         C  s(   t  j | ƒ |  _ t  j | ƒ |  _ d S(   s8   
        Set *vmin*, *vmax* to min, max of *A*.
        N(   R   R  R4  R  R5  (   R¾   t   A(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt	   autoscale¨  s    c         C  sv   |  j  d k r9 t j | ƒ d k r9 t j | ƒ |  _  n  |  j d k rr t j | ƒ d k rr t j | ƒ |  _ n  d S(   s(    autoscale only None-valued vmin or vmaxi    N(   R4  R£   R™   t   sizeR   R  R5  R  (   R¾   R@  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR;  ¯  s    $$c         C  s   |  j  d k	 o |  j d k	 S(   s    return true if vmin and vmax setN(   R4  R£   R5  (   R¾   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR>  ¶  s    N(   RÝ   RÞ   Rß   R£   R•   Rú   R0  R:  R  R?  RA  R;  R>  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR3  F  s    			t   LogNormc           B  s5   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z RS(   sA   
    Normalize a given value to the 0-1 range on a log scale
    c   	      C  sÊ  | d  k r |  j } n  |  j | ƒ \ } } t j | d d t ƒ} |  j | ƒ |  j |  j } } | | k r€ t	 d ƒ ‚ n3| d k r› t	 d ƒ ‚ n| | k r· | j
 d ƒ nü | rü t j | ƒ } t j t j | j | ƒ | | ƒ d | ƒ} n  | j } | j } | t j j k r/| d k } n | | d k O} t j | | d ƒ t j | | ƒ | t j | ƒ 8} | t j | ƒ t j | ƒ } t j j | d | d t ƒ} | rÆ| d } n  | S(   Ni    Rü   s/   minvalue must be less than or equal to maxvalues   values must all be positiveR  i   (   R£   Râ   R:  R   t   masked_less_equalR•   R;  R4  R5  R”   R
  R<  RÏ   R™   R  Rç   R  t   nomaskR´   R  t   log(	   R¾   R8  Râ   RÙ   R9  R4  R5  R  R=  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR  ¿  s:    $		 c         C  s}   |  j  ƒ  s t d ƒ ‚ n  |  j |  j } } t j | ƒ rd t j | ƒ } | t j | | | ƒ S| t	 | | | ƒ Sd  S(   Ns   Not invertible until scaled(
   R>  R”   R4  R5  R´   R¼   R   RÖ   t   powert   pow(   R¾   R8  R4  R5  Rœ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR?  ä  s    c         C  s@   t  j | d d t ƒ} t  j | ƒ |  _ t  j | ƒ |  _ d S(   s8   
        Set *vmin*, *vmax* to min, max of *A*.
        i    Rü   N(   R   RD  R•   R  R4  R  R5  (   R¾   R@  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRA  ï  s    c         C  s†   |  j  d k	 r" |  j d k	 r" d St j | d d t ƒ} |  j  d k r^ t j | ƒ |  _  n  |  j d k r‚ t j | ƒ |  _ n  d S(   s(    autoscale only None-valued vmin or vmaxNi    Rü   (   R4  R£   R5  R   RD  R•   R  R  (   R¾   R@  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR;  ÷  s    N(   RÝ   RÞ   Rß   R£   R  R?  RA  R;  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRC  »  s
   %		t
   SymLogNormc           B  se   e  Z d  Z d d
 d
 e d „ Z d
 d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z RS(   sh  
    The symmetrical logarithmic scale is logarithmic in both the
    positive and negative directions from the origin.

    Since the values close to zero tend toward infinity, there is a
    need to have a range around zero that is linear.  The parameter
    *linthresh* allows the user to specify the size of this range
    (-*linthresh*, *linthresh*).
    g      ð?c         C  s;   t  j |  | | | ƒ | |  _ | d t j d |  _ d S(   sY  
        *linthresh*:
        The range within which the plot is linear (to
        avoid having the plot go to infinity around zero).

        *linscale*:
        This allows the linear range (-*linthresh* to *linthresh*)
        to be stretched relative to the logarithmic range.  Its
        value is the number of decades to use for each half of the
        linear range.  For example, when *linscale* == 1.0 (the
        default), the space used for the positive and negative
        halves of the linear range will be equal to one decade in
        the logarithmic range. Defaults to 1.
        g      ð?iÿÿÿÿN(   R3  Rú   t	   linthreshR™   t   et   _linscale_adj(   R¾   RJ  t   linscaleR4  R5  Râ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRú     s    	c   	      C  s  | d  k r |  j } n  |  j | ƒ \ } } |  j | ƒ |  j |  j } } | | k rh t d ƒ ‚ n” | | k r„ | j d ƒ nx | rÉ t j	 | ƒ } t j
 t j | j | ƒ | | ƒ d | ƒ} n  |  j | j ƒ } | |  j 8} | |  j |  j } | r| d } n  | S(   Ns/   minvalue must be less than or equal to maxvaluei    R  (   R£   Râ   R:  R;  R4  R5  R”   R
  R   R<  RÏ   R™   R  t
   _transformRç   t   _lowert   _upper(	   R¾   R8  Râ   RÙ   R9  R4  R5  R  R=  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR     s&    $c         C  sˆ   t  j | ƒ |  j k } t  j | | ƒ } |  j t  j t  j | | ƒ |  j ƒ } | | |  j 9} | | | <| | c |  j 9<| S(   s)   
        Inplace transformation.
        (   R™   t   absRJ  t   signRL  RF  (   R¾   R.  t   maskedRR  RF  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRN  :  s    *
c         C  sŠ   t  j | ƒ |  j |  j k } t  j | | ƒ } t  j | | | |  j |  j ƒ } | | |  j 9} | | | <| | c |  j <| S(   s1   
        Inverse inplace Transformation.
        (   R™   RQ  RJ  RL  RR  t   exp(   R¾   R.  RS  RR  RT  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   _inv_transformF  s    %
c         C  sG   |  j  |  j } } t j | | g ƒ } |  j | ƒ \ |  _ |  _ d S(   sE   
        Calculates vmin and vmax in the transformed system.
        N(   R4  R5  R™   RÏ   RN  RP  RO  (   R¾   R4  R5  t   arr(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   _transform_vmin_vmaxR  s    c         C  sR   |  j  ƒ  s t d ƒ ‚ n  t j | ƒ } | |  j |  j |  j } |  j | ƒ S(   Ns   Not invertible until scaled(   R>  R”   R   RÖ   RP  RO  RU  (   R¾   R8  Rœ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR?  Z  s
    c         C  s2   t  j | ƒ |  _ t  j | ƒ |  _ |  j ƒ  d S(   s8   
        Set *vmin*, *vmax* to min, max of *A*.
        N(   R   R  R4  R  R5  RW  (   R¾   R@  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRA  a  s    c         C  sw   |  j  d k	 r! |  j d k	 r! n  |  j  d k rE t j | ƒ |  _  n  |  j d k ri t j | ƒ |  _ n  |  j ƒ  d S(   s)    autoscale only None-valued vmin or vmax N(   R4  R£   R5  R   R  R  RW  (   R¾   R@  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR;  i  s    N(   RÝ   RÞ   Rß   R£   R•   Rú   R  RN  RU  RW  R?  RA  R;  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRI    s   						t   BoundaryNormc           B  s/   e  Z d  Z e d „ Z d d „ Z d „  Z RS(   s¬  
    Generate a colormap index based on discrete intervals.

    Unlike :class:`Normalize` or :class:`LogNorm`,
    :class:`BoundaryNorm` maps values to integers instead of to the
    interval 0-1.

    Mapping to the 0-1 interval could have been done via
    piece-wise linear interpolation, but using integers seems
    simpler, and reduces the number of conversions back and forth
    between integer and floating point.
    c         C  s   | |  _  | d |  _ | d |  _ t j | ƒ |  _ t |  j ƒ |  _ | |  _ |  j d |  j k rr t	 |  _
 n	 t |  _
 d S(   sß  
        *boundaries*
            a monotonically increasing sequence
        *ncolors*
            number of colors in the colormap to be used

        If::

            b[i] <= v < b[i+1]

        then v is mapped to color j;
        as i varies from 0 to len(boundaries)-2,
        j goes from 0 to ncolors-1.

        Out-of-range values are mapped to -1 if low and ncolors
        if high; these are converted to valid indices by
        :meth:`Colormap.__call__` .
        i    iÿÿÿÿi   N(   Râ   R4  R5  R™   RÖ   t
   boundariesR½   Ræ   t   NcmapR•   t   _interpR“   (   R¾   RY  t   ncolorsRâ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRú   �  s    		c   
      C  s`  | d  k r |  j } n  t j | ƒ } t j | ƒ } | j |  j d ƒ } | rn t j | |  j |  j ƒ n  t j	 | j
 d t j ƒ} x- t |  j ƒ D] \ } } | | | | k <q™ W|  j rù t |  j d ƒ |  j d } | | j t j ƒ } n  d | | |  j k  <|  j | | |  j k <t j | d | ƒ}	 |	 j
 d k r\| r\t |	 ƒ }	 n  |	 S(   Ni   RÊ   i   iÿÿÿÿR  (    (   R£   Râ   R   RÖ   t   getmaskarrayR  R5  R™   R4  RÎ   RÓ   t   int16R×   RY  R[  R»   RZ  Ræ   R	  RÏ   R¤   (
   R¾   RÄ   Râ   R  t   xxt   iretRÚ   R©   t   scalefact   ret(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR  Ÿ  s&    	c         C  s
   t  d ƒ S(   Ns   BoundaryNorm is not invertible(   R”   (   R¾   R8  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR?  ´  s    N(   RÝ   RÞ   Rß   R•   Rú   R£   R  R?  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRX  t  s   t   NoNormc           B  s#   e  Z d  Z d d „ Z d „  Z RS(   s“   
    Dummy replacement for Normalize, for the case where we
    want to use indices directly in a
    :class:`~matplotlib.cm.ScalarMappable` .
    c         C  s   | S(   N(    (   R¾   R8  Râ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR  ¾  s    c         C  s   | S(   N(    (   R¾   R8  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR?  Á  s    N(   RÝ   RÞ   Rß   R£   R  R?  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRc  ¸  s   s   1.3t   alternativeRñ   t	   normalizet   obj_types   class aliast   no_normc         C  s  t  j |  j d t  j ƒ} |  j d ƒ } | d k } |  j d ƒ } t  j | ƒ } | | | | | | <| d k } |  d d … d d … d f | k | @} |  | d f |  | d f | | | | d f <|  d d … d d … d f | k | @} d |  | d f |  | d f | | | | d f <|  d d … d d … d f | k | @} d |  | d f |  | d f | | | | d f <| d d … d d … d f d	 d
 | d d … d d … d f <| | d d … d d … d f <| | d d … d d … d f <| S(   sq   
    convert rgb values in a numpy array to hsv values
    input and output arrays should have shape (M,N,3)
    RÊ   iÿÿÿÿi    Ni   i   g       @g      @g      @g      ð?(   R™   RÎ   RÓ   R»   R  t   ptpt
   zeros_like(   RV  Rý   t   arr_maxt   ipost   deltaR¥   t   idx(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt
   rgb_to_hsvÍ  s"    )0)4)4@c         C  sÒ  |  d d … d d … d f } |  d d … d d … d f } |  d d … d d … d f } t  j | ƒ } t  j | ƒ } t  j | ƒ } | d j t  j ƒ } | d | } | d | }	 | d | | }
 | d | d | } | d d k } | | | | <| | | | <|	 | | | <| d k } |
 | | | <| | | | <|	 | | | <| d k } |	 | | | <| | | | <| | | | <| d k } |	 | | | <|
 | | | <| | | | <| d	 k } | | | | <|	 | | | <| | | | <| d
 k } | | | | <|	 | | | <|
 | | | <| d k } | | | | <| | | | <| | | | <t  j |  ƒ } | | d d … d d … d f <| | d d … d d … d f <| | d d … d d … d f <| S(   so   
    convert hsv values in a numpy array to rgb values
    both input and output arrays have shape (M,N,3)
    Ni    i   i   g      @g      ð?i   i   i   i   (   R™   t
   empty_likeR	  R¤   (   t   hsvt   hR¥   t   vR«   Rª   R©   RÚ   RÌ   t   pt   qt   tRm  R›   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt
   hsv_to_rgbè  sX    t   LightSourcec           B  s>   e  Z d  Z d d d d d d d „ Z d „  Z d d „ Z RS(	   s9  
    Create a light source coming from the specified azimuth and elevation.
    Angles are in degrees, with the azimuth measured
    clockwise from north and elevation up from the zero plane of the surface.
    The :meth:`shade` is used to produce rgb values for a shaded relief image
    given a data array.
    i;  i-   i    i   c         C  s:   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ d S(   sŒ  
        Specify the azimuth (measured clockwise from south) and altitude
        (measured up from the plane of the surface) of the light source
        in degrees.

        The color of the resulting image will be darkened
        by moving the (s,v) values (in hsv colorspace) toward
        (hsv_min_sat, hsv_min_val) in the shaded regions, or
        lightened by sliding (s,v) toward
        (hsv_max_sat hsv_max_val) in regions that are illuminated.
        The default extremes are chose so that completely shaded points
        are nearly black (s = 1, v = 0) and completely illuminated points
        are nearly white (s = 0, v = 1).
        N(   t   azdegt   altdegt   hsv_min_valt   hsv_max_valt   hsv_min_satt   hsv_max_sat(   R¾   Rx  Ry  Rz  R{  R|  R}  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRú   -  s    					c         C  sh   | | | j  ƒ  | j ƒ  | j  ƒ  ƒ } |  j | d | ƒ} | | d d … d d … d d … f <| S(   sE  
        Take the input data array, convert to HSV values in the
        given colormap, then adjust those color values
        to given the impression of a shaded relief map with a
        specified light source.
        RGBA values are returned, which can then be used to
        plot the shaded image with imshow.
        t	   elevationNi    i   (   R  R  t	   shade_rgb(   R¾   Rç   t   cmapt   rgb0t   rgb1(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   shadeF  s    
*%g      ð?c         C  so  |  j  t j d } |  j t j d } t j | ƒ \ } } d t j t j t j | | ƒ ƒ } t j | | ƒ }	 t j | ƒ t j | ƒ t j	 | ƒ t j	 | ƒ t j	 | |	 d t j ƒ }
 |
 |
 j
 ƒ  |
 j ƒ  |
 j
 ƒ  }
 d |
 d | }
 t | d d … d d … d d … f ƒ } t j t j t j | d d … d d … d f ƒ d	 k |
 d k ƒ d |
 | d d … d d … d f |
 |  j | d d … d d … d f ƒ | d d … d d … d f <t j |
 d k d |
 | d d … d d … d
 f |
 |  j | d d … d d … d
 f ƒ | d d … d d … d
 f <t j t j t j | d d … d d … d f ƒ d	 k |
 d k  ƒ d |
 | d d … d d … d f |
 |  j | d d … d d … d f ƒ | d d … d d … d f <t j |
 d k  d |
 | d d … d d … d
 f |
 |  j | d d … d d … d
 f ƒ | d d … d d … d
 f <t j | d d … d d … d d … f d k  d | d d … d d … d d … f ƒ | d d … d d … d d … f <t j | d d … d d … d d … f d k d | d d … d d … d d … f ƒ | d d … d d … d d … f <t | ƒ S(   sù   
        Take the input RGB array (ny*nx*3) adjust their color values
        to given the impression of a shaded relief map with a
        specified light source using the elevation (ny*nx).
        A new RGB array ((ny*nx*3)) is returned.
        g     €f@g      à?g       @g      ð?Ni    i   i   g»½×Ùß|Û=i   g        (   Rx  R™   t   piRy  t   gradientt   arctant   hypott   arctan2t   sint   cosR  R  Rn  t   wheret   logical_andRQ  R}  R{  R|  Rz  Rv  (   R¾   R›   R~  t   fractiont   azt   altt   dxt   dyt   slopet   aspectt	   intensityRp  (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyR  U  s@    &:+7$;$;7$;$;xx(   RÝ   RÞ   Rß   Rú   Rƒ  R  (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyRw  %  s   		t   neitherc   
      C  s~  d } d } | d k r- d } d } d } n` | d k rH d } d } nE | d k rc d } d } n* | d k rx d } n t d	 j | ƒ ƒ ‚ t |  ƒ d } | | } t | ƒ | k ræ t d
 j | t |  ƒ | t | ƒ ƒ ƒ ‚ n  t | | | !d | ƒ} | d k r| j | d ƒ n | j d ƒ | d k rL| j | d ƒ n | j d ƒ | | _ t |  d | ƒ}	 | |	 f S(   s¶  
    A helper routine to generate a cmap and a norm instance which
    behave similar to contourf's levels and colors arguments.

    Parameters
    ----------
    levels : sequence of numbers
        The quantization levels used to construct the :class:`BoundaryNorm`.
        Values ``v`` are quantizized to level ``i`` if
        ``lev[i] <= v < lev[i+1]``.
    colors : sequence of colors
        The fill color to use for each level. If `extend` is "neither" there
        must be ``n_level - 1`` colors. For an `extend` of "min" or "max" add
        one extra color, and for an `extend` of "both" add two colors.
    extend : {'neither', 'min', 'max', 'both'}, optional
        The behaviour when a value falls out of range of the given levels.
        See :func:`~matplotlib.pyplot.contourf` for details.

    Returns
    -------
    (cmap, norm) : tuple containing a :class:`Colormap` and a                    :class:`Normalize` instance
    i    t   bothi   iÿÿÿÿi   R  R  R•  s"   Unexpected value for extend: {0!r}sQ   With extend == {0!r} and n_levels == {1!r} expected n_colors == {2!r}. Got {3!r}.Ræ   RÆ   R\  N(   s   minR–  (   s   maxR–  (	   R£   R”   t   formatR½   R1  R  R  Rù   RX  (
   t   levelsR·   t   extendt	   colors_i0t	   colors_i1t   extra_colorst   n_data_colorst   n_expected_colorsR€  t   norm(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   from_levels_and_colorsŒ  s>    				
		(0   Rß   t
   __future__R    R   t   ret   numpyR™   R   t   matplotlib.cbookR´   t   __version__t   splitt   partst   mapR¤   t   NP_MAJORt   NP_MINORR  R¹   t   itemsR®   Rr  t   findt   replaceR—   R�   t   compileR¡   R§   t   objectR¨   R‘   Rï   Rð   R#  R1  R3  RC  RI  RX  Rc  t
   deprecatedRe  Rg  Rn  Rv  Rw  R   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/colors.pyt   <module>0   sd  
				±	=¶q@uGrD		=g