spiketools.sim.sim_spiketrain

spiketools.sim.sim_spiketrain(spike_param, n_samples, method, refractory=None, **kwargs)[source]

Simulate a spike train.

Parameters:
spike_paramfloat

Parameter value that controls the simulated spiking. For prob or binom methods, this is the probability of spiking. For poisson, this is the spike rate.

n_samplesint

The number of samples to simulate.

method{‘prob’, ‘binom’, ‘poisson’}

The method to use for the simulation.

refractoryint, optional

The refractory period to apply to the simulated data, in number of samples.

**kwargs

Additional keyword arguments. There are passed into the simulate function specified by method.

Returns:
spike_train1d array

Simulated spike train.

Examples

Simulate a spike train based on probability of spiking:

>>> spike_train = sim_spiketrain(0.1, 10, method='prob')

Simulate a spike train based on a Poisson distribution:

>>> spike_train = sim_spiketrain(5, 10, method='poisson')