Reference 〉Function

Helipad.addEvent( str name, int|func(model) fn, bool repeat = False, mixed **kwargs )

Registers an Event. When triggered, an event marks the plot area with a vertical line and stores the data output at that time. The image to the right shows 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.


  • name str, required

    The name of the event for future reference.

  • fn 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 the modelPostStep hook.

  • repeat bool, optional

    Whether the event should trigger once, or every time the criterion is satisfied.

    Default value: False

  • **kwargs mixed, 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 takes color, linestyle, and linewidth arguments to customize its appearance.

    Default value: {}

Return Value Event

The newly created Event object.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.