from PyQt4.QtGui import QApplication
import segyviewlib
qapp = QApplication([])
l = segyviewlib.segyviewwidget.SegyViewWidget(fname)
l.show()
IndexError Traceback (most recent call last)
<ipython-input-9-e587dc28b0c1> in <module>()
2 import segyviewlib
3 qapp = QApplication([])
----> 4 l = segyviewlib.segyviewwidget.SegyViewWidget(fname)
5 l.show()
~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/segyviewwidget.py in __init__(self, filename, show_toolbar, color_maps, width, height, dpi, segyioargs, parent)
19 self._slice_data_source = slice_data_source
20
---> 21 self._context = SliceViewContext(slice_models, slice_data_source)
22 self._context.show_indicators(True)
23
~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/sliceviewcontext.py in __init__(self, slice_models, slice_data_source, colormap, interpolation, image_size, has_data)
77
78 if self._has_data:
---> 79 self._assign_indexes()
80
81 for model in self._available_slice_models:
~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/sliceviewcontext.py in _assign_indexes(self)
242 m.x_indexes = list(self._slice_data_source.indexes_for_direction(m.x_index_direction))
243 m.y_indexes = list(self._slice_data_source.indexes_for_direction(m.y_index_direction))
--> 244 data = self._slice_data_source.read_slice(m.index_direction, m.index)
245 m.data = data
246
~/anaconda/envs/python36/lib/python3.6/site-packages/segyviewlib-1.1.3.dev2+gc4b38be-py3.6.egg/segyviewlib/slicedatasource.py in read_slice(self, direction, index)
114 def read_slice(self, direction, index):
115 if direction == SliceDirection.inline:
--> 116 iline_index = self._source.ilines[index]
117 return self._source.iline[iline_index].T
118 elif direction == SliceDirection.crossline:
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
Since NumPy v1.12, indexing
ndarraywith the wrong type (e.g. a float) raisesIndexError. I think that's what's happening here.The example code:
...results in: