Skip to content
Merged
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
24 changes: 5 additions & 19 deletions docs/source/generate_view_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import re
from pathlib import Path

from spikeinterface_gui.viewlist import get_all_possible_views


def markdown_to_rst(markdown_text):
"""Convert markdown text to RST format."""
Expand Down Expand Up @@ -66,28 +68,12 @@ def generate_views_rst():

# Add GUI directory to Python path
sys.path.insert(0, str(gui_dir.absolute()))

all_possible_class_views = get_all_possible_views()

# Define view information by parsing files directly (avoiding import issues)
view_files = {
'probe': 'probeview.py',
'unitlist': 'unitlistview.py',
'spikelist': 'spikelistview.py',
'merge': 'mergeview.py',
'trace': 'traceview.py',
'waveform': 'waveformview.py',
'waveformheatmap': 'waveformheatmapview.py',
'isi': 'isiview.py',
'correlogram': 'crosscorrelogramview.py',
'ndscatter': 'ndscatterview.py',
'similarity': 'similarityview.py',
'spikeamplitude': 'spikeamplitudeview.py',
'spikedepth': 'spikedepthview.py',
'amplitudescalings': 'amplitudescalingsview.py',
'tracemap': 'tracemapview.py',
'curation': 'curationview.py',
'spikerate': 'spikerateview.py',
'metrics': 'metricsview.py',
'mainsettings': 'mainsettingsview.py',
p: f"{p}view.py" for p in all_possible_class_views.keys()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magnifico

}

# Extract help text from each view file
Expand Down
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/maintemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 100 additions & 57 deletions docs/source/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ Screenshots
- .. image:: images/views/web/probe.png
:width: 100%

Main settings
-------------

Overview and main controls.
Can save current settings for entire GUI as the default user settings using the "Save as default settings" button.

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

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

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

Unit List
---------

Expand Down Expand Up @@ -64,17 +84,10 @@ Screenshots
- .. image:: images/views/web/unitlist.png
:width: 100%

Spike list View
---------------

Show all spikes of the visible units. When spikes are selected, they are highlighted in the Spike Amplitude View and the ND SCatter View.
When a single spike is selected, the Trace and TraceMap Views are centered on it.
SpikeRateView View
------------------

Controls
~~~~~~~~
* **↻ spikes**: refresh the spike list
* **clear**: clear the selected spikes
* **shift + arrow up/down** : select next/previous spike and make it visible alone
This view shows firing rate for spikes per `bin_s`.

Screenshots
~~~~~~~~~~~
Expand All @@ -85,19 +98,17 @@ Screenshots

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

Merge View
----------

This view allows you to compute potential merges between units based on their similarity or using the auto merge function.
Select the method to use for merging units.
The available methods are:
- similarity: Computes the similarity between units based on their features.
- automerge: uses the auto merge function in SpikeInterface to find potential merges.
Select the preset to use for merging units.
The available presets are inherited from spikeinterface.

Click "Calculate merges" to compute the potential merges. When finished, the table will be populated
with the potential merges.
Expand Down Expand Up @@ -133,6 +144,7 @@ Controls
* **auto scale**: Automatically adjust the scale of the traces.
* **time (s)**: Set the time point to display traces.
* **mouse wheel**: change the scale of the traces.
* **double click**: select the nearest spike and center the view on it.

Screenshots
~~~~~~~~~~~
Expand All @@ -148,6 +160,33 @@ Screenshots
- .. image:: images/views/web/trace.png
:width: 100%

Trace Map View
--------------

This view shows the trace map of all the channels.

Controls
~~~~~~~~
* **x size (s)**: Set the time window size for the traces.
* **auto scale**: Automatically adjust the scale of the traces.
* **time (s)**: Set the time point to display traces.
* **mouse wheel**: change the scale of the traces.
* **double click**: select the nearest spike and center the view on it.

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

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

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

Waveform View
-------------

Expand All @@ -163,9 +202,11 @@ Controls
~~~~~~~~
* **mode** : change displaye mode (geometry or flatten)
* **ctrl + o** : toggle overlap mode
* **ctrl + p** : toggle plot waveform samples
* **mouse wheel** : scale waveform amplitudes
* **alt + mouse wheel** : widen/narrow x axis
* **shift + mouse wheel** : zoom
* **shift + alt + mouse wheel** : scale vertical spacing between channels

Screenshots
~~~~~~~~~~~
Expand Down Expand Up @@ -304,6 +345,7 @@ comparing the distribution of ampltidues to the noise levels.
Controls
~~~~~~~~
- **select** : activate lasso selection to select individual spikes
- **split** or **ctrl+s** : split the selected spikes into a new unit (only if one unit is visible)

