cortex-lab / phy

phy: interactive visualization and manual spike sorting of large-scale ephys data
BSD 3-Clause "New" or "Revised" License
311 stars 157 forks source link

phy issue: ValueError: data.shape[-1] must be 1 not 2 for a_box_index #1106

Closed noelfederman closed 2 years ago

noelfederman commented 3 years ago

Hi, I was using phy after spike sorting with kilosort and suddenly started to get error and to prevent open phy. This is a copy of appear in command window with --debug option

noel@noel-pc:~$ source activate phy (phy) noel@noel-pc:~$ cd /home/noel/Documents/Spikes/Kilosort/lastSorted/ (phy) noel@noel-pc:~/Documents/Spikes/Kilosort/lastSorted$ phy template-gui params.py --debug QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries. 10:00:09 [D] model:381 Loading spike clusters. 10:00:09 [D] model:396 Loading templates. 10:00:09 [D] model:417 Loading the whitening matrix. 10:00:09 [D] model:421 Loading the inverse of the whitening matrix. 10:00:09 [D] model:101 Loading traces at /home/noel/Documents/Spikes/Kilosort/lastSorted/SmartboxRecording_N53__20191219-164256.dat. 10:00:09 [D] context:67 Initialize joblib cache dir at /home/noel/Documents/Spikes/Kilosort/lastSorted/.phy. 10:00:09 [D] context:148 The file /home/noel/Documents/Spikes/Kilosort/lastSorted/.phy/new_cluster_id.pkl doesn't exist. 10:00:09 [D] context:134 Save data to /home/noel/Documents/Spikes/Kilosort/lastSorted/.phy/spikes_per_cluster.pkl. 10:00:09 [D] config:46 Load config file /home/noel/.phy/phy_config.py. 10:00:09 [D] init:40 Attached plugin AmplitudeHistogram. 10:00:09 [D] gui:432 Load the GUI state from /home/noel/.phy/TemplateGUI/state.json. 10:00:09 [E] cli:36 An error has occurred (ValueError): data.shape[-1] must be 1 not 2 for a_box_index 10:00:09 [D] cli:39 Traceback (most recent call last): File "/home/noel/.conda/envs/phy/bin/phy", line 11, in sys.exit(phy()) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(args, *kwargs) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, **kwargs) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phycontrib/template/gui.py", line 602, in gui _run_cmd('_run(params)', ctx, globals(), locals()) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/utils/cli.py", line 73, in _runcmd return exec(cmd, glob, loc) File "", line 1, in File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phycontrib/template/gui.py", line 575, in _run gui = controller.create_gui() File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phycontrib/template/gui.py", line 549, in create_gui self.add_trace_view(gui) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phycontrib/template/gui.py", line 454, in add_trace_view self._add_view(gui, v) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phycontrib/template/gui.py", line 174, in _add_view view.attach(gui) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/cluster/views/trace.py", line 309, in attach super(TraceView, self).attach(gui) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/cluster/views/base.py", line 79, in attach self.set_state(gui.state.get_view_state(self)) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/cluster/views/base.py", line 137, in set_state setattr(self, k, v) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/cluster/views/trace.py", line 381, in interval self.set_interval(value) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/cluster/views/trace.py", line 299, in set_interval self.build() File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/phy/plot/plot.py", line 195, in build visual.program['a_box_index'] = box_index.astype(np.float32) File "/home/noel/.conda/envs/phy/lib/python3.5/site-packages/vispy/gloo/program.py", line 363, in setitem % (numel, data._last_dim, name)) ValueError: data.shape[-1] must be 1 not 2 for a_box_index

I don´t understand what happen, do I have to uninstall and install phy again? Thanks! Noel

rossant commented 2 years ago

You seem to be using a very old version of Python and phy, I think reinstalling the latest version should fix this but please reopen if not.