PopulationRateMonitor class
(Shortest import: from brian2 import PopulationRateMonitor)
- class brian2.monitors.ratemonitor.PopulationRateMonitor(*args, **kw)[source]
Bases:
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.dtype : dtype, optional
The dtype to use to store the
rate
variable. Defaults tofloat64
, i.e. double precision.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
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 Gaussian-shaped 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 re-binned, 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_2000
Example frompapers/Brunel_Hakim_1999
Example frompapers/Brunel_Wang_2001
Example frompapers/Wang_2002
Example synapses/spike_based_homeostasis