Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spikeinterface_gui/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def __init__(
self._traces_cached = {}

self.units_table = make_units_table_from_analyzer(analyzer, extra_properties=extra_unit_properties)

if displayed_unit_properties is None:
displayed_unit_properties = list(_default_displayed_unit_properties)
if extra_unit_properties is not None:
Expand Down
24 changes: 13 additions & 11 deletions spikeinterface_gui/unitlistview.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def _qt_make_layout(self):
self.shortcut_mua = None
self.shortcut_noise = None
if self.controller.has_default_quality_labels:
self.shortcut_clear = QT.QShortcut(self.qt_widget)
self.shortcut_clear.setKey(QT.QKeySequence('c'))
self.shortcut_clear.activated.connect(lambda: self._qt_set_default_label(None))

self.shortcut_good = QT.QShortcut(self.qt_widget)
self.shortcut_good.setKey(QT.QKeySequence('g'))
self.shortcut_good.activated.connect(lambda: self._qt_set_default_label('good'))
Expand Down Expand Up @@ -212,7 +216,7 @@ def _qt_full_table_refresh(self):
self.table.clear()


internal_column_names = ['unit_id', 'visible', 'channel_id', 'sparsity']
internal_column_names = ['unit_id', 'visible', 'channel_id']

# internal labels
column_labels = list(internal_column_names)
Expand Down Expand Up @@ -272,11 +276,6 @@ def _qt_full_table_refresh(self):
item = CustomItem(f'{channel_id}')
item.setFlags(QT.Qt.ItemIsEnabled|QT.Qt.ItemIsSelectable)
self.table.setItem(i, 2, item)

num_chan = np.sum(self.controller.get_sparsity_mask()[i, :])
item = CustomItem(f'{num_chan}')
item.setFlags(QT.Qt.ItemIsEnabled|QT.Qt.ItemIsSelectable)
self.table.setItem(i, 3, item)

n_first = len(internal_column_names)
self.label_columns = list(range(n_first, n_first + num_labels))
Expand Down Expand Up @@ -476,20 +475,15 @@ def _panel_make_layout(self):
if label == "quality":
frozen_columns.append(label)
data["channel_id"] = []
data["sparsity"] = []

self.main_cols = list(data.keys())
sparsity_mask = self.controller.get_sparsity_mask()
for unit_index, unit_id in enumerate(unit_ids):
data["unit_id"].append(
{"id": str(unit_id), "color": mcolors.to_hex(self.controller.get_unit_color(unit_id))}
)
data["channel_id"].append(
self.controller.channel_ids[self.controller.get_extremum_channel(unit_id)]
)
data["sparsity"].append(
np.sum(sparsity_mask[unit_index, :])
)
for col in self.controller.displayed_unit_properties:
data[col] = self.controller.units_table[col]

Expand Down Expand Up @@ -564,6 +558,7 @@ def _panel_make_layout(self):
if self.controller.has_default_quality_labels:
shortcuts.extend(
[
KeyboardShortcut(name="clear", key="c", ctrlKey=False),
KeyboardShortcut(name="good", key="g", ctrlKey=False),
KeyboardShortcut(name="mua", key="m", ctrlKey=False),
KeyboardShortcut(name="noise", key="n", ctrlKey=False),
Expand Down Expand Up @@ -767,6 +762,12 @@ def _panel_handle_shortcut(self, event):
self.controller.set_visible_unit_ids(selected_unit_ids)
self.notify_unit_visibility_changed()
self.refresh()
elif event.data == "clear":
for unit_id in selected_unit_ids:
self.controller.set_label_to_unit(unit_id, "quality", None)
self.table.value.loc[selected_unit_ids, "quality"] = ""
self.notify_manual_curation_updated()
self.refresh()
elif event.data == "good":
for unit_id in selected_unit_ids:
self.controller.set_label_to_unit(unit_id, "quality", "good")
Expand Down Expand Up @@ -800,6 +801,7 @@ def _panel_handle_shortcut(self, event):
* **ctrl + arrow up/down** : select next/previous unit and make it visible alone
* **press 'ctrl+d'** : delete selected units (if curation=True)
* **press 'ctrl+m'** : merge selected units (if curation=True)
* **press 'c'** : clear label of selected units (if curation=True)
* **press 'g'** : label selected units as good (if curation=True)
* **press 'm'** : label selected units as mua (if curation=True)
* **press 'n'** : label selected units as noise (if curation=True)
Expand Down
16 changes: 8 additions & 8 deletions spikeinterface_gui/waveformheatmapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ class WaveformHeatMapView(ViewBase):
id = "waveformheatmap"
_supported_backend = ['qt', 'panel']
_settings = [
{'name': 'colormap', 'type': 'list', 'limits' : ['hot', 'viridis', 'jet', 'gray', ] },
{'name': 'show_channel_id', 'type': 'bool', 'value': True},
#~ {'name': 'data', 'type': 'list', 'limits' : ['waveforms', 'features', ] },
{'name': 'bin_min', 'type': 'float', 'value' : -20. },
{'name': 'bin_max', 'type': 'float', 'value' : 8. },
{'name': 'bin_size', 'type': 'float', 'value' : .1 },
{'name': 'max_unit', 'type': 'int', 'value' : 4 },
]
{'name': 'colormap', 'type': 'list', 'limits' : ['hot', 'viridis', 'jet', 'gray', ] },
{'name': 'show_channel_id', 'type': 'bool', 'value': True},
#~ {'name': 'data', 'type': 'list', 'limits' : ['waveforms', 'features', ] },
{'name': 'bin_min', 'type': 'float', 'value' : -20. },
{'name': 'bin_max', 'type': 'float', 'value' : 8. },
{'name': 'bin_size', 'type': 'float', 'value' : .1 },
{'name': 'max_unit', 'type': 'int', 'value' : 4 },
]

_depend_on = ['waveforms']

Expand Down