SpikeQueue class
(Shortest import: from brian2.synapses.spikequeue import SpikeQueue)
- class brian2.synapses.spikequeue.SpikeQueue(source_start, source_end)[source]
Bases:
object
Data structure saving the spikes and taking care of delays.
- Parameters:
source_start : int
The start of the source indices (for subgroups)
source_end : int
The end of the source indices (for subgroups)
Notes :
—– :
**Data structure** :
A spike queue is implemented as a 2D array `X` that is circular in the time :
direction (rows) and dynamic in the events direction (columns). The :
row index corresponding to the current timestep is `currentime`. :
Each element contains the target synapse index. :
**Offsets** :
Offsets are used to solve the problem of inserting multiple synaptic events :
with the same delay. This is difficult to vectorise. If there are n synaptic :
events with the same delay, these events are given an offset between 0 and :
n-1, corresponding to their relative position in the data structure. :
Attributes
The dt used for storing the spikes (will be set in
prepare
)The end of the source indices (for subgroups)
The start of the source indices (for subgroups)
The current time (in time steps)
number of events in each time step
Methods
advance
()Advances by one timestep
peek
()Returns the all the synaptic events corresponding to the current time, as an array of synapse indexes.
prepare
(delays, dt, synapse_sources)Prepare the data structures
push
(sources)Push spikes to the queue.
Details
- _source_end
The end of the source indices (for subgroups)
- _source_start
The start of the source indices (for subgroups)
- currenttime
The current time (in time steps)
- n
number of events in each time step
- peek()[source]
Returns the all the synaptic events corresponding to the current time, as an array of synapse indexes.
- prepare(delays, dt, synapse_sources)[source]
Prepare the data structures
This is called every time the network is run. The size of the of the data structure (number of rows) is adjusted to fit the maximum delay in
delays
, if necessary. A flag is set if delays are homogeneous, in which case insertion will use a faster method implemented ininsert_homogeneous
.