SpikeGeneratorGroup class¶
(Shortest import: from brian2 import SpikeGeneratorGroup)
-
class
brian2.input.spikegeneratorgroup.SpikeGeneratorGroup(N, indices, times, dt=None, clock=None, period=0*second, when='thresholds', order=0, sorted=False, name='spikegeneratorgroup*', codeobj_class=None)[source]¶ Bases:
brian2.groups.group.Group,brian2.groups.group.CodeRunner,brian2.core.spikesource.SpikeSourceA group emitting spikes at given times.
Parameters: N : int
The number of “neurons” in this group
indices : array of integers
The indices of the spiking cells
times :
QuantityThe spike times for the cells given in
indices. Has to have the same length asindices.period :
Quantity, optionalIf this is specified, it will repeat spikes with this period. A period of 0s means not repeating spikes.
dt :
Quantity, optionalThe time step to be used for the simulation. Cannot be combined with the
clockargument.clock :
Clock, optionalThe update clock to be used. If neither a clock, nor the
dtargument is specified, thedefaultclockwill be used.when : str, optional
When to run within a time step, defaults to the
'thresholds'slot.order : int, optional
The priority of of this group for operations occurring at the same time step and in the same scheduling slot. Defaults to 0.
sorted : bool, optional
Whether the given indices and times are already sorted. Set to
Trueif your events are already sorted (first by spike time, then by index), this can save significant time at construction if your arrays contain large numbers of spikes. Defaults toFalse.Notes
- If
sortedis set toTrue, the given arrays will not be copied (only affects runtime mode)..
Attributes
_neuron_indexArray of spiking neuron indices. _previous_dtRemember the dt we used the last time when we checked the spike bins to not repeat the work for multiple runs with the same dt _spike_timeArray of spiking neuron times. _spikes_changed“Dirty flag” that will be set when spikes are changed after the before_runcheckspikesThe spikes returned by the most recent thresholding operation. Methods
before_run(run_namespace)Optional method to prepare the object before a run. set_spikes(indices, times[, period, sorted])Change the spikes that this group will generate. Details
-
_neuron_index¶ Array of spiking neuron indices.
-
_previous_dt¶ Remember the dt we used the last time when we checked the spike bins to not repeat the work for multiple runs with the same dt
-
_spike_time¶ Array of spiking neuron times.
-
_spikes_changed¶ “Dirty flag” that will be set when spikes are changed after the
before_runcheck
-
spikes¶ The spikes returned by the most recent thresholding operation.
-
set_spikes(indices, times, period=0*second, sorted=False)¶ Change the spikes that this group will generate.
This can be used to set the input for a second run of a model based on the output of a first run (if the input for the second run is already known before the first run, then all the information should simply be included in the initial
SpikeGeneratorGroupinitializer call, instead).Parameters: indices : array of integers
The indices of the spiking cells
times :
QuantityThe spike times for the cells given in
indices. Has to have the same length asindices.period :
Quantity, optionalIf this is specified, it will repeat spikes with this period. A period of 0s means not repeating spikes.
sorted : bool, optional
Whether the given indices and times are already sorted. Set to
Trueif your events are already sorted (first by spike time, then by index), this can save significant time at construction if your arrays contain large numbers of spikes. Defaults toFalse.
- If
Tutorials and examples using this¶
- Tutorial 3-intro-to-brian-simulations
- Example frompapers/Diesmann_et_al_1999
- Example frompapers/Izhikevich_2007
- Example frompapers/Stimberg_et_al_2018/example_3_io_synapse