Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e0c3368
Add all-in-one run_compare_analyzers function
alejoe91 Dec 12, 2025
a1e3c0f
Cleanup
alejoe91 Dec 12, 2025
dbbb963
fix: conflicts
alejoe91 Sep 4, 2026
da9cb34
feat: add agreement_matrix and venn views and refactor controller
alejoe91 Sep 4, 2026
8756e79
fix: valid_periods + expose match_score
alejoe91 Sep 8, 2026
3a6d30e
Merge branch 'main' of github.com:SpikeInterface/spikeinterface-gui i…
alejoe91 Sep 11, 2026
bd0d722
wip
alejoe91 Sep 23, 2026
aa64a30
fix: merge with main
alejoe91 Sep 23, 2026
33d7e09
fix: merge conflicts
alejoe91 Oct 20, 2026
72d894a
fix: merge conflicts 2
alejoe91 Oct 20, 2026
8b22edc
wip: compare spikes view
alejoe91 Oct 26, 2026
7f9c19c
fix: conflicts
alejoe91 Oct 26, 2026
85549c9
feat: add comparelabels, comparemetrics and refine comparespikes view
alejoe91 Oct 27, 2026
fcff799
fic: add missing view files
alejoe91 Oct 28, 2026
20baac4
refactor: rearrange metrics layout in comparemetricsview - panel
alejoe91 Oct 28, 2026
a6f1b63
feat: fixes and features
alejoe91 Oct 30, 2026
e7fe163
feat: implement label_colormap and comparemainsettings
alejoe91 Oct 30, 2026
cf71fa5
fix unit selection when switching tabs
chrishalcrow Nov 2, 2026
d70d2d6
refresh on click
chrishalcrow Nov 4, 2026
9fc7a4e
feat: paired unit selection and unit symbols
alejoe91 Nov 5, 2026
29d8224
remove comments
alejoe91 Nov 5, 2026
52e47b7
fix: only set acg yrange for comparison gui
alejoe91 Nov 5, 2026
2a66272
fix: remove sorter label from comparison
alejoe91 Nov 6, 2026
8dae8af
fix: save false in tests for properties
alejoe91 Nov 6, 2026
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
spikeinterface_gui/tests/*/*
my_dataset/*
comparison_scripts/



Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/views/desktop/unitvenn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/views/web/comparelabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/views/web/comparemetrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/views/web/comparespikes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/views/web/compareunitlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/views/web/unitvenn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions docs/source/launch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,70 @@ The `curation_dict` can be saved inside the folder of the analyzer (for "binary_
Then it is auto-reloaded when the gui is re-opened.


Comparing two sorting outputs
-----------------------------

To compare the output of two sorters on the same recording, use ``run_mainwindow_comparison``
with two ``SortingAnalyzer`` computed on that recording.

.. code-block:: python

from spikeinterface_gui import run_mainwindow_comparison

run_mainwindow_comparison(
analyzer1,
analyzer2,
analyzer1_name="kilosort4",
analyzer2_name="tridesclous2",
)

The two analyzers are virtually concatenated into a single unit list, so that all the usual
views (probe, waveforms, traces, amplitudes, ...) can display units of both sorters side by
side. Unit ids are made unique across the two: integer ids are offset, and other ids get the
analyzer name as a suffix (``5_kilosort4``).

On top of that, ``spikeinterface.comparison.compare_two_sorters`` is run and dedicated
views are available:

* the **compare unit list**, with one row per pair of matched units and one row per unit
found by only one of the two sorters. The GUI starts with its first row (the best match)
visible. The usual **unit list** is still available next to it, to see units of both
sorters individually,
* the **agreement matrix** shows the agreement score of every pair of units. Clicking a
cell makes that pair visible: a matched pair is highlighted in the compare unit list,
any other pair in the unit list,
* the **unit venn** view summarizes how many units are matched and how many are specific to each
sorter, with a slider for the agreement threshold,
* the **compare spikes** view splits the spikes of the visible pair in matched spikes and
spikes found by only one of the two units, which helps spotting over-merges and
over-splits. When the ``waveforms`` extension is available, sample waveforms of the 3
groups are plotted,
* the **compare labels** view shows the proportions of a categorical unit property (e.g. a
quality label) for each sorter, as donut charts,
* the **compare metrics** view plots a unit metric of sorter 1 against the same metric of
sorter 2, for all the matched pairs.

That agreement threshold is shared: moving the slider of the unit venn view also re-orders the
agreement matrix, re-categorizes the rows of the compare unit list and updates the pairs of
the compare metrics view.

Both modes are supported, so the comparison can also be served as a web app:

.. code-block:: python

run_mainwindow_comparison(analyzer1, analyzer2, mode="web")

Some things are not available in comparison mode:

* curation, and therefore merging and splitting,
* the views that rely on extensions that cannot be shared between two sortings:
``template_similarity``, ``isi_histograms`` and ``principal_components``.
For ``correlograms``, only the auto-correlograms of each sorter are shown.

Only the recording of the first analyzer is used to display traces, and the two analyzers must
have matching recording attributes for the trace views to be shown at all.


Open the GUI launcher
---------------------

Expand Down
249 changes: 247 additions & 2 deletions docs/source/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Controls
* **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 Expand Up @@ -273,6 +274,14 @@ Correlograms View

This view shows the auto-correlograms and cross-correlograms of the selected units.

Settings
~~~~~~~~
- **window_ms** / **bin_ms** : the correlogram window and bin size (needs a re-compute).
- **display_axis** : show the axes of each plot.
- **show_cross_correlograms** : show the cross-correlograms (upper triangle), or only the
auto-correlograms side by side. In comparison mode only the auto-correlograms of both
sorters are available, so this is off by default.

Screenshots
~~~~~~~~~~~

Expand Down Expand Up @@ -393,11 +402,12 @@ revert, and export the curation data.

Controls
~~~~~~~~
- **save in analyzer**: Save the current curation state in the analyzer.
- **save in analyzer**/**save data**: Save the current curation state in the analyzer.
If a custom save callback is provided, it will be used instead.
- **export/download JSON**: Export the current curation state to a JSON file.
- **restore**: Restore the selected unit from the deleted units table.
- **unmerge**: Unmerge the selected merges from the merged units table.
- **submit to parent**: Submit the current curation state to the parent window (for use in web applications).
- **unsplit**: Unsplit the selected split groups from the split units table.
- **press 'ctrl+r'**: Restore the selected units from the deleted units table.
- **press 'ctrl+u'**: Unmerge the selected merges from the merged units table.
- **press 'ctrl+x'**: Unsplit the selected split groups from the split units table.
Expand Down Expand Up @@ -485,6 +495,10 @@ positions and widths.
- troughs are negative extrema and are displayed with a downward triangle symbol
- peaks are positive extrema and are displayed with an upward triangle symbol

