Skip to content

Commit

Permalink
For connoisseur only: add a simple "ephyviewer" backend plot_traces().
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Sep 19, 2023
1 parent 2aabd14 commit 2d4f769
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/spikeinterface/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ def set_default_plotter_backend(backend):
"height_cm": "Height of the figure in cm (default 6)",
"display": "If True, widgets are immediately displayed",
},
"ephyviewer": {},
}

default_backend_kwargs = {
"matplotlib": {"figure": None, "ax": None, "axes": None, "ncols": 5, "figsize": None, "figtitle": None},
"sortingview": {"generate_url": True, "display": True, "figlabel": None, "height": None},
"ipywidgets": {"width_cm": 25, "height_cm": 10, "display": True},
"ephyviewer": {},
}


Expand Down
4 changes: 2 additions & 2 deletions src/spikeinterface/widgets/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def setUpClass(cls):
else:
cls.we_sparse = cls.we.save(folder=cache_folder / "mearec_test_sparse", sparsity=cls.sparsity_radius)

cls.skip_backends = ["ipywidgets"]
cls.skip_backends = ["ipywidgets", "ephyviewer"]

if ON_GITHUB and not KACHERY_CLOUD_SET:
cls.skip_backends.append("sortingview")
Expand Down Expand Up @@ -344,7 +344,7 @@ def test_sorting_summary(self):
# mytest.test_unit_locations()
# mytest.test_quality_metrics()
# mytest.test_template_metrics()
mytest.test_amplitudes()
# mytest.test_amplitudes()

# plt.ion()
plt.show()
26 changes: 26 additions & 0 deletions src/spikeinterface/widgets/traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,32 @@ def plot_sortingview(self, data_plot, **backend_kwargs):
backend_kwargs["display"] = False

self.url = handle_display_and_url(self, self.view, **backend_kwargs)

def plot_ephyviewer(self, data_plot, **backend_kwargs):
import ephyviewer
from ..preprocessing import depth_order

dp = to_attr(data_plot)

app = ephyviewer.mkQApp()
win = ephyviewer.MainViewer(debug=False, show_auto_scale=True)

for k, rec in dp.recordings.items():

if dp.order_channel_by_depth:
rec = depth_order(rec, flip=True)

sig_source = ephyviewer.SpikeInterfaceRecordingSource(recording=rec)
view = ephyviewer.TraceViewer(source=sig_source, name=k)
view.params['scale_mode'] = 'by_channel'
if dp.show_channel_ids:
view.params['display_labels'] = True
view.auto_scale()
win.add_view(view)

win.show()
app.exec()



def _get_trace_list(recordings, channel_ids, time_range, segment_index, order=None, return_scaled=False):
Expand Down

0 comments on commit 2d4f769

Please sign in to comment.