Skip to content

Commit

Permalink
piecewise spiketrain
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-langfield committed Aug 20, 2024
1 parent a0e8534 commit 11faf67
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/dartsort/util/hybrid_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,23 @@ def refractory_poisson_spike_train(

return spike_samples

def piecewise_refractory_poisson_spike_train(rates, bins, binsize_samples, **kwargs):
"""
Returns a spike train with variable firing rate using refractory_poisson_spike_train().
:param rates: list of firing rates in Hz
:param bins: bin starting samples (same shape as rates)
:param binsize_samples: number of samples per bin
:param **kwargs: kwargs to feed to refractory_poisson_spike_train()
"""
sp_tr = np.concatenate(
[
refractory_poisson_spike_train(r, binsize_samples, **kwargs) + bins[i] if r > 0.1 else []
for i, r in enumerate(rates)
]
)
return sp_tr


def precompute_displaced_registered_templates(
template_data: TemplateData,
Expand Down

0 comments on commit 11faf67

Please sign in to comment.