enthought / enthought/mayavi

plot3d crashes on floats with many decimal places

Open
#119 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

mayavi 4.1.0 on Debian wheezy amd64

When I call plot3d with 6 floats that have many decimal places, mayavi crashes with "TypeError: argument 1: value is "

These values produce the crash for me:

```
xs = [-8.3747958651808272, -8.1719663022434617]
ys = [107.00242750501148, 103.32517068758831]
zs = [39.928090191498192, 41.552475382193073]
```

If I round them to fewer decimal places, everything works fine:

```
xs = [ round(a * 1e5) / 1e5 for a in xs ]
ys = [ round(a * 1e5) / 1e5 for a in ys ]
zs = [ round(a * 1e5) / 1e5 for a in zs ]
```

Traceback:

```
$ python
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mayavi import mlab
>>> xs = [-8.3747958651808272, -8.1719663022434617]
>>> ys = [107.00242750501148, 103.32517068758831]
>>> zs = [39.928090191498192, 41.552475382193073]
>>> mlab.plot3d(xs, ys, zs)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/mayavi/tools/helper_functions.py", line 34, in the_function
return pipeline(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mayavi/tools/helper_functions.py", line 79, in __call__
output = self.__call_internal__(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mayavi/tools/helper_functions.py", line 536, in __call_internal__
self.source = self._source_function(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mayavi/tools/sources.py", line 1171, in line_source
data_source.reset(x=x, y=y, z=z, scalars=s)
File "/usr/lib/python2.7/dist-packages/mayavi/tools/sources.py", line 508, in reset
pd.set(points=points)
File "/usr/lib/python2.7/dist-packages/traits/has_traits.py", line 1952, in trait_set
setattr( self, name, value )
File "/usr/lib/python2.7/dist-packages/tvtk/tvtk_classes.zip/tvtk_classes/point_set.py", line 41, in _set_points
File "/usr/lib/python2.7/dist-packages/tvtk/array_handler.py", line 752, in deref_array
ret.append(convert_array(a, s))
File "/usr/lib/python2.7/dist-packages/tvtk/array_handler.py", line 633, in convert_array
return conv[vtk_typ](arr, vtk_arr)
File "/usr/lib/python2.7/dist-packages/tvtk/array_handler.py", line 569, in array2vtkPoints
vtk_array = array2vtk(arr)
File "/usr/lib/python2.7/dist-packages/tvtk/array_handler.py", line 298, in array2vtk
result_array.SetVoidArray(numpy.getbuffer(z_flat), len(z_flat), 1)
TypeError: argument 1: value is
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.