[Python-talk] Mat3d

Petr Kodl petrkodl at gmail.com
Wed Sep 10 18:07:32 EDT 2008


VTK is excellent is your data can be represented as grids (not necessarily
structured grids). Than it really shines both in provided functionality and
performance and it is very hard to compete with.
The Python vs C++ version of the code is typically very similar in length +-
some smart pointer management, but the way VTK is designed the Python is
only used to configure the visualization pipeline, so the interpreter does
not actually run during the visualization at all and there is virtually no
benefit to C vs Python coding.

VTK books are a bit outdated comparing to current site version, but the
online documentation is ok and it comes with lots of short examples and
tests that can be used as guideline - some of the files
are Tcl based and do not have Python equivalent.

If you have some control over the data formatting I would highly recommend
Paraview - it is a OSS viewer application build on top of VTK that allows
you to configure the pipeline via UI. The new version
if build on top of QT/Python and lots of things can be controlled
programatically. It can read standard HPC data formats - some of them are
easy to generate in C code.

Hope this helps,

pk

On Wed, Sep 10, 2008 at 5:52 PM, Labitt, Bruce <labittb1 at tycoelectronics.com
> wrote:

> First post - python noob alert!
>
> I'm looking to generate 3d plots of data that has been crunched by a
> Cell based blade processor.  The code has been written in C and creates
> the data file.  I'd like to render the images on my Scientific Linux 5.2
> work station (RHEL 5.2 clone).  I have an ATI/AMD video card which is
> running the closed source video drivers, because the open 3d drivers for
> my card do not exist yet.  You may have witnessed some of my stupid
> questions on the main gnhlug list.
>
> My first attempt at plotting was to use gnuplot - which is not 3d
> accelerated.  My word - that is slow!  What takes 5 seconds to render on
> my win32 laptop takes tens of minutes to render on gnuplot.  Not a
> satisfactory solution.
>
> Next I looked at vtk - it looks promising.  However, it looks like a
> longer term project.  I could write everything in C, but honestly, I am
> not very good at it.  From what I hear, the vtk books are not too good
> either. However, vtk has python linkages (or what ever you call it.)  So
> it has possibilities.
>
> Quite a while back I went to a PySIG meeting and asked a couple of
> questions about python.  I don't remember anything about the answer, or
> even the question, but I received a favorable impression about python.
>
> I stumbled upon a reference to mat3d.py which is a simple 3d renderer
> for python.  So I dutifully attempted to install most of the
> python/numpy/scipy stuff.  After floundering about I managed to get some
> of the functionality going.
>
> The 3D rendering part seems to work - at least the example files seem to
> render.  When I try to save the file is when I'm getting an error
> message that I'm not sure how to interpret.
>
> Here it is:
>
> Exception in Tkinter callback
> Traceback (most recent call last):
>  File "/usr/lib64/python2.4/lib-tk/Tkinter.py", line 1345, in __call__
>    return self.func(*args)
>  File "/home/me/mypython/mat3d/mat3d.py", line 637, in save
>    self.SaveTo(fileName)
>  File "/home/me/mypython/mat3d/mat3d.py", line 645, in SaveTo
>    data = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
>  File
> "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0b5-py2.4.egg/OpenGL/GL/i
> mages.py", line 323, in glReadPixels
>    ctypes.c_void_p( imageData )
> ArgumentError: argument 3: exceptions.TypeError: wrong type
>
> Any ideas?
>
> Bruce
> _______________________________________________
> Python-talk mailing list
> Python-talk at dlslug.org
> http://dlslug.org/mailman/listinfo/python-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dlslug.org/pipermail/python-talk/attachments/20080910/a4d1cdd0/attachment.html 


More information about the Python-talk mailing list