From: <ef...@us...> - 2009-07-31 05:22:49
|
Revision: 7312 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7312&view=rev Author: efiring Date: 2009-07-31 05:22:37 +0000 (Fri, 31 Jul 2009) Log Message: ----------- Removed the colormap data caching--it was trying to solve a non-problem. Upon installation, the colormap data in _cm.py is compiled into _cm.pyc, and importing that takes negligible time. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/cm.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-07-31 02:48:18 UTC (rev 7311) +++ trunk/matplotlib/CHANGELOG 2009-07-31 05:22:37 UTC (rev 7312) @@ -1,7 +1,6 @@ 2009-07-30 Add set_cmap and register_cmap, and improve get_cmap, to provide convenient handling of user-generated - colormaps. Reorganized _cm and cm modules, and added - caching of the color data to reduce startup time. - EF + colormaps. Reorganized _cm and cm modules. - EF 2009-07-28 Quiver speed improved, thanks to tip by Ray Speth. -EF Modified: trunk/matplotlib/lib/matplotlib/cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cm.py 2009-07-31 02:48:18 UTC (rev 7311) +++ trunk/matplotlib/lib/matplotlib/cm.py 2009-07-31 05:22:37 UTC (rev 7312) @@ -1,44 +1,20 @@ """ -This module contains the instantiations of color mapping classes +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. + """ + import os -try: - import cPickle as pickle -except ImportError: - import pickle - import numpy as np from numpy import ma import matplotlib as mpl import matplotlib.colors as colors import matplotlib.cbook as cbook +from matplotlib._cm import datad -LUTSIZE = mpl.rcParams['image.lut'] -_cmcache = os.path.join(mpl.get_configdir(), 'colormaps.cache') - -loaded = False -try: - c = open(_cmcache) - datad = pickle.load(c) - c.close() - mpl.verbose.report("Using colormaps from %s" % _cmcache) - loaded = True -except: - mpl.verbose.report("Could not load colormaps from %s" % _cmcache) - -if not loaded: - from matplotlib._cm import datad - - try: - c = open(_cmcache, 'w') - pickle.dump(datad, c, 2) - c.close() - mpl.verbose.report("New colormap cache in %s" % _cmcache) - except: - mpl.verbose.report("Failed to generate colormap cache") - cmap_d = dict() # reverse all the colormaps. @@ -51,7 +27,10 @@ data_r[key] = valnew return data_r +LUTSIZE = mpl.rcParams['image.lut'] + _cmapnames = datad.keys() # need this list because datad is changed in loop + for cmapname in _cmapnames: cmapname_r = cmapname+'_r' cmapdat_r = revcmap(datad[cmapname]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |