I like to toy with plotting data and related stuff. (I have my own
library in my applications).
Long time ago, I wrote for the fun a small application mimicking
an oscilloscope. It will probably not suit yous needs. The message
is elsewhere, if one fight enough and does not use too heavy external
libs, one mays get very satisfying results.
For example, by using "native" Python types like integers instead of
tuples or lists or wx.Point's, I succeeded to obtain speed gain by a
factor 2 ou 3. Using xrange instead of range has increased the speed
by 30%.
Depending on your acquisition device, eg an ADC returning values in
range 0..512, scaling caluculations can be avoided.
There are plenty of tricks to do.
Of course, everything depends on your speed expectations. A pc is
not a 500MHz transient recorder.
For example, by using "native" Python types like integers instead of
tuples or lists or wx.Point's,
A agree about wx.Points, but how in the world do you avoid some sort of container?
Do you use numpy? It should help. However, at this point, wxPython does not "understand" numpy arrays. If you pass them directly to methods like DC.DrawLines(), it parses them as a generic sequence, which is slower than it needs to be. There are some optimizations for lists of (x,y) tuples, but, this being python, there is still a lot of overhead.
It would not be too hard to write an extension to the wxPython "PointListHelper" that understood the numpy array interface, and might even be able to pass in a pointer to the block of data directly to the Draw** function, eliminated almost all the overhead. However, maybe it takes longer to draw than to parse the data anyway. It certainly does with more complex drawing like polygons, etc.
-Chris
ยทยทยท
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception