Phy Display: Indexing error - index is out of bounds for axis 1
Closed this issue · 3 comments
I have some error in the display of data using phy with one of my data sets that were sorted with KiloSort. While all my other data sets work fie with phy, this particular data has a series of clusters as output that cause an error when I try to manually check the clusters in phy. A few of the clusters are actually displayed with the typical view such as waveform view, amplitude viewer etc. but most of the clusters in the data set are not displayed at all and eventually the program crashes.
I get the following error when clicking on most of the clusters according to the phy log file:
2017-08-15 11:15:38 [D] gui_component:393 Select clusters: 6.
2017-08-15 11:15:41 [D] gui_component:393 Select clusters: 8.
2017-08-15 11:15:41 [E] cli:39 An error has occurred (IndexError): index 4018704 is out of bounds for axis 1 with size 3860071
2017-08-15 11:15:41 [D] cli:42 Traceback (most recent call last):
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\gui\widgets.py", line 196, in _emit_from_js
self.emit(text_type(name), json.loads(text_type(arg_json)))
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\gui\widgets.py", line 115, in emit
return self._event.emit(*args, **kwargs)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\utils\event.py", line 121, in emit
res.append(callback(*args, **kwargs))
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\cluster\manual\gui_component.py", line 334, in on_select
self._emit_select(cluster_ids)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\cluster\manual\gui_component.py", line 395, in _emit_select
self.gui.emit('select', cluster_ids)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\gui\gui.py", line 228, in emit
return self._event.emit(*args, **kwargs)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\utils\event.py", line 121, in emit
res.append(callback(*args, **kwargs))
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\cluster\manual\views.py", line 1220, in on_select
x = self._get_feature(x_dim[i, j], spike_ids, f)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\cluster\manual\views.py", line 1056, in _get_feature
return -1. + (2. / self.duration) * self.spike_times[spike_ids]
IndexError: index 4018704 is out of bounds for axis 1 with size 3860071
Eventually when one selects several clusters after each other the program crashes with the following error:
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\SRL_KiloSort\Miniconda3\envs\phy\Scripts\phy.exe_main.py", line 9, in
sys.exit(phy())
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\click\core.py", line 722, in call
return self.main(*args, **kwargs)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phycontrib\template\gui.py", line 814, in cluster_manual
_run_cmd('_run(params)', ctx, globals(), locals())
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\utils\cli.py", line 76, in run_cmd
return exec(cmd, glob, loc)
File "", line 1, in
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phycontrib\template\gui.py", line 789, in run
run_app()
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\gui\qt.py", line 106, in wrapped
return func(*args, **kwargs)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\gui\qt.py", line 127, in run_app
return QT_APP.exit(QT_APP.exec())
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\app\backends_qt.py", line 631, in paintGL
self._vispy_canvas.events.draw(region=None)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\util\event.py", line 436, in call
self._invoke_callback(cb, event)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\util\event.py", line 452, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\util\event.py", line 448, in _invoke_callback
cb(event)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\plot\base.py", line 300, in on_draw
visual.on_draw()
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\phy\plot\base.py", line 73, in on_draw
self.program.draw(self.gl_primitive_type)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\program.py", line 467, in draw
canvas.context.flush_commands()
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\context.py", line 164, in flush_commands
self.glir.flush(self.shared.parser)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\glir.py", line 158, in flush
parser.parse(self._filter(self.clear(), parser))
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\glir.py", line 401, in parse
self._parse(command)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\glir.py", line 363, in _parse
ob.draw(*args)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\glir.py", line 847, in draw
gl.glDrawArrays(mode, first, count)
File "c:\users\srl_kilosort\miniconda3\envs\phy\lib\site-packages\vispy\gloo\gl_gl2.py", line 415, in glDrawArrays
nativefunc(mode, first, count)
OSError: exception: access violation reading 0x0000000000000000
2017-08-15 11:17:55 [E] logs:326 Invoking <bound method BaseCanvas.on_draw of <FeatureView (PyQt4) at 0x35422b0>> for DrawEvent
Does anybody have a suggestion regarding this error, what might cause it compared to other data sets which are all fine so far. I tried different sorting conditions and don't think that the error comes from the output of KiloSort itself. In case anybody has any tips regarding ways to prevent this error in phy, I would appreciate your feedback.
Hello,
I have the exact same problem. Did you find what caused it?
Thanks!
Hi there,
It looks like there might be some disconnect in what the GUI expects to find versus the information saved in the KiloSort file -- I use the SpikeDetekt/Klusta combo with .kwik files, but I have gotten somewhat familiar with the Klusta Suite in general through my own debugging and customization projects.
Basically, it looks like the GUI is trying to get a data point at a time value that does not exist... so, the question is why the program thinks that there is a data value that is outside of the bounds of the data set...
A couple things to verify and check:
-
It's the same installation/environment of the phy GUI that you're using to view the different KiloSort results that work and don't work, correct? --> This may help to identify whether it's a systemic issue with Phy or if it could be a problem with KiloSort file...
-
When you want to view different data sets using phy, do you also use different folders? --> This may help to determine whether the issue could be from an automatically generated resource file...
this might be due to a corrupted dataset (for example, a truncated raw data file)