PopulationRateMonitor class¶
(Shortest import: from brian2 import PopulationRateMonitor)
-
class
brian2.monitors.ratemonitor.PopulationRateMonitor(*args, **kw)[source]¶ Bases:
brian2.groups.group.Group,brian2.groups.group.CodeRunnerRecord instantaneous firing rates, averaged across neurons from a
NeuronGroupor 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
CodeObjectclass to run code with.dtype : dtype, optional
The dtype to use to store the
ratevariable. 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 thewidthargument. Note that for the Gaussian window, thewidthparameter 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 thedtof the simulation, and nowidthargument can be specified. The given window will be automatically normalized to a sum of 1.width :
Quantity, optionalThe width of the
windowin seconds (for a predefined window).- Returns
rate :
QuantityThe 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
rateattribute and can be plotted against thePopulationRateMonitor‘stattribute.
Tutorials and examples using this¶
Example frompapers/Brunel_Wang_2001
Example frompapers/Brunel_Hakim_1999