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
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within pyproject.toml
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- [ ] global settings (e.g. color options, layout)
- [x] unit list
- [x] more columns to panel unit list
- [x] add settings to select colums
- [x] add settings to select columns
- [x] add sparsity and channel id
- [x] visible only when clicking on select column
- [x] make x-axis scrollable
Expand Down
2 changes: 1 addition & 1 deletion docs/source/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Controls
~~~~~~~~
- **left click** : select single unit
- **ctrl + left click** : add unit to selection
- **mouse drag from within circle** : change channel visibilty and unit visibility on other views
- **mouse drag from within circle** : change channel visibility and unit visibility on other views
- **mouse drag from "diamond"** : change channel / unit radii size

Screenshots
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,10 @@ docs = [
"sphinx>=5.0",
"sphinx_rtd_theme",
]

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git*,pyproject.toml'
check-hidden = true
# ignore-regex = ''
ignore-words-list = 'nd,gaus'
2 changes: 1 addition & 1 deletion spikeinterface_gui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Some design notes:
* controller is a layer between spikeinterface objects and every view
* every view can notify some signals to other view that are centralized bu the controller
* every view can notify some signals to other view that are centralized by the controller
* views have settings
* views have 2 implementations : qt (legacy) and panel (for the web)
They need to implement the make_layout and the refresh for each backends (qt, panel).
Expand Down
4 changes: 2 additions & 2 deletions spikeinterface_gui/backend_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __init__(self, controller, layout_dict=None, user_settings=None):
self.make_views(user_settings)
self.create_main_layout()

# refresh all views wihtout notiying
# refresh all views without notiying
self.controller.signal_handler.deactivate()
self.controller.signal_handler.activate()

Expand Down Expand Up @@ -281,7 +281,7 @@ def create_main_layout(self):

layout_zone = {}
for zone, view_names in preset.items():
# keep only instanciated views
# keep only instantiated views
view_names = [view_name for view_name in view_names if view_name in self.view_layouts.keys()]

if len(view_names) == 0:
Expand Down
6 changes: 3 additions & 3 deletions spikeinterface_gui/backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def notify_unit_color_changed(self):
self.unit_color_changed.emit()


# Used by controler to handle/callback signals
# Used by controller to handle/callback signals
class SignalHandler(QT.QObject):
def __init__(self, controller, parent=None):
QT.QObject.__init__(self, parent=parent)
Expand Down Expand Up @@ -165,13 +165,13 @@ def __init__(self, controller, parent=None, layout_dict=None, user_settings=None
self.make_views(user_settings)
self.create_main_layout()

# refresh all views wihtout notiying
# refresh all views without notiying
self.controller.signal_handler.deactivate()
for view in self.views.values():
# refresh do not work because view are not yet visible at init
view._refresh()
self.controller.signal_handler.activate()
# TODO sam : all veiws are always refreshed at the moment so this is useless.
# TODO sam : all views are always refreshed at the moment so this is useless.
# uncommen this when ViewBase.is_view_visible() work correctly
# for view_name, dock in self.docks.items():
# dock.visibilityChanged.connect(self.views[view_name].refresh)
Expand Down
4 changes: 2 additions & 2 deletions spikeinterface_gui/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, analyzer=None, backend="qt", parent=None, verbose=False, save
self.main_settings = _default_main_settings.copy()

self.num_channels = self.analyzer.get_num_channels()
# this now private and shoudl be acess using function
# this now private and should be access using function
self._visible_unit_ids = [self.unit_ids[0]]

# sparsity
Expand Down Expand Up @@ -552,7 +552,7 @@ def get_visible_unit_ids(self):
return self._visible_unit_ids

def get_visible_unit_indices(self):
"""Get list of indicies of visible units"""
"""Get list of indices of visible units"""
unit_ids = list(self.unit_ids)
visible_unit_indices = [unit_ids.index(u) for u in self._visible_unit_ids]
return visible_unit_indices
Expand Down
10 changes: 5 additions & 5 deletions spikeinterface_gui/ndscatterview.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, controller=None, parent=None, backend="qt"):
self.selected_comp = np.ones((ndim), dtype='bool')
self.projection = self.get_one_random_projection()

#estimate limts
#estimate limits
data = self.data
if data.shape[0] > 1000:
inds = np.random.choice(data.shape[0], 1000, replace=False)
Expand Down Expand Up @@ -280,7 +280,7 @@ def _qt_refresh(self, update_components=True, update_colors=True):
self.update_selected_components()

#ndscatter
# TODO sam: I have the feeling taht it is a bit slow
# TODO sam: I have the feeling that it is a bit slow
self.scatter.clear()

# scatter_x, scatter_y, spike_indices, selected_scatter_x, selected_scatter_y = self.get_plotting_data(concatenated=True)
Expand All @@ -297,7 +297,7 @@ def _qt_refresh(self, update_components=True, update_colors=True):
self.scatter_select.setData(selected_scatter_x, selected_scatter_y)


# TODO sam : kepp the old implementation in mind
# TODO sam : keep the old implementation in mind
# for unit_index, unit_id in enumerate(self.controller.unit_ids):
# if not self.controller.get_unit_visibility(unit_id):
# continue
Expand Down Expand Up @@ -367,7 +367,7 @@ def _qt_on_lasso_finished(self, points, shift_held=False):
vertices = np.array(points)
self._lasso_vertices.append(vertices)

