|
From: <ef...@us...> - 2008-04-18 08:18:36
|
Revision: 5045
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5045&view=rev
Author: efiring
Date: 2008-04-18 01:18:34 -0700 (Fri, 18 Apr 2008)
Log Message:
-----------
Small speed improvement in color mapping.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-04-16 14:05:00 UTC (rev 5044)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-04-18 08:18:34 UTC (rev 5045)
@@ -446,7 +446,11 @@
lut = (self._lut * 255).astype(npy.uint8)
else:
lut = self._lut
- rgba = lut.take(xa, axis=0) # twice as fast as lut[xa]
+ rgba = npy.empty(shape=xa.shape+(4,), dtype=lut.dtype)
+ lut.take(xa, axis=0, mode='clip', out=rgba)
+ # twice as fast as lut[xa];
+ # using the clip or wrap mode and providing an
+ # output array speeds it up a little more.
if vtype == 'scalar':
rgba = tuple(rgba[0,:])
return rgba
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|