|
Project Information
Featured
Downloads
Links
|
glumpy is a small python library for the rapid vizualization of numpy arrays, (mainly two dimensional) that has been designed with efficiency in mind. If you want to draw nice figures for inclusion in a scientific article, you’d better use matplotlib. If you want to have a sense of what’s going on in your simulation while it is running, then maybe glumpy can help you. Dependenciesglumpy is made on top of PyOpenGL (http://pyopengl.sourceforge.net/) and since glumpy is dedicated to numpy visualization, you obviously need numpy (http://numpy.scipy.org/). You will also need IPython (http://ipython.scipy.org/) for running interactive sessions where you can interact with glumpy. Some demos require matplotlib (http://matplotlib.sourceforge.net/) and scipy (http://www.scipy.org/) as well but this is optional. Finally, atb demos require the AntTweakBar library available from http://www.antisphere.com/Wiki/tools:anttweakbar. Mailing listsThe main forum for glumpy discussion is the glumpy-users mailing list. You can browse the mailing list online or provide your email address for immediate or digest updates. How does it work ?glumpy uses OpenGL textures to represent arrays since it is probably the fastest method of visualization on modern graphic hardware. However, the drawback is that it implies some restriction on the type and shape of arrays that can be visualized using this method. The dtype of array must be one of numpy.uint8 or numpy.float32 (because on existing restriction on OpenGL textures data types) and the shape of the array must be one of M, MxN or MxNx[1,2,3,4]. Apart from pure rendering performances, OpenGL textures offer the advantage of being able to use shaders that can alter their rendering. glumpy uses such shaders to implement color lookup table (i.e. colormap), filtering (nearest / bilinear / bicubic) and displacements (heightmaps). In other words, rendering is done entirely on the graphic card, saving CPU time for simulation. Example usagedemo-simple.py import numpy, glumpy
fig = glumpy.figure( (512,512) )
Z = numpy.random.random((32,32)).astype(numpy.float32)
image = glumpy.image.Image(Z)
@fig.event
def on_draw():
fig.clear()
image.update()
image.draw( x=0, y=0, z=0, width=fig.width, height=fig.height )
glumpy.show()ScreenshotsDisplaying a large array without any copy in CPU memory:
Multiple view of the same array with different filters:
Histrogram-like display:
Interactive exploration of an image:
Simple mesh viewer:
Primitive GUI for parameters manipulation:
Axis with grid and ticks (using a single shader):
|

