elephant.spike_train_generation.homogeneous_poisson_process¶
-
elephant.spike_train_generation.
homogeneous_poisson_process
(rate, t_start=array(0.) * ms, t_stop=array(1000.) * ms, as_array=False, refractory_period=None)[source]¶ Returns a spike train whose spikes are a realization of a Poisson process with the given rate, starting at time t_start and stopping time t_stop.
All numerical values should be given as Quantities, e.g. 100*pq.Hz.
Parameters: - ratepq.Quantity
The rate of the discharge.
- t_startpq.Quantity, optional
The beginning of the spike train. Default: 0 * pq.ms
- t_stoppq.Quantity, optional
The end of the spike train. Default: 1000 * pq.ms
- as_arraybool, optional
If True, a NumPy array of sorted spikes is returned, rather than a neo.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
Homogeneous Poisson process realization, stored in neo.SpikeTrain if as_array is False (default) and np.ndarray otherwise.
Raises: - ValueError
If one of rate, t_start and t_stop is not of type pq.Quantity.
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.
Examples
>>> import quantities as pq >>> spikes = homogeneous_poisson_process(50*pq.Hz, t_start=0*pq.ms, ... t_stop=1000*pq.ms) >>> spikes = homogeneous_poisson_process( ... 20*pq.Hz, t_start=5000*pq.ms, t_stop=10000*pq.ms, as_array=True) >>> spikes = homogeneous_poisson_process(50*pq.Hz, t_start=0*pq.ms, ... t_stop=1000*pq.ms, refractory_period = 3*pq.ms)