-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plot3d crashes on floats with many decimal places #119
Comments
Thanks for the reproducible example. I confirm that this happens for me as well and will take a look when I have some time. The problem also does not occur if you have 3 points, say if you add 1 to the end of each of these lists... |
Confirmed also on OSX in the latest mayavi with VTK 6.3
|
Ok, this is a funny one... The problem is the following: the core issue is the routine array2vtk, where we set the content of our numpy array to the vtk object.
getbuffer is a shorthand for numpy.getbuffer, which returns the raw bytes of the numpy array. Sounds all fine until... until we examine the content for the particular numerical example. See the
Unfortunately, vtk has a different opinion when it comes to that number. If you look in
and the thing crashes. How to solve? It should try to demangle, and if it fails, consider it a pure array (and not a swig array), instead of assuming it is, and fail to match the type. But in any case, it's a VTK bug, it still exists in vtk7, and I will post it in the VTK bug tracker to hear their opinion. From our side, the only possible workarounds are:
both not very appropriate I'd say. I'll try to find a more appropriate one. |
It is logically not possible to workaround this bug on vtk 6.3. The only possible way would be to upgrade to vtk7 and use memoryview exclusively in our code, instead of getbuffer, so that we are guaranteed a format and that format is 'd'. vtk6.3 always interpret it via the buffer protocol no matter what, with the consequence that any data that looks enough like a swig pointer converted as a string will be parsed as such by vtk. @prabhuramachandran do you have any opinion on this? |
Posted in vtk bugtracker as http://www.vtk.org/Bug/view.php?id=16054 |
Fix coming for 7.1, but not merged yet in 6.3 |
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:
If I round them to fewer decimal places, everything works fine:
Traceback:
The text was updated successfully, but these errors were encountered: