cortex-lab / phy

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

Incorrect channel selection in featureView (ctrl+click in waveformview) #1080

Open reinderdorman opened 3 years ago

reinderdorman commented 3 years ago

Hi all,

I found an issue with selecting channels for featureView, by clicking in the Waveform Viewer on the specific channels. When clicking on a channel, the features update, but on the wrong channel. I can't find a clear correlation/a linear transformation of te clicked-versus-displayed. for instsance, clicking on channels 14, 15, 16 provides 8, 9, 10 in featureview, but clicking on 17 gives channel 13. furthermore, everything below channel 10 seems to just provide channel 0 in the feature view. This seems to happen on multiple sessions, seemingly different each time.

I suspected it might be due to scaling in the waveform Viewer window, however, when opening a brand new sessions, this problems still persists (I believe that in new session it opens in default scaling?)

The probe layout looks perfect in every other way, so not sure what is going on here.

Working on phy KwikGUI v2.0b1, phylib v2.2, on Ubuntu 16.04

reinderdorman commented 2 years ago

in addition to this, I now get the below error when clicking on some parts of the waveform viewer. The numbering still doesn't align, and the GUI seems to think that certain values are out of bounds, even tho I can select channels with higher numbers. This error seems to happen from 38 till 50, below and from 50 till 64 seem to work fine (except for the whole above problem still).

18:06:44.586 [E] init:62 An error has occurred (IndexError): index 48 is out of bounds for axis 1 with size 40 Traceback (most recent call last): File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/plot/base.py", line 746, in mouseReleaseEvent self._mouse_event('mouse_click', e) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/plot/base.py", line 729, in _mouse_event self.emit(name, pos=pos, button=button, modifiers=modifiers, key=key) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/plot/base.py", line 716, in emit f(Bunch(kwargs)) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/cluster/views/waveform.py", line 479, in on_mouse_click emit('select_channel', self, channel_id=channel_id, key=key, button=b) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phylib/utils/event.py", line 141, in emit res.append(f(sender, *args, *kwargs)) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 245, in on_select_channel emit('selected_channel_changed', view) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phylib/utils/event.py", line 141, in emit res.append(f(sender, args, kwargs)) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 1329, in on_selected_channel_changed view.plot() File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/cluster/views/amplitude.py", line 213, in plot bunchs = self.get_clusters_data(kwargs) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/cluster/views/amplitude.py", line 194, in get_clusters_data bunchs = self.amplitudes[self.amplitudes_type](cluster_ids, load_all=load_all) or () File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 1287, in _amplitude_getter first_cluster=first_cluster) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 165, in get_spike_raw_amplitudes waveforms = self.model.get_waveforms(spike_ids[to_keep], [channel_id]) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/kwik/gui.py", line 56, in get_waveforms return self.all_waveforms[spike_ids][:, channel_ids, :] IndexError: index 48 is out of bounds for axis 1 with size 40