SpikeMonitor class
(Shortest import: from brian2 import SpikeMonitor)
- class brian2.monitors.spikemonitor.SpikeMonitor(*args, **kw)[source]
Bases:
EventMonitor
Record spikes from a
NeuronGroup
or other spike source.The recorded spikes can be accessed in various ways (see Examples below): the attributes
i
andt
store all the indices and spike times, respectively. Alternatively, you can get a dictionary mapping neuron indices to spike trains, by calling thespike_trains
method. If you record additional variables with thevariables
argument, these variables can be accessed by their name (see Examples).Attributes
The array of spike counts (length = size of target group)
Returns the total number of recorded spikes.
Methods
Return a dictionary mapping recorded variable names (including
t
) to a dictionary mapping neuron indices to arrays of variable values at the time of the spikes (sorted by time).Return a dictionary mapping neuron indices to arrays of spike times.
values
(var)Return a dictionary mapping neuron indices to arrays of variable values at the time of the spikes (sorted by time).
Details
- count
The array of spike counts (length = size of target group)
- num_spikes
Returns the total number of recorded spikes.
- all_values()[source]
Return a dictionary mapping recorded variable names (including
t
) to a dictionary mapping neuron indices to arrays of variable values at the time of the spikes (sorted by time). This is equivalent to (but more efficient than) callingvalues
for each variable and storing the result in a dictionary.