From 8f2b0156e1952d9aaed4f9c3d9ffde64b3b00095 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:16:25 -0400 Subject: [PATCH 1/4] fix peak activity example --- .../modules_gallery/widgets/plot_4_peaks_gallery.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/modules_gallery/widgets/plot_4_peaks_gallery.py b/examples/modules_gallery/widgets/plot_4_peaks_gallery.py index 60733afb1d..be5d734ddc 100644 --- a/examples/modules_gallery/widgets/plot_4_peaks_gallery.py +++ b/examples/modules_gallery/widgets/plot_4_peaks_gallery.py @@ -2,7 +2,7 @@ Peaks Widgets Gallery ===================== -Some widgets are useful before sorting and works with "peaks" given by detect_peaks() +Some widgets are useful before sorting and works with the "peaks" given by the detect_peaks() function. They are useful to check drift before running sorters. @@ -21,14 +21,14 @@ ############################################################################## -# Lets filter and detect peak on it +# Let's filter and detect peaks on it from spikeinterface.sortingcomponents.peak_detection import detect_peaks -rec_filtred = si.bandpass_filter(rec, freq_min=300., freq_max=6000., margin_ms=5.0) +rec_filtred = si.bandpass_filter(recording=rec, freq_min=300., freq_max=6000., margin_ms=5.0) print(rec_filtred) peaks = detect_peaks( - rec_filtred, method='locally_exclusive', + recording=rec_filtred, method='locally_exclusive', peak_sign='neg', detect_threshold=6, exclude_sweep_ms=0.3, radius_um=100, noise_levels=None, @@ -46,12 +46,12 @@ # This "peaks" vector can be used in several widgets, for instance # plot_peak_activity() -si.plot_peak_activity(rec_filtred, peaks=peaks) +si.plot_peak_activity(recording=rec_filtred, peaks=peaks) ############################################################################## # can be also animated with bin_duration_s=1. -si.plot_peak_activity(rec_filtred, bin_duration_s=1.) +si.plot_peak_activity(recording=rec_filtred, peaks=peaks, bin_duration_s=1.) plt.show() From 332ee1f08c114cb32677f8e5654f5c1149705fe3 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:59:38 -0400 Subject: [PATCH 2/4] fix rec.recording in _plot_one_bin --- src/spikeinterface/widgets/peak_activity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spikeinterface/widgets/peak_activity.py b/src/spikeinterface/widgets/peak_activity.py index 24d4dc0df9..c31c1c0b76 100644 --- a/src/spikeinterface/widgets/peak_activity.py +++ b/src/spikeinterface/widgets/peak_activity.py @@ -120,7 +120,7 @@ def _plot_one_bin(self, rec, probe, peaks, duration, with_channel_ids, with_cont if with_contact_color: text_on_contact = None if with_channel_ids: - text_on_contact = self.recording.channel_ids + text_on_contact = rec.channel_ids from probeinterface.plotting import plot_probe From cb2da6c0a2f4315c6f789ea449c5ad28bf635892 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:19:10 -0400 Subject: [PATCH 3/4] add keywords and fix order of arguments --- src/spikeinterface/widgets/peak_activity.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/spikeinterface/widgets/peak_activity.py b/src/spikeinterface/widgets/peak_activity.py index c31c1c0b76..8501d7ef7d 100644 --- a/src/spikeinterface/widgets/peak_activity.py +++ b/src/spikeinterface/widgets/peak_activity.py @@ -95,13 +95,13 @@ def animate_func(i): i0, i1 = np.searchsorted(peaks["sample_index"], [bin_size * i, bin_size * (i + 1)]) local_peaks = peaks[i0:i1] artists = self._plot_one_bin( - rec, - probe, - local_peaks, - dp.with_channel_ids, - dp.bin_duration_s, - dp.with_contact_color, - dp.with_interpolated_map, + rec=rec, + probe=probe, + peaks=local_peaks, + duration=dp.bin_duration_s, + with_channel_ids=dp.with_channel_ids, + with_contact_color=dp.with_contact_color, + with_interpolated_map=dp.with_interpolated_map, ) return artists From aec80cc620239e0510255b3f485139f2e8c70198 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:36:15 -0400 Subject: [PATCH 4/4] try fixing animation for RTD --- examples/modules_gallery/widgets/plot_4_peaks_gallery.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/modules_gallery/widgets/plot_4_peaks_gallery.py b/examples/modules_gallery/widgets/plot_4_peaks_gallery.py index be5d734ddc..e3464dd1e8 100644 --- a/examples/modules_gallery/widgets/plot_4_peaks_gallery.py +++ b/examples/modules_gallery/widgets/plot_4_peaks_gallery.py @@ -48,6 +48,8 @@ si.plot_peak_activity(recording=rec_filtred, peaks=peaks) +plt.show() + ############################################################################## # can be also animated with bin_duration_s=1.