x-axis represents time and is in units of milliseconds.
y-axis represents the electrical signal. The units depend on your preprocessing
steps, but is usually in uV.

Screenshots
~~~~~~~~~~~

Expand All @@ -499,3 +513,234 @@ Screenshots
- .. image:: images/views/web/maintemplate.png
:width: 100%

No help text available.

*Screenshots not available for this view.*

Compare Unit List View
----------------------

The unit list in comparison mode. One row per pair of matched units, plus one row per unit
that only one of the two sorters found.

The rows are sorted by decreasing agreement score, so the best matches come first and the
units that only one sorter found (score 0) come last.

The matching is done at the agreement threshold shared with the other comparison views
(set it with the slider of the unit Venn view). The table is read only: there is no curation in
comparison mode.

Settings
~~~~~~~~
- **matching_mode** : "hungarian" gives a one to one matching, "best_match" simply takes
the best candidate for each unit of the first sorter, so a unit of the second sorter can
appear on several rows.

Controls
~~~~~~~~
- **left click on a row** : make the units of this row visible in the other views.
- **columns** : add unit properties that both sorters have (e.g. firing rate or a quality
label), as one column per sorter.

Screenshots
~~~~~~~~~~~

.. list-table::
:widths: 50 50
:header-rows: 1

* - Desktop (Qt)
- Web (Panel)
* - .. image:: images/views/desktop/compareunitlist.png
:width: 100%
- .. image:: images/views/web/compareunitlist.png
:width: 100%

Agreement Matrix View
---------------------

Agreement scores between the units of the two compared sorting outputs.

Rows (horizontal axis) are the units of the first analyzer, columns (vertical axis) the
units of the second one. The score is the number of matched spikes divided by the total
number of spikes of both units, so it is 1 for two identical spike trains and 0 when no
spike matches.

Settings
~~~~~~~~
- **ordered** : reorder rows and columns so that the best matches are on the diagonal.
- **show_all** : when off, only the currently visible units are displayed.
- **max_labels** : hide the unit id labels when the matrix is bigger than this.

Controls
~~~~~~~~
- **left click** : select the pair of units of this cell, and make only those visible.
- **ctrl + left click** : add the pair of units to the visible ones.

Screenshots
~~~~~~~~~~~

.. list-table::
:widths: 50 50
:header-rows: 1

* - Desktop (Qt)
- Web (Panel)
* - .. image:: images/views/desktop/agreementmatrix.png
:width: 100%
- .. image:: images/views/web/agreementmatrix.png
:width: 100%

Unit Venn View
--------------

Venn diagram of the two compared sorting outputs. The area of each disc is proportional to
the number of units of that sorter, and the area of the intersection is proportional to the
number of units matched between the two, so the picture is quantitatively honest.

