starling_sim.basemodel.output.kpi_output

Module Contents

Classes

KpiOutput

Attributes

KEY_TIME_RANGE

starling_sim.basemodel.output.kpi_output.KEY_TIME_RANGE = 'timeRange'
class starling_sim.basemodel.output.kpi_output.KpiOutput(population_names, kpi_list, kpi_name=None)
setup(filename, folder, simulation_model)

Setup method called during simulation setup.

Sets the values of out file and folder, and call setup for KPIs.

Parameters:
  • filename – .csv file

  • folder

  • simulation_model

Returns:

write_kpi_table()

Write the KPI of the population in the csv file obtained from out file attributes The KPIs evaluated are defined by the kpi_list attribute

build_kpi_table() pandas.DataFrame

Build the output KPI table.

KPIs from self.kpis are evaluated on each agent of each population from self.populations.

Returns:

KPI DataFrame

compute_agent_kpis(agent)

Build a DataFrame containing indicator evaluated on the given agent.

The DataFrame columns are defined by the KPIs keys attributes, with and additional column for the agent id, and an optional column for time profiling.

The DataFrame can contain several rows, for instance when KPIs are profiled by time.

Parameters:

agent – Agent on which KPIs are evaluated

Returns:

DataFrame containing indicators evaluated on the given agent