Registers a column in the data to be collected each period. Typically used in conjunction with the various reporter methods of Data
, but user functions can also be used with the @reporter
decorator.
Parameters
key — str, required
A unique name to refer to the column.
func — func(Model), required
A reporter function (such as one generated by
data.modelReporter()
ordata.agentReporter()
) that takes one argument, themodel
object, and returns a value to be entered in that period's row of the column.smooth — int, optional
Replaces the series with a decaying average for the purposes of visualization. Higher values smooth the data more strongly. The original data is recorded in a new column with the same name but postfixed with
-unsmooth
.Default value: None
Return Value — Reporter
The newly created Reporter
object. This object can also be accessed after the fact at model.data.reporters[key]
.
charwick
Aug 06, 2020 at 4:50Often reporter functions can be generated automatically. This line uses
Data.agentReporter()
to generate a reporter function that saves the average of the'wage'
property of'store'
-primitive agents to the'wage'
column of the data.Reporters can also be lambda functions.
Or regular functions (though in this case, the
@reporter
decorator is typically easier).