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 and t store all the indices and spike times, respectively. Alternatively, you can get a dictionary mapping neuron indices to spike trains, by calling the spike_trains method. If you record additional variables with the variables argument, these variables can be accessed by their name (see Examples).

Attributes

count

The array of spike counts (length = size of target group)

num_spikes

Returns the total number of recorded spikes.

Methods

all_values()

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).

spike_trains()

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) calling values for each variable and storing the result in a dictionary.

spike_trains()[source]

Return a dictionary mapping neuron indices to arrays of spike times.

values(var)[source]

Return a dictionary mapping neuron indices to arrays of variable values at the time of the spikes (sorted by time).