[SciPy-User] Announcement: Self-contained Python module to write binary VTK files.

Paulo Herrera pauloa.herrera@gmail....
Mon Nov 29 02:45:29 CST 2010


Hello everyone,

This is my first post to this list.

I would like to announce the first release of a Python module I wrote to export
scientific data to binary VTK files. The source code for the module can be
downloaded from its Mercurial repository at bitbucket. To get a copy, type on
terminal window:

hg clone https://pauloh@bitbucket.org/pauloh/pyevtk

PyEVTK (Python Export VTK) package allows exporting data to binary VTK files for
visualization and data analysis with any of the visualization packages that
support VTK files, e.g.  Paraview, VisIt and Mayavi. EVTK does not depend on any
external library (e.g. VTK), so it is easy to install in different systems.

The package is composed of a set of Python files and a small C/Cython library
that provides performance critical routines. PyEVTK provides low and high level
interfaces.  While the low level interface can be used to export data that is
stored in any type of container, the high level functions make easy to export
data stored in Numpy arrays. In addition, it provides a helper class to create
pvd files that can be imported into Paraview to visualize time dependent data
series.

PyEVTK is released under the GPL 3 open source license. A copy of the license is
included in the src directory.

Please see below for an example of how to use the high level routines. More examples
are included in the package.

I hope you will find this package useful and I look forward to getting your feedback.

Paulo

High-level interface example:
=============================

from evtk.hl import imageToVTK
import numpy as np

# Dimensions
nx, ny, nz = 6, 6, 2
ncells = nx * ny * nz
npoints = (nx + 1) * (ny + 1) * (nz + 1)

# Variables
pressure = np.random.rand(ncells).reshape( (nx, ny, nz), order = 'C')
temp = np.random.rand(npoints).reshape( (nx + 1, ny + 1, nz + 1))

imageToVTK("./image", cellData = {"pressure" : pressure}, pointData = {"temp" : temp} )



More information about the SciPy-User mailing list