Some standard types of NeuronGroup have already been defined. PoissonGroup and PoissonInput to generate spikes with Poisson statistics, PulsePacket to generate pulse packets with specified parameters, and SpikeGeneratorGroup to generate spikes which fire at prespecified times.
A group that generates independent Poisson spike trains.
Initialised as:
PoissonGroup(N,rates[,clock])
with arguments:
Adds a Poisson input to a NeuronGroup. Allows to efficiently simulate a large number of independent Poisson inputs to a NeuronGroup variable, without simulating every synapse individually. The synaptic events are generated randomly during the simulation and are not preloaded and stored in memory (unless record=True is used). All the inputs must target the same variable, have the same frequency and same synaptic weight. You can use as many PoissonInput objects as you want, even targetting a same NeuronGroup. There is the possibility to consider time jitter in the presynaptic spikes, and synaptic unreliability. The inputs can also be recorded if needed. Finally, all neurons from the NeuronGroup receive independent realizations of Poisson spike trains, except if the keyword freeze=True is used, in which case all neurons receive the same Poisson input.
Initialised as:
PoissonInput(target[, N][, rate][, weight][, state][, jitter][, reliability][, copies][, record][, freeze])
with arguments:
Fires a Gaussian distributed packet of n spikes with given spread
Initialised as:
PulsePacket(t,n,sigma[,clock])
with arguments:
Methods
This class is derived from SpikeGeneratorGroup and has all its methods as well as one additional method:
Change the parameters and/or generate a new pulse packet.
Emits spikes at given times
Initialised as:
SpikeGeneratorGroup(N,spiketimes[,clock[,period]])
with arguments:
Has an attribute:
Sample usages
The simplest usage would be a list of pairs (i,t):
spiketimes = [(0,1*ms), (1,2*ms)]
SpikeGeneratorGroup(N,spiketimes)
A more complicated example would be to pass a generator:
import random
def nextspike():
nexttime = random.uniform(0*ms,10*ms)
while True:
yield (random.randint(0,9),nexttime)
nexttime = nexttime + random.uniform(0*ms,10*ms)
P = SpikeGeneratorGroup(10,nextspike())
This would give a neuron group P with 10 neurons, where a random one of the neurons fires at an average rate of one every 5ms. Please note that as of 1.3.1, this behavior is preserved but will run slower than initializing with arrays, or lists.
Notes
Note that if a neuron fires more than one spike in a given interval dt, additional spikes will be discarded. A warning will be issued if this is detected.
Also, if you want to use a SpikeGeneratorGroup with many spikes and/or neurons, please use an initialization with arrays.
Also note that if you pass a generator, then reinitialising the group will not have the expected effect because a generator object cannot be reinitialised. Instead, you should pass a callable object which returns a generator. In the example above, that would be done by calling:
P = SpikeGeneratorGroup(10,nextspike)
Whenever P is reinitialised, it will call nextspike() to create the required spike container.
Emits spikes at given times
Warning
This function has been deprecated after Brian 1.3.1 and will be removed in a future release. Use SpikeGeneratorGroup instead. To convert spiketimes for MultipleSpikeGeneratorGroup into a form suitable for SpikeGeneratorGroup, do:
N = len(spiketimes)
spiketimes = [(i, t) for i in xrange(N) for t in spiketimes[i]]
Initialised as:
MultipleSpikeGeneratorGroup(spiketimes[,clock[,period]])
with arguments:
Note that if two or more spike times fall within the same dt, spikes will stack up and come out one per dt until the stack is exhausted. A warning will be generated if this happens.
Also note that if you pass a generator, then reinitialising the group will not have the expected effect because a generator object cannot be reinitialised. Instead, you should pass a callable object which returns a generator, this will be called each time the object is reinitialised by calling the reinit() method.
Sample usage:
spiketimes = [[1*msecond, 2*msecond]]
P = MultipleSpikeGeneratorGroup(spiketimes)