enthought / enthought/mayavi

Retrieving values from vtk arrays does not respect the datatype.

Open
#206 5 comments 0 reactions 1 assignee Claimed by @prabhuramachandran View on GitHub
bug needs investigation
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

The following example demonstrates the problem

``` python
from tvtk.api import tvtk
import numpy

data = tvtk.PointData()
data.add_array(numpy.ones(shape=(10,), dtype=int))
temp = data.get_array(0)
print temp # temp is vtkIntArray
print list(temp) # this prints a list of floats!
print temp._vtk_obj.GetValue(1) # this correctly prints an integer
print temp[1] # this prints a float!
temp[0] = temp[1] # this will fail!
```

The failure has been replicated with VTK 6.2 and mayavi 4.4.2. Previous versions (e.g VTK 5.10 with mayavi 4.4.0) will not fail, probably due to some coercion in the vtk python wrappers, but the upcasting is still there.

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.