From 362ae3c5d1c986663999412259e961f131d890c4 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 2 Nov 2023 12:13:41 +0100 Subject: [PATCH 1/3] small generation --- src/spikeinterface/core/generate.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/spikeinterface/core/generate.py b/src/spikeinterface/core/generate.py index c670474f0e..3f7727c33f 100644 --- a/src/spikeinterface/core/generate.py +++ b/src/spikeinterface/core/generate.py @@ -146,6 +146,8 @@ def generate_sorting( The refractory period in ms add_spikes_on_borders : bool, default: False If True, spikes will be added close to the borders of the segments. + This is for testing some post-processing functions when they have + to deal with border spikes. num_spikes_per_border : int, default: 3 The number of spikes to add close to the borders of the segments. border_size_samples : int, default: 20 @@ -186,6 +188,7 @@ def generate_sorting( spikes_in_seg["segment_index"] = segment_index spikes.append(spikes_in_seg) + # if add_spikes_on_borders: spikes_on_borders = np.zeros(2 * num_spikes_per_border, dtype=minimum_spike_dtype) spikes_on_borders["segment_index"] = segment_index @@ -343,7 +346,7 @@ def synthesize_random_firings( The firing rate of each unit (in Hz). If float, all units will have the same firing rate. add_shift_shuffle: bool, default: False - Optionaly add a small shuffle on half spike to autocorrelogram + Optionaly add a small shuffle on half of the spikes to make the autocorrelogram less flat. seed: int, default: None seed for the generator @@ -382,8 +385,8 @@ def synthesize_random_firings( spike_times = rng.integers(0, segment_size, n) spike_times = np.sort(spike_times) + # make less flat autocorrelogram shape by jittering half of the spikes if add_shift_shuffle: - ## make an interesting autocorrelogram shape # this replace the previous rand_distr2() some = rng.choice(spike_times.size, spike_times.size // 2, replace=False) x = rng.random(some.size) @@ -391,7 +394,7 @@ def synthesize_random_firings( b = refractory_sample * 20 shift = a + (b - a) * x**2 spike_times[some] += shift - times0 = times0[(0 <= times0) & (times0 < N)] + times0 = times0[(0 <= times0) & (times0 < segment_size)] (violations,) = np.nonzero(np.diff(spike_times) < refractory_sample) spike_times = np.delete(spike_times, violations) From a849cebee098a861c9d0beea9e082db5113cd4f2 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 2 Nov 2023 12:26:09 +0100 Subject: [PATCH 2/3] Update src/spikeinterface/core/generate.py Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com> --- src/spikeinterface/core/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spikeinterface/core/generate.py b/src/spikeinterface/core/generate.py index 3f7727c33f..039f13c4ce 100644 --- a/src/spikeinterface/core/generate.py +++ b/src/spikeinterface/core/generate.py @@ -346,7 +346,7 @@ def synthesize_random_firings( The firing rate of each unit (in Hz). If float, all units will have the same firing rate. add_shift_shuffle: bool, default: False - Optionaly add a small shuffle on half of the spikes to make the autocorrelogram less flat. + Optionally add a small shuffle on half of the spikes to make the autocorrelogram less flat. seed: int, default: None seed for the generator From 33ed321f4c5a418ef2a3107b231812d3464ee7dd Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 2 Nov 2023 12:35:45 +0100 Subject: [PATCH 3/3] Update src/spikeinterface/core/generate.py Co-authored-by: Alessio Buccino --- src/spikeinterface/core/generate.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/spikeinterface/core/generate.py b/src/spikeinterface/core/generate.py index 039f13c4ce..69e043b640 100644 --- a/src/spikeinterface/core/generate.py +++ b/src/spikeinterface/core/generate.py @@ -188,7 +188,6 @@ def generate_sorting( spikes_in_seg["segment_index"] = segment_index spikes.append(spikes_in_seg) - # if add_spikes_on_borders: spikes_on_borders = np.zeros(2 * num_spikes_per_border, dtype=minimum_spike_dtype) spikes_on_borders["segment_index"] = segment_index