elephant.spike_train_generation.inhomogeneous_poisson_process

elephant.spike_train_generation.inhomogeneous_poisson_process(rate, as_array=False, refractory_period=None)[source]

Returns a spike train whose spikes are a realization of an inhomogeneous Poisson process with the given rate profile.

Parameters:
rateneo.AnalogSignal

A neo.AnalogSignal representing the rate profile evolving over time. Its values have all to be >=0. The output spiketrain will have t_start = rate.t_start and t_stop = rate.t_stop

as_arraybool, optional

If True, a NumPy array of sorted spikes is returned, rather than a SpikeTrain object. Default: False

refractory_periodpq.Quantity or None, optional

pq.Quantity scalar with dimension time. The time period after one spike no other spike is emitted. Default: None

Returns:
spiketrainneo.SpikeTrain or np.ndarray

Inhomogeneous Poisson process realization, of type neo.SpikeTrain if as_array is False (default) and np.ndarray otherwise.

Raises:
ValueError

If rate contains a negative value.

If refractory_period is not None or not of type pq.Quantity.

If refractory_period is not None and the period between two successive spikes (1 / rate) is smaller than the refractory_period.