enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

Broken support for signed integers in tvtk.TypeInt8Array #1170

Open gzpac opened 1 year ago

gzpac commented 1 year ago

Hello, when I try to store an integer array in tvtk.TypeInt8Array I get an error from tvtk. Running following code ’’’ import numpy as np from tvtk.api import tvtk

gl = np.arange(5, dtype=np.int8) gl_arr = tvtk.TypeInt8Array(name='gray_levels') gl_arr.from_array(gl) ’’’ produces ''' Traceback (most recent call last): File "/home/jakub.jerabek/PycharmProjects/ims_lab/GLA_lab/VTK_visual/combine_stripes/min_uint_problem.py", line 6, in gl_arr.from_array(gl) File "/home/jakub.jerabek/anaconda3/envs/py310/lib/python3.10/site-packages/tvtk/tvtk_classes.zip/tvtk_classes/data_array.py", line 818, in from_array File "/home/jakub.jerabek/anaconda3/envs/py310/lib/python3.10/site-packages/tvtk/array_handler.py", line 340, in array2vtk arr_dtype = get_numeric_array_type(vtk_typecode) File "/home/jakub.jerabek/anaconda3/envs/py310/lib/python3.10/site-packages/tvtk/array_handler.py", line 237, in get_numeric_array_type return get_vtk_to_numeric_typemap()[vtk_array_type] KeyError: 15 ''' Changing the type to TypeUInt8Array removes the error.