• File: cm.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyc
  • Date Modified: 07/22/2015 11:41 PM
  • File size: 10.44 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

)Uc@sdZddlZddlZddlmZddlZddljZddl	j
Z
ddlmZe
ZdZdZejdZejZx
eD]ZedZeeZd	ekreeee<ejeeeee<ejeeeeee<qeeeZeed
dkrfgeD]\ZZdeef^qAZneee<ejjeeeee<ejjeeeee<qWe j!eddddd
Z#dddZ$dddYZ%dS(s
This module provides a large set of colormaps, functions for
registering new colormaps and for getting a colormap by name,
and a mixin class for adding color mapping functionality.

iN(tma(tdatadcsfd}|S(Ncsd|S(Ni((tx(tf(s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt	freverseds((RR((Rs@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt	_reverserscCsi}xt|jD]f\}}t|r:t|}n5gt|D]"\}}}d|||f^qG}|||<qW|S(Ng?(t	iteritemstcallableRtreversed(tdatatdata_rtkeytvaltvalnewRty0ty1((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytrevcmaps5s	image.lutt_rtrediig?cCs|dkr<y
|j}Wq<tk
r8tdq<Xntj|sZtdnt|tjrz|t	|<dS|dkrt
jd}ntj|||}|t	|<dS(s7
    Add a colormap to the set recognized by :func:`get_cmap`.

    It can be used in two ways::

        register_cmap(name='swirly', cmap=swirly_cmap)

        register_cmap(name='choppy', data=choppydata, lut=128)

    In the first case, *cmap* must be a :class:`colors.Colormap`
    instance.  The *name* is optional; if absent, the name will
    be the :attr:`name` attribute of the *cmap*.

    In the second case, the three arguments are passed to
    the :class:`colors.LinearSegmentedColormap` initializer,
    and the resulting colormap is registered.

    s+Arguments must include a name or a ColormapsColormap name must be a stringNs	image.lut(
tNonetnametAttributeErrort
ValueErrortcbooktis_string_liket
isinstancetcolorstColormaptcmap_dtmpltrcParamstLinearSegmentedColormap(RtcmapR	tlut((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt
register_cmapDs


cCs|dkrtjd}nt|tjr2|S|tkr|dkrRt|S|tkrutj|t||St	d|ndS(s
    Get a colormap instance, defaulting to rc values if *name* is None.

    Colormaps added with :func:`register_cmap` take precedence over
    builtin colormaps.

    If *name* is a :class:`colors.Colormap` instance, it will be
    returned.

    If *lut* is not None it must be an integer giving the number of
    entries desired in the lookup table, and *name* must be a
    standard mpl colormap name with a corresponding data dictionary
    in *datad*.
    s
image.cmapsColormap %s is not recognizedN(
RRRRRRRRRR(RR!((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytget_cmapjstScalarMappablecBseZdZdddZdZdedZdZdZ	dZ
dZdddZd	Z
d
ZdZdZd
ZdZdZRS(sn
    This is a mixin class to support scalar -> RGBA mapping.  Handles
    normalization and colormapping
    cCstjd|_|dkr*t}n|dkrEtj}nd|_||_t||_	d|_
itd6|_dS(s
        *norm* is an instance of :class:`colors.Normalize` or one of
        its subclasses, used to map luminance to 0-1. *cmap* is a
        :mod:`cm` colormap instance, for example :data:`cm.jet`
        tchangedtarrayN(schanged(
RtCallbackRegistrytcallbacksSMRR#Rt	Normalizet_AtnormR tcolorbartFalsetupdate_dict(tselfR+R ((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt__init__s			cCs||f|_dS(s8set the colorbar image and axes associated with mappableN(R,(R/timtax((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytset_colorbarscCs|dkrd}n|}y/|jdkrI|jddkr|jtjkrntj|dtj}n|jd \}}tjd||dfd|j}||ddddddf<||dddddf<n(|jddkr|}ntd	|rE|jtjkrE|dj	tj}n|SWnt
k
r]nXtj|}|j
|}|j|d
|d|}|S(sReturn a normalized rgba array corresponding to *x*. If *x*
        is already an rgb array, insert *alpha*; if it is already
        rgba, return it unchanged. If *bytes* is True, return rgba as
        4 uint8s instead of 4 floats.
        g?iiitshapeitdtypeNsthird dimension must be 3 or 4talphatbytes(RtndimR4R5tnptuint8R&temptyRtastypeRRtasarrayR+R (R/RR6R7t_alphatmtntxx((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytto_rgbas0	$%"	
cCs||_t|jd<dS(s(Set the image array from numpy array *A*R&N(R*tTrueR.(R/tA((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt	set_arrays	cCs|jS(sReturn the array(R*(R/((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt	get_arrayscCs|jS(sreturn the colormap(R (R/((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyR#scCs|jj|jjfS(s9return the min, max of the color limits for image scaling(R+tvmintvmax(R/((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytget_climscCs|dk	rH|dkrHtj|rHt|dkrH|\}}n|dk	rc||j_n|dk	r~||j_n|jdS(s
        set the norm limits for image scaling; if *vmin* is a length2
        sequence, interpret it as ``(vmin, vmax)`` which is used to
        support setp

        ACCEPTS: a length 2 sequence of floats
        iN(RRtiterabletlenR+RGRHR%(R/RGRH((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytset_clims!cCs#t|}||_|jdS(sn
        set the colormap for luminance data

        ACCEPTS: a colormap or registered colormap name
        N(R#R R%(R/R ((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytset_cmaps	cCs2|dkrtj}n||_|jdS(sset the normalization instanceN(RRR)R+R%(R/R+((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytset_norms	cCs?|jdkrtdn|jj|j|jdS(sb
        Autoscale the scalar limits on the norm instance using the
        current array
        s%You must first set_array for mappableN(R*Rt	TypeErrorR+t	autoscaleR%(R/((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyRPscCs?|jdkrtdn|jj|j|jdS(s
        Autoscale the scalar limits on the norm instance using the
        current array, changing only limits that are None
        s%You must first set_array for mappableN(R*RROR+tautoscale_NoneR%(R/((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyRQscCst|j|<dS(sz
        Add an entry to a dictionary of boolean flags
        that are set to True when the mappable is changed.
        N(R-R.(R/tchecker((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytadd_checkerscCs"|j|rt|j|<tStS(sf
        If mappable has changed since the last check,
        return True; else return False
        (R.R-RC(R/RR((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pytcheck_updates

cCs8|jjd|x|jD]}t|j|<qWdS(s
        Call this whenever the mappable is changed to notify all the
        callbackSM listeners to the 'changed' signal
        R%N(R(tprocessR.RC(R/R((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyR%sN(t__name__t
__module__t__doc__RR0R3R-RBRERFR#RIRLRMRNRPRQRSRTR%(((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyR$s 	!					
		
			
((&RXtostnumpyR9Rt
matplotlibRtmatplotlib.colorsRtmatplotlib.cbookRtmatplotlib._cmRtdictRRRRtLUTSIZEtkeyst
_cmapnamestcmapnamet
cmapname_rtcmapspecRtlistRtrevspecRKtatbt	from_listtlocalstupdateRR"R#R$(((s@/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/cm.pyt<module>sB			



,
		&