Hello all,
I'm creating a python application what does some calculation and
displays the result as two imshow() with respective colorbars as the
calculation progresses. Each array is ~8192x50. Updating the image is
slow, so I only update every 2 seconds or so, but even doing this a
significant part of the program's time is spent on Colormap.__call__ of
colors.py. Another significant time sink is motion_notify_event of
backend_gtk.py. A small example follows to illustrate the problem. Any
ideia on how to circunvent or correct this?
Thank you,
João Luís Silva
----------------------------------------
import numpy as np
from numpy.random import rand
import pygtk
pygtk.require('2.0')
import gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as
FigureCanvas
from matplotlib.figure import Figure
def main():
N = 2000
win = gtk.Window()
vbox = gtk.VBox()
fig = Figure()
ax = fig.add_subplot(111)
canvas = FigureCanvas(fig)
im =
ax.imshow(rand(N,N),origin='lower',aspect='auto',extent=(0.0,1.0,0.0,1.0),interpolation='bilinear')
cb = fig.colorbar(im)
vbox.pack_start(canvas)
win.add(vbox)
win.connect("destroy", lambda x: gtk.main_quit())
win.show_all()
gtk.main()
if __name__ == '__main__':
#Use hotshot2calltree and kcachegrind to see the stats
import hotshot
prof = hotshot.Profile("hotshot_stats")
prof.runcall(main)
prof.close()
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users