The matching is one to one (hungarian) at the agreement threshold set with the slider.
That threshold is shared with the other comparison views: moving it also re-orders the
agreement matrix and re-categorizes the rows of the comparison unit table.

Controls
~~~~~~~~
- **slider** : the agreement threshold above which two units are considered matched.
- **filter** : only count the units whose categorical property (e.g. a quality label, shared
by both sorters) is one of the checked values.
- **left click on a region** : make one random unit of that region visible. Clicking again
picks another one, which is a quick way to walk through a region. Clicking the
intersection selects the two units of one matched pair, so that they can be compared.

Only one unit (or one matched pair) is selected per click, so that the selection always
matches a single row of the comparison unit table.

Settings
~~~~~~~~
- **inclusion** : how a matched pair is counted when only one of its units passes the filter.
"both": the pair is matched only when both units pass, otherwise the passing unit counts as
found by its own sorter only. "any": the pair stays matched when at least one unit passes.

Screenshots
~~~~~~~~~~~

.. list-table::
:widths: 50 50
:header-rows: 1

* - Desktop (Qt)
- Web (Panel)
* - .. image:: images/views/desktop/unitvenn.png
:width: 100%
- .. image:: images/views/web/unitvenn.png
:width: 100%

Compare Spikes View
-------------------

Spike level comparison of one pair of units, one unit of each sorter. Select a row of the
comparison unit table with two units: the comparison is computed automatically.

The Venn diagram shows the spikes found by both units (matched, within the comparison
`delta_time`), and the spikes found by only one of them. The areas are proportional to the
spike counts.

When the waveforms extension is loaded, sample waveforms of the 3 regions are plotted below,
on the extremum channel of the unit of sorter 1: sorter 1 only (left), both (middle) and
sorter 2 only (right), with the colors of the Venn diagram.
Waveforms only exist for the `random_spikes` subset, so only those spikes are plotted. The
titles tell how many of the region's spikes have waveforms.

Controls
~~~~~~~~
- **left click on a region** : select the spikes of that region (they show up in the spike
list and trace views).
- **Select {sorter 1} / Select match / Select {sorter 2}** : the same as clicking a region,
for when a region is too thin to click on.

Settings
~~~~~~~~
- **max_waveforms** : the maximum number of waveforms plotted per unit and region.

Screenshots
~~~~~~~~~~~

.. list-table::
:widths: 50 50
:header-rows: 1

* - Desktop (Qt)
- Web (Panel)
* - .. image:: images/views/desktop/comparespikes.png
:width: 100%
- .. image:: images/views/web/comparespikes.png
:width: 100%

Compare Labels View
-------------------

Proportions of a categorical unit property (e.g. a quality label: SUA / MUA / noise) for the
two compared sorting outputs, as one donut chart per sorter. The total number of units is in
the middle of each donut.

Only the non numeric properties that are set for both analyzers are listed. Units with no
value are counted as "n/a".

Controls
~~~~~~~~
- **property** : the categorical property to display.

Settings
~~~~~~~~
- **max_categories** : properties with more distinct values than this are not listed.

Screenshots
~~~~~~~~~~~

.. list-table::
:widths: 50 50
:header-rows: 1

* - Desktop (Qt)
- Web (Panel)
* - .. image:: images/views/desktop/comparelabels.png
:width: 100%
- .. image:: images/views/web/comparelabels.png
:width: 100%

Compare Metrics View
--------------------

Scatter plots of unit metrics for the matched pairs: the value of the unit of sorter 1 on the
horizontal axis, the value of the unit of sorter 2 on the vertical axis. The dashed line marks
equality.

The pairs are the ones matched at the agreement threshold shared with the unit Venn view (set it
with the slider of the unit Venn view). The visible pair is drawn bigger, with a white outline.

Controls
~~~~~~~~
- **metrics** : the metrics to plot, one scatter plot per metric.
- **color by** : color the points by a categorical property (e.g. a quality label) of the
unit of sorter 1 or of sorter 2.
- **left click on a point** : make that pair of units visible.

Settings
~~~~~~~~
- **log_scale** : plot log10(value + .001), useful for firing rates and ISI violations.
- **num_columns** : the number of plots per row.
- **max_categories** : properties with more distinct values than this are not listed in "color by".

Screenshots
~~~~~~~~~~~

.. list-table::
:widths: 50 50
:header-rows: 1

* - Desktop (Qt)
- Web (Panel)
* - .. image:: images/views/desktop/comparemetrics.png
:width: 100%
- .. image:: images/views/web/comparemetrics.png
:width: 100%

2 changes: 1 addition & 1 deletion spikeinterface_gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

from .version import version as __version__

from .main import run_mainwindow, run_launcher
from .main import run_mainwindow, run_launcher, run_mainwindow_comparison

Loading
Loading