# inside lasso and visibles
# inside lasso and visible
ind_visibles, = np.nonzero(np.isin(self.random_spikes_indices, self.controller.get_indices_spike_visible()))
projected = self.apply_dot(self.data[ind_visibles, :])
inside = inside_poly(projected, vertices)
Expand Down Expand Up @@ -550,7 +550,7 @@ def _on_panel_selection_geometry(self, event):
else:
self._lasso_vertices = [polygon]

# inside lasso and visibles
# inside lasso and visible
ind_visibles, = np.nonzero(np.isin(self.random_spikes_indices, self.controller.get_indices_spike_visible()))
inds = self.random_spikes_indices[ind_visibles[selected]]
self.controller.set_indices_spike_selected(inds)
Expand Down
2 changes: 1 addition & 1 deletion spikeinterface_gui/probeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,6 @@ def circle_from_roi(roi):
### Controls
- **left click** : select single unit
- **ctrl + left click** : add unit to selection
- **mouse drag from within circle** : change channel visibilty and unit visibility on other views
- **mouse drag from within circle** : change channel visibility and unit visibility on other views
- **mouse drag from "diamond"** : change channel / unit radii size
"""
2 changes: 1 addition & 1 deletion spikeinterface_gui/spikelistview.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def _qt_on_spike_selection_changed(self):
visible_inds = self.controller.get_indices_spike_visible()
row_selected, = np.nonzero(np.isin(visible_inds, selected_inds))

if row_selected.size>100:#otherwise this is verry slow
if row_selected.size>100:#otherwise this is very slow
row_selected = row_selected[:10]

# change selection
Expand Down
6 changes: 3 additions & 3 deletions spikeinterface_gui/tests/testingtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def make_analyzer_folder(test_folder, case="small", unit_dtype="str"):
job_kwargs = dict(n_jobs=-1, progress_bar=True, chunk_duration="1s")

recordings = []
sortings = []
sorting = []
probes = []
for i in range(num_probe):
recording, sorting = si.generate_ground_truth_recording(
Expand Down Expand Up @@ -75,7 +75,7 @@ def make_analyzer_folder(test_folder, case="small", unit_dtype="str"):
recording = recording.set_probe(probe)

recordings.append(recording)
sortings.append(sorting)
sorting.append(sorting)
probes.append(probe.copy())

if 'split' in case:
Expand Down Expand Up @@ -105,7 +105,7 @@ def make_analyzer_folder(test_folder, case="small", unit_dtype="str"):
count += n
recording = recording.set_probegroup(probegroup)

sorting = si.aggregate_units(sortings)
sorting = si.aggregate_units(sorting)

sorting = sorting.rename_units(sorting.unit_ids.astype(unit_dtype))

Expand Down
2 changes: 1 addition & 1 deletion spikeinterface_gui/utils_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def is_position_inside(self, x, y, skip_other_positions=None, skip_distance=5):
"""
Check if the given position (x, y) is inside the circle.
If skip_other_positions is provided, check if the position is close to any of them
usinf the skip_distance.
using the skip_distance.
"""
# Check if position is inside the circle
distance = np.sqrt((x - self.center[0]) ** 2 + (y - self.center[1]) ** 2)
Expand Down
2 changes: 1 addition & 1 deletion spikeinterface_gui/utils_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


def add_stretch_to_qtoolbar(tb):
# add an expending widget + a seprator
# add an expending widget + a separator
empty = QT.QWidget()
empty.setSizePolicy(QT.QSizePolicy.Expanding, QT.QSizePolicy.Preferred)
tb.addWidget(empty)
Expand Down
8 changes: 4 additions & 4 deletions spikeinterface_gui/view_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def notify_unit_color_changed(self):
def on_settings_changed(self, *params):
# what to do when one settings is changed
# optionally views can implement custom method
# but the general case is to refesh
# but the general case is to refresh
if self.backend == "qt" and hasattr(self, "_qt_on_settings_changed"):
return self._qt_on_settings_changed()
elif self.backend == "panel" and hasattr(self, "_panel_on_settings_changed"):
Expand Down Expand Up @@ -178,7 +178,7 @@ def get_unit_color(self, unit_id):
html_color = matplotlib.colors.rgb2hex(color, keep_alpha=True)
return html_color

# Default behavior for all views : this can be changed view by view for perfs reaons
# Default behavior for all views : this can be changed view by view for perfs reasons
def on_spike_selection_changed(self):
if not self.is_view_visible():
return
Expand Down Expand Up @@ -252,7 +252,7 @@ def _qt_on_spike_selection_changed(self):
pass

def _qt_on_unit_visibility_changed(self):
# most veiw need a refresh
# most view need a refresh
self.refresh()

def _qt_on_channel_visibility_changed(self):
Expand Down Expand Up @@ -312,7 +312,7 @@ def _panel_on_spike_selection_changed(self):
pass

def _panel_on_unit_visibility_changed(self):
# most veiw need a refresh
# most view need a refresh
self.refresh()

def _panel_on_channel_visibility_changed(self):
Expand Down