Skip to content

Commit

Permalink
Merge pull request #2152 from catalystneuro/fix_documentation_for_spi…
Browse files Browse the repository at this point in the history
…ke_generation

small generation.py doc fix
  • Loading branch information
alejoe91 authored Nov 2, 2023
2 parents 5b2d5bf + 33ed321 commit 6824b2d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/spikeinterface/core/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -343,7 +345,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
Optionally add a small shuffle on half of the spikes to make the autocorrelogram less flat.
seed: int, default: None
seed for the generator
Expand Down Expand Up @@ -382,16 +384,16 @@ 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)
a = refractory_sample
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)
Expand Down

0 comments on commit 6824b2d

Please sign in to comment.