views:

405

answers:

2

I am required to display a two dimensional numpy.array of int16 at 20fps or so. Using Matplotlib's imshow chokes on anything above 10fps. There obviously are some issues with scaling and interpolation. I should add that the dimensions of the array are not known, but will probably be around thirty by four hundred.

These are data from a sensor that are supposed to have a real-time display, so the data has to be re-sampled on the fly.

+4  A: 

The fastest way to display 30x400 data points is to:

Use OpenGL color arrays

If you can quickly transform your data to what OpenGL understands as color array, you could create a vertex array describing quads, one for each sensor, then update your color array and draw this orthographically on screen.

Use OpenGL textures

If you can quickly transform your datapoints to an opengl texture you can draw one quad with fixed UV coordinates that is bound to this texture.

Use pygame

Pygame has support for conversion of Numpy/Numarray to surfaces, Pygame can then transform such surfaces which involves resampling, after resampling you can blit it on screen.

Misc

pyglet makes dealing with opengl very easy

Florian Bösch
Thanks, but the data needs to be re-sampled, since this is a real-time display of sensor data.
Knut Eldhuset
So I get this right. You have an input of say 10x10 sensor points. You want to scale this up to display on a big screen?
Florian Bösch
More like 30x400 sensor points, but that's the idea, yes.
Knut Eldhuset
So the question isn't how to resample. It's how to create a big display of your 30x400 data points fast.
Florian Bösch
Well, the image needs to be scaled to be more or less squared, but I guess OpenGL could take care of that.
Knut Eldhuset
Yes, you can choose an Orthographic display for opengl.
Florian Bösch
A: 

I second pyglet - it's an excellent choice for images in python

Ilya Kochetov
The link should be to pyglet.org
Vebjorn Ljosa
@Vebjorn Ljosa: thanks, fixed
Ilya Kochetov