PopulationRateMonitor class¶
(Shortest import: from brian2 import PopulationRateMonitor)

class
brian2.monitors.ratemonitor.
PopulationRateMonitor
(source, name='ratemonitor*', codeobj_class=None)[source]¶ Bases:
brian2.groups.group.Group
,brian2.groups.group.CodeRunner
Record instantaneous firing rates, averaged across neurons from a
NeuronGroup
or other spike source.Parameters: source : (
NeuronGroup
,SpikeSource
)The source of spikes to record.
name : str, optional
A unique name for the object, otherwise will use
source.name+'_ratemonitor_0'
, etc.codeobj_class : class, optional
The
CodeObject
class to run code with.Notes
Currently, this monitor can only monitor the instantaneous firing rates at each time step of the source clock. Any binning/smoothing of the firing rates has to be done manually afterwards.
Attributes
source
The group we are recording from Methods
reinit
()Clears all recorded rates resize
(new_size)smooth_rate
(self[, window, width])Return a smooth version of the population rate. Details

source
¶ The group we are recording from

smooth_rate
(self, window='gaussian', width=None)¶ Return a smooth version of the population rate.
Parameters: window : str, ndarray
The window to use for smoothing. Can be a string to chose a predefined window(
'flat'
for a rectangular, and'gaussian'
for a Gaussianshaped window). In this case the width of the window is determined by thewidth
argument. Note that for the Gaussian window, thewidth
parameter specifies the standard deviation of the Gaussian, the width of the actual window is4*width + dt
(rounded to the nearest dt). For the flat window, the width is rounded to the nearest odd multiple of dt to avoid shifting the rate in time. Alternatively, an arbitrary window can be given as a numpy array (with an odd number of elements). In this case, the width in units of time depends on thedt
of the simulation, and nowidth
argument can be specified. The given window will be automatically normalized to a sum of 1.width :
Quantity
, optionalThe width of the
window
in seconds (for a predefined window).Returns: rate :
Quantity
The population rate in Hz, smoothed with the given window. Note that the rates are smoothed and not rebinned, i.e. the length of the returned array is the same as the length of the
rate
attribute and can be plotted against thePopulationRateMonitor
‘st
attribute.

Tutorials and examples using this¶
 Example frompapers/Brunel_Hakim_1999