Registers an Event. When triggered, an event stores the data output at that time and registers on the visualizer. TimeSeries
, for example, draws a vertical line on the plots (see the image to the right), and Charts
will flash the background. In the image to the right there are two events, marking the increase and leveling off of population.
This function is aliased by the @heli.event
decorator, which is generally the preferred syntax.
Parameters
name — str, required
The name of the event for future reference.
function — int|func(model), required
A timestamp at which to trigger the event, or a function that takes the model object and returns a boolean,
True
when the event is to be triggered. The function runs at the end of each period, immediately after data collection but before themodelPostStep
hook.repeat — bool, optional
Whether the event should trigger once, or every time the criterion is satisfied.
Default value: False
**kwargs — optional
Further options to be passed to the visualizer's
event()
method.TimeSeries.event()
, for example, draws a vertical line on the plot area, and takescolor
,linestyle
, andlinewidth
arguments to customize its appearance.Default value: {}
Return Value — Event
The newly created Event
object.
Notes and Examples