From: <md...@us...> - 2007-08-28 20:28:50
|
Revision: 3748 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3748&view=rev Author: mdboom Date: 2007-08-28 13:28:46 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Improved speed of revcmap -- a startup time offender. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/_cm.py Modified: trunk/matplotlib/lib/matplotlib/_cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/_cm.py 2007-08-28 19:49:53 UTC (rev 3747) +++ trunk/matplotlib/lib/matplotlib/_cm.py 2007-08-28 20:28:46 UTC (rev 3748) @@ -11,6 +11,7 @@ import matplotlib as mpl import matplotlib.colors as colors +from matplotlib.cbook import reversed LUTSIZE = mpl.rcParams['image.lut'] _binary_data = { @@ -5949,13 +5950,9 @@ def revcmap(data): data_r = {} - for key,val in data.iteritems(): - val = list(val) - valrev = val[::-1] - valnew = [] - for a,b,c in valrev: - valnew.append((1.-a,b,c)) - data_r[key]=valnew + for key, val in data.iteritems(): + valnew = [(1.-a, b, c) for a, b, c in reversed(val)] + data_r[key] = valnew return data_r cmapnames = datad.keys() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |