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.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to