spiketools.sim.utils.apply_refractory_train

spiketools.sim.utils.apply_refractory_train(spike_train, refractory_samples)[source]

Apply a refractory period to a simulated spike train.

Parameters:
spike_train1d array

Spike train.

refractory_samplesint

The duration of the refractory period, after a spike, in number of samples.

Returns:
spike_train1d array

Spike train, with refractory period applied.

Examples

Apply a 1-sample refractory period to a spike train:

>>> spike_train = np.array([0, 1, 1, 0, 0, 1, 1, 1, 0, 1])
>>> apply_refractory_train(spike_train, 1)
array([0, 1, 0, 0, 0, 1, 0, 1, 0, 1])