PyVTK-0.4.74 (together with numpy, scipy, vtk, and mayavi. I'm trying
to use pyvtk to generate a vtk dataset with the following:
All is well until the last line (writing the file), after which the>from Numeric import *>>import scipy
import scipy.special
x = (arange(50.0)-25)/2.0
y = (arange(50.0)-25)/2.0
r = sqrt(x[:,NewAxis]**2+y**2)
z = 5.0*scipy.speci al.j0(r)
import pyvtk
z1 = reshape(transpo se(z), (-1,))
point_data = pyvtk.PointData (pyvtk.Scalars( z1))
grid = pyvtk.Structure dPoints((50,50, 1), (-12.5, -12.5, 0), (0.5, 0.5, 1))
data = pyvtk.VtkData(g rid, point_data)
data.tofile ('/tmp/test.vtk')
following error occurs:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/pyvtk/__init__.py", line 195,
in tofile
f.write(self.to _string(format) )
File "/usr/lib/python2.4/site-packages/pyvtk/__init__.py", line 177,
in to_string
ret.append(self .point_data.to_ string(format))
File "/usr/lib/python2.4/site-packages/pyvtk/Data.py", line 47, in
to_string
ret += [a.to_string(for mat) for a in self.data]
File "/usr/lib/python2.4/site-packages/pyvtk/Scalars.py", line 40,
in to_string
t = self.get_dataty pe(self.scalars )
File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
r = self.get_dataty pe(o)
File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
r = self.get_dataty pe(o)
File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
r = self.get_dataty pe(o)
File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
<snip<snip<snip <snip>
File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 149,
in get_datatype
r = self.get_dataty pe(o)
File "/usr/lib/python2.4/site-packages/pyvtk/common.py", line 140,
in get_datatype
if is_int(obj): return self.default_in t
RuntimeError: maximum recursion depth exceeded
I'm assuming my pyvtk installation is at issue here (?), but I don't
know enough about python to tell what has gone wrong, or how to fix
it. Can someone point me in the right direction?