|
From: John H. <jdh...@ac...> - 2004-12-20 17:07:29
|
>>>>> "John" == John Hunter <jdh...@ac...> writes:
John> I'll spend some time with the profiler looking for some low
John> hanging fruit.
God bless the profiler. It turns out over half of the time to display
this image is spent in the normalizer, which takes image data in an
arbitrary scale and maps into the unit interval
http://matplotlib.sourceforge.net/matplotlib.colors.html#normalize
The normalizer handles a lot of special cases that you may not need.
In fact, your data may already be normalized. So you can write a
custom normalizer
from pylab import *
def mynorm(X): # do nothing, it's already normalized
return X
ion()
rc('figure', figsize=(13,12))
X = rand(1600,1600)
figimage(X, cmap=cm.hot, norm=mynorm)
This change alone gives me more than a 2x speedup. So with GTKAgg + a
custom normalizer (in this case a do nothing normalizer) you'll be
running 4-5 times faster than you were before, me thinks.
peds-pc311:~/python/projects/matplotlib> time python ~/test.py --numarray
1.650u 0.450s 0:02.13 98.5% 0+0k 0+0io 4746pf+0w
I'll keep digging through the profiler...
JDH
|