Code speedup tips
fperez528 at yahoo.com
Wed Mar 5 23:57:43 CET 2003
Sean Richards wrote:
> I am using a Tkinter PhotoImage to draw the CA. I ran the python
> profiler over the new improved code and it uses ~25% of the processing
> time to draw the picture. So you are right there is a bottle neck in the
> drawing of the picture. Did you come up with a quicker way of displaying
> the array as an image?
The attached code below is an updated version of view.py from the NumTut
tutorial for Numeric. I just sent it to Paul Dubois last week to fix the
existing one, which is badly broken wrt threading behavior.
Since I don't know if this is publically available yet, feel free to use it
in the meantime. It uses .tostring() and goes through a temp file, so I
don't know if it will indeed be any faster than what you are doing already.
But you can tweak it for performance if you need, by trying to use an mmaped
file, for example. If you improve it significantly, don't hesitate to send
your changes to Paul.
You should also look at mayavi. Last week Prabhu added a tool for viewing
arrays as images, which is fantastic (imv.py). Not much faster than this
view.py, but far more flexible and powerful.
And mayavi will blow your socks off for scientific visualization.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Python-list