StateMonitor class¶
(Shortest import: from brian2 import StateMonitor)
- class brian2.monitors.statemonitor.StateMonitor(*args, **kw)[source]¶
Bases:
Group,CodeRunnerRecord values of state variables during a run
To extract recorded values after a run, use the
tattribute for the array of times at which values were recorded, and variable name attribute for the values. The values will have shape(len(indices), len(t)), whereindicesare the array indices which were recorded. When indexing theStateMonitordirectly, the returned object can be used to get the recorded values for the specified indices, i.e. the indexing semantic refers to the indices insource, not to the relative indices of the recorded values. For example, when recording only neurons with even numbers,mon[[0, 2]].vwill return the values for neurons 0 and 2, whereasmon.v[[0, 2]]will return the values for the first and third recorded neurons, i.e. for neurons 0 and 4.Attributes
The array of recorded indices
The variables to record
Methods
Records a single time step.
reinit()resize(new_size)Details
- record¶
The array of recorded indices
- record_variables¶
The variables to record
- record_single_timestep()[source]¶
Records a single time step. Useful for recording the values at the end of the simulation – otherwise a
StateMonitorwill not record the last simulated values since itswhenattribute defaults to'start', i.e. the last recording is at the beginning of the last time step.