miv_simulator.stgen#

Functions

get_inhom_poisson_spike_times_by_thinning(rate, t)

Given a time series of instantaneous spike rates in Hz, produce a spike train consistent with an inhomogeneous Poisson process with a refractory period after each spike.

shotnoise_fromspikes(spike_train, q, tau[, ...])

Convolves the provided spike train with shot decaying exponentials

Classes

StGen([rng, seed])

miv_simulator.stgen.get_inhom_poisson_spike_times_by_thinning(rate, t, dt=0.02, refractory=3.0, generator=None)[source]#

Given a time series of instantaneous spike rates in Hz, produce a spike train consistent with an inhomogeneous Poisson process with a refractory period after each spike. :type rate: ndarray :param rate: instantaneous rates in time (Hz) :type t: ndarray :param t: corresponding time values (ms) :type dt: float :param dt: temporal resolution for spike times (ms) :type refractory: float :param refractory: absolute deadtime following a spike (ms) :type generator: Optional[RandomState] :param generator: :class:’np.random.RandomState()’ :rtype: List[float64] :return: list of m spike times (ms)

miv_simulator.stgen.shotnoise_fromspikes(spike_train, q, tau, dt=0.1, t_start=None, t_stop=None, eps=1e-08)[source]#

Convolves the provided spike train with shot decaying exponentials yielding so called shot noise if the spike train is Poisson-like. Returns (shotnoise,t) as numpy arrays.

Inputs:

spike_train - a SpikeTrain object q - the shot jump for each spike tau - the shot decay time constant in milliseconds dt - the resolution of the resulting shotnoise in milliseconds t_start - start time of the resulting AnalogSignal If unspecified, t_start of spike_train is used t_stop - stop time of the resulting AnalogSignal If unspecified, t_stop of spike_train is used eps - a numerical parameter indicating at what value of the shot kernal the tail is cut. The default is usually fine.

Note:

Spikes in spike_train before t_start are taken into account in the convolution.

Examples:

>> stg = stgen.StGen() >> st = stg.poisson_generator(10.0,0.0,1000.0) >> g_e = shotnoise_fromspikes(st,2.0,10.0,dt=0.1)

See also:

poisson_generator, inh_adaptingmarkov_generator, OU_generator …