Reference 〉Class

Data( Helipad model )

The Data class is an interface for all the data to be collected during a model’s run. The object is subscriptable: data[key] will return the column of the data labelled key.

This class should not be instantiated by user code; it is initialized during model setup and stored as

Initialization Parameters

  • model Helipad, required

    The model object.


Click a method name for more detailed documentation.

  • removeReporter( key )

    Removes a column and its subsidiaries (e.g. percentiles) from the data collection, stops its reporter, and removes any associated series. This function should not be used while a model is active.

  • reset( )

    Clears all model data. Generally used to clean up between model runs. This function takes no arguments.

  • saveCSV( filename )

    Outputs the model's data to a CSV file in the same directory as the running program.

  • getLast( key, n )

    Returns the latest recorded value or values from the model's data.

  • collect( model )

    Iterates over all the registered reporters and collects model data each period.

    This function is called from model.step() and should not be called from user code.

  • agentReporter( key, prim, breed, … )

    Generates a reporter function that takes the model object and returns a summary statistic over all the values of an agent property.

  • modelReporter( key )

    Generates a reporter function that takes the model object and returns the named attribute of the model.

  • addReporter( key, func, smooth )

    Registers a column in the data to be collected each period. Typically used in conjunction with the various reporter methods of the Data class, but open-ended user functions can also be used with the @reporter decorator.


  • all dict

    Where the model data is stored during runtime. Keys correspond to registered reporters. See data.addReporter().

    Initial value: {}

  • dataframe Pandas.DataFrame

    A Pandas dataframe with the model run data. Useful for statistical functions.

    Initial value: Pandas.DataFrame({})

  • reporters dict

    Contains information about registered data reporters; instructions on how to populate the various columns of data.all as the model runs. See data.addReporter().

    Initial value: {}


Click a hook name for more detailed documentation.

  • dataCollect( data, t )

    Runs at the end of each model step immediately before the period's data is collected.

    If you need a hook immediately after data is collected, use modelPostStep and access the Data object with

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.