cortex-lab / phy

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

kwik-gui: Suddenly 'NoneType' has no length error in middle of manual clustering #1158

Open reinderdorman opened 2 years ago

reinderdorman commented 2 years ago

In the middle of manual clustering, no noticable problems. Suddenly, without any discernable action or reason (that I noticed at least), got the below error when selecting any cluster. Worked fine before on the same file, and before also on other files.

Didn't save the file after this occurance, restarted the kwik-GUI, and it worked again. (Will report back if this issue happens again after similar actions, i.e. after normal manual clustering)

edit: It now seems to happen after merging a couple of noise clusters with a bigger noise cluster. Undo-ing this action also stops the error from occurring. Oddly, redo-ing the action afterwards merges these noise clusters and does NOT give this error.

system info: Windows 10 Phy KwikGUI v2.0b1 Phylib v2.2 python 3.7.6 conda 4.8.3

10:50:45.862 [E] init:62 An error has occurred (TypeError): object of type 'NoneType' has no len() Traceback (most recent call last): File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/gui/widgets.py", line 260, in emitJS self._debouncer.submit(emit, args) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/gui/qt.py", line 605, in submit self.trigger() File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/gui/qt.py", line 620, in trigger f(args, kwargs) 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/cluster/supervisor.py", line 821, in _clusters_selected emit('select', self, self.selected, kwargs) 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 315, in on_select 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/joblib/memory.py", line 591, in call return self._cached_call(args, kwargs)[0] File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/memory.py", line 534, in _cached_call out, metadata = self.call(*args, *kwargs) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/joblib/memory.py", line 761, in call output = self.func(args, kwargs) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 294, in get_spike_feature_amplitudes features = self._get_spike_features(spike_ids, [channel_id]).data File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/base.py", line 347, in _get_spike_features data = self.model.get_features(spike_ids, channel_ids) File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/phy/apps/kwik/gui.py", line 53, in get_features return self.all_features[spike_ids][:, channel_ids, :] File "/home/ephys/anaconda3/envs/phy2/lib/python3.7/site-packages/klusta/kwik/model.py", line 51, in getitem k = len(item) TypeError: object of type 'NoneType' has no len()