Screenshots
~~~~~~~~~~~
Expand All @@ -327,6 +369,7 @@ Check deppth of spikes across the recording time or in a histogram.
Controls
~~~~~~~~
- **select** : activate lasso selection to select individual spikes
- **split** or **ctrl+s** : split the selected spikes into a new unit (only if one unit is visible)

Screenshots
~~~~~~~~~~~
Expand All @@ -342,32 +385,6 @@ Screenshots
- .. image:: images/views/web/spikedepth.png
:width: 100%

Trace Map View
--------------

This view shows the trace map of all the channels.

Controls
~~~~~~~~
* **x size (s)**: Set the time window size for the traces.
* **auto scale**: Automatically adjust the scale of the traces.
* **time (s)**: Set the time point to display traces.
* **mouse wheel**: change the scale of the traces.

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

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

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

Curation View
-------------

Expand Down Expand Up @@ -399,10 +416,10 @@ Screenshots
- .. image:: images/views/web/curation.png
:width: 100%

SpikeRateView View
------------------
Metrics View
------------

This view shows firing rate for spikes per `bin_s`.
View and explore unit metrics in a customizable grid of plots.

Screenshots
~~~~~~~~~~~
Expand All @@ -413,15 +430,22 @@ Screenshots

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

Metrics View
------------
Spike list View
---------------

View and explore unit metrics in a customizable grid of plots.
Show all spikes of the visible units. When spikes are selected, they are highlighted in the Spike Amplitude View and the ND SCatter View.
When a single spike is selected, the Trace and TraceMap Views are centered on it.

Controls
~~~~~~~~
* **↻ spikes**: refresh the spike list
* **clear**: clear the selected spikes
* **shift + arrow up/down** : select next/previous spike and make it visible alone

Screenshots
~~~~~~~~~~~
Expand All @@ -432,15 +456,34 @@ Screenshots

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

Main settings
-------------
Amplitude Scalings View
-----------------------

Overview and main controls
Amplitude scalings measure the optimal scaling which should be applied to the template so that
it best matches each spike waveform.

Controls
~~~~~~~~
- **select** : activate lasso selection to select individual spikes
- **split** or **ctrl+s** : split the selected spikes into a new unit (only if one unit is visible)

*Screenshots not available for this view.*

Main Template View
------------------

Display average template on main channel.
If the `template_metrics` are computed, it also displayed the template signal
used to compute metrics (usually upsampled) and the trough/peak_before/peak_after
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

Screenshots
~~~~~~~~~~~
Expand All @@ -451,8 +494,8 @@ Screenshots

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

23 changes: 22 additions & 1 deletion spikeinterface_gui/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def __init__(

t0 = time.perf_counter()

self._extremum_channel = get_template_extremum_channel(self.analyzer, peak_sign='neg', outputs='index')
self._extremum_channel = get_template_extremum_channel(self.analyzer,
mode="extremum", peak_sign='both', outputs='index')

# some direct attribute
self.num_segments = self.analyzer.get_num_segments()
Expand Down Expand Up @@ -722,6 +723,26 @@ def get_waveforms(self, unit_id):
# sparse waveforms
chan_inds = self.analyzer.sparsity.unit_id_to_channel_indices[unit_id]
return wfs, chan_inds

def get_template_upsampling_factor(self):
template_metrics_ext = self.analyzer.get_extension("template_metrics")
if template_metrics_ext is None or template_metrics_ext.params.get('upsampling_factor') is None:
return 1
else:
return template_metrics_ext.params['upsampling_factor']

def get_upsampled_templates(self, unit_id):
template_metrics_ext = self.analyzer.get_extension("template_metrics")
unit_index = list(self.unit_ids).index(unit_id)
chan_ind = self.get_extremum_channel(unit_id)
template = self.templates_average[unit_index, :, chan_ind]
if template_metrics_ext is None or "peaks_data" not in template_metrics_ext.data:
return template, None, None
else:
peaks_data = template_metrics_ext.data['peaks_data']
template_high = template_metrics_ext.data['main_channel_templates'][unit_index]
return template, template_high, peaks_data.loc[unit_id]


def get_common_sparse_channels(self, unit_ids):
sparsity_mask = self.get_sparsity_mask()
Expand Down
2 changes: 1 addition & 1 deletion spikeinterface_gui/layout_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_layout_description(preset_name, layout=None):
zone5=['probe'],
zone6=['ndscatter', 'similarity'],
zone7=['waveform', 'waveformheatmap', ],
zone8=['correlogram', 'isi', 'metrics', 'mainsettings'],
zone8=['correlogram', 'isi', 'metrics', 'maintemplate', 'mainsettings'],
)
_presets['default'] = default_layout

Expand Down
Loading