diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..b231667 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -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 diff --git a/TODO.md b/TODO.md index 8fdc7e0..2674b3c 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/docs/source/views.rst b/docs/source/views.rst index 7bfd4c2..e29fc03 100644 --- a/docs/source/views.rst +++ b/docs/source/views.rst @@ -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 diff --git a/pyproject.toml b/pyproject.toml index acfa121..c1dbda0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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' diff --git a/spikeinterface_gui/__init__.py b/spikeinterface_gui/__init__.py index 90764da..367d75c 100644 --- a/spikeinterface_gui/__init__.py +++ b/spikeinterface_gui/__init__.py @@ -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). diff --git a/spikeinterface_gui/backend_panel.py b/spikeinterface_gui/backend_panel.py index 0844dd1..d54e476 100644 --- a/spikeinterface_gui/backend_panel.py +++ b/spikeinterface_gui/backend_panel.py @@ -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() @@ -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: diff --git a/spikeinterface_gui/backend_qt.py b/spikeinterface_gui/backend_qt.py index c5b1839..aae1288 100644 --- a/spikeinterface_gui/backend_qt.py +++ b/spikeinterface_gui/backend_qt.py @@ -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) @@ -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) diff --git a/spikeinterface_gui/controller.py b/spikeinterface_gui/controller.py index 8d78a71..cb89be8 100644 --- a/spikeinterface_gui/controller.py +++ b/spikeinterface_gui/controller.py @@ -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 @@ -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 diff --git a/spikeinterface_gui/ndscatterview.py b/spikeinterface_gui/ndscatterview.py index 65e71e9..7c0c5b8 100644 --- a/spikeinterface_gui/ndscatterview.py +++ b/spikeinterface_gui/ndscatterview.py @@ -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) @@ -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) @@ -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 @@ -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) @@ -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) diff --git a/spikeinterface_gui/probeview.py b/spikeinterface_gui/probeview.py index 2909964..3f3c73f 100644 --- a/spikeinterface_gui/probeview.py +++ b/spikeinterface_gui/probeview.py @@ -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 """ diff --git a/spikeinterface_gui/spikelistview.py b/spikeinterface_gui/spikelistview.py index 2e5510f..548010c 100644 --- a/spikeinterface_gui/spikelistview.py +++ b/spikeinterface_gui/spikelistview.py @@ -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 diff --git a/spikeinterface_gui/tests/testingtools.py b/spikeinterface_gui/tests/testingtools.py index de29f8e..44e7ee5 100644 --- a/spikeinterface_gui/tests/testingtools.py +++ b/spikeinterface_gui/tests/testingtools.py @@ -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( @@ -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: @@ -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)) diff --git a/spikeinterface_gui/utils_panel.py b/spikeinterface_gui/utils_panel.py index 7b5ba94..0ed6a31 100644 --- a/spikeinterface_gui/utils_panel.py +++ b/spikeinterface_gui/utils_panel.py @@ -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) diff --git a/spikeinterface_gui/utils_qt.py b/spikeinterface_gui/utils_qt.py index ddfc9cc..0d1f5d5 100644 --- a/spikeinterface_gui/utils_qt.py +++ b/spikeinterface_gui/utils_qt.py @@ -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) diff --git a/spikeinterface_gui/view_base.py b/spikeinterface_gui/view_base.py index c2828c2..a6c5b11 100644 --- a/spikeinterface_gui/view_base.py +++ b/spikeinterface_gui/view_base.py @@ -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"): @@ -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 @@ -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): @@ -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):