-
Notifications
You must be signed in to change notification settings - Fork 21
Improve desktop mode performance #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chrishalcrow
merged 11 commits into
SpikeInterface:main
from
grahamfindlay:perf/desktop-traceview
Jul 23, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f38faf2
Fix sigui CLI --recording to reference correct args.recording_base_fo…
grahamfindlay d82f154
Verbalize real error and fail loudly on sigui CLI --recording load fa…
grahamfindlay 3901ca0
Integrate fix/cli-recording-base-folder-typo: sigui CLI --recording f…
grahamfindlay 457f3b7
Align the spike vector dtype for fast np.searchsorted
grahamfindlay 63b6e43
Avoid scanning the whole segment in `get_selected_spikes_data`
grahamfindlay 8278f69
Integrate perf/desktop-traceview: O(N_spikes) fixes for desktop refre…
grahamfindlay 30eeea1
Skip refreshing views hidden behind a tab
grahamfindlay 6a54087
Slice the time vector lazily in get_times_chunk
grahamfindlay 8f03f98
Defer initial view refresh until first shown
grahamfindlay fd98ca1
Fast splitting of clusters based on selected spikes
grahamfindlay 7433709
Fix (prexisting) failing tests
grahamfindlay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,45 @@ | ||
| import spikeinterface_gui as sigui | ||
| from pathlib import Path | ||
|
|
||
| from spikeinterface_gui.tests.testingtools import clean_all, make_analyzer_folder | ||
| import numpy as np | ||
|
|
||
| import spikeinterface.full as si | ||
|
|
||
| from pathlib import Path | ||
| from spikeinterface_gui.controller import Controller | ||
| from spikeinterface_gui.tests.testingtools import clean_all, make_analyzer_folder | ||
|
|
||
| test_folder = Path('my_dataset') | ||
|
|
||
|
|
||
| def setup_module(): | ||
| make_analyzer_folder(test_folder) | ||
|
|
||
|
|
||
| def teardown_module(): | ||
| clean_all(test_folder) | ||
|
|
||
|
|
||
| def test_controller(): | ||
| def _load_controller(curation=False): | ||
| sorting_analyzer = si.load_sorting_analyzer(test_folder / "sorting_analyzer") | ||
| print() | ||
| controller = sigui.SpikeinterfaceController(sorting_analyzer) | ||
| print(controller) | ||
|
|
||
| # print(controller.segment_slices) | ||
| print(controller.get_isi_histograms()) | ||
|
|
||
| return Controller(sorting_analyzer, curation=curation) | ||
|
|
||
|
|
||
| def test_controller(): | ||
| controller = _load_controller() | ||
|
|
||
| # unit_ids mirror the analyzer | ||
| assert list(controller.unit_ids) == list(controller.analyzer.unit_ids) | ||
|
|
||
| # isi histograms were computed and are shaped consistently with the units | ||
| isi_histograms, isi_bins = controller.get_isi_histograms() | ||
| assert isi_histograms.shape[0] == controller.unit_ids.size | ||
| assert isi_bins.shape[0] == isi_histograms.shape[1] + 1 | ||
|
|
||
|
|
||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
|
|
||
| # setup_module() | ||
| test_controller() | ||
| setup_module() | ||
| try: | ||
| test_controller() | ||
| finally: | ||
| teardown_module() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,43 @@ | ||
| from spikeinterface_gui.curation_tools import adding_group | ||
| from spikeinterface_gui.curation_tools import add_merge | ||
|
|
||
|
|
||
| def test_adding_group(): | ||
| original_groups = [[1, 2, 3], [4, 5, 6], [7, 8]] | ||
| new_group_0 = [12, 10] | ||
| new_group_1 = [1, 10] | ||
| new_group_2 = [1, 10, 4] | ||
| new_group_3 = [1, 10, 8] | ||
| new_group_4 = [1, 4, 8] | ||
| r0 = adding_group(original_groups, new_group_0) | ||
| r1 = adding_group(original_groups, new_group_1) | ||
| r2 = adding_group(original_groups, new_group_2) | ||
| r3 = adding_group(original_groups, new_group_3) | ||
| r4 = adding_group(original_groups, new_group_4) | ||
| assert r0 == [[10, 12], [1, 2, 3], [4, 5, 6], [8, 7]] | ||
| assert r1 == [[3, 1, 10, 2], [4, 5, 6], [8, 7]] | ||
| assert r2 == [[1, 2, 3, 4, 5, 6, 10], [8, 7]] | ||
| assert r3 == [[1, 2, 3, 7, 8, 10], [4, 5, 6]] | ||
| assert r4 == [[1, 2, 3, 4, 5, 6, 7, 8]] | ||
| print(f'{r0} \n {r1} \n {r2} \n {r3} \n {r4}') | ||
| def _as_sets(merges): | ||
| # add_merge returns [{"unit_ids": [...]}, ...] with the group contents | ||
| # de-duplicated via set(), so compare order-insensitively. | ||
| return {frozenset(merge["unit_ids"]) for merge in merges} | ||
|
|
||
|
|
||
| def test_add_merge(): | ||
| # previous merges use the curation_data["merges"] format: list of | ||
| # {"unit_ids": [...]} groups. Adding a new group transitively merges every | ||
| # existing group that shares a unit with it. | ||
| previous_merges = [ | ||
| {"unit_ids": [1, 2, 3]}, | ||
| {"unit_ids": [4, 5, 6]}, | ||
| {"unit_ids": [7, 8]}, | ||
| ] | ||
|
|
||
| # disjoint new group -> kept as its own group, others untouched | ||
| assert _as_sets(add_merge(previous_merges, [12, 10])) == { | ||
| frozenset({10, 12}), frozenset({1, 2, 3}), frozenset({4, 5, 6}), frozenset({7, 8}), | ||
| } | ||
| # shares unit 1 -> folds into the {1,2,3} group | ||
| assert _as_sets(add_merge(previous_merges, [1, 10])) == { | ||
| frozenset({1, 2, 3, 10}), frozenset({4, 5, 6}), frozenset({7, 8}), | ||
| } | ||
| # bridges the {1,2,3} and {4,5,6} groups | ||
| assert _as_sets(add_merge(previous_merges, [1, 10, 4])) == { | ||
| frozenset({1, 2, 3, 4, 5, 6, 10}), frozenset({7, 8}), | ||
| } | ||
| # bridges the {1,2,3} and {7,8} groups | ||
| assert _as_sets(add_merge(previous_merges, [1, 10, 8])) == { | ||
| frozenset({1, 2, 3, 7, 8, 10}), frozenset({4, 5, 6}), | ||
| } | ||
| # bridges all three groups | ||
| assert _as_sets(add_merge(previous_merges, [1, 4, 8])) == { | ||
| frozenset({1, 2, 3, 4, 5, 6, 7, 8}), | ||
| } | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| test_add_merge() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, thank you