polaris.analyze.result_kpis.ResultKPIs

Contents

polaris.analyze.result_kpis.ResultKPIs#

class polaris.analyze.result_kpis.ResultKPIs(inputs: PolarisInputs, cache_dir: Path, population_scale_factor: float)#

Bases: object

This class provides an easy way to extract relevant metrics for a single simulation run of POLARIS. The easiest way to generate an instance is via the factory method from_iteration which takes the path to the outputs of a simulation run (or a ConvergenceIteration())

from polaris.analyze.result_kpi import ResultKPIs

kpis = ResultKPIs.from_iteration(ref_project_dir / f"{city}_iteration_2")

Metric comparison plots can then be generated in a notebook using:

results = KpiComparator()
results.add_run(kpis, 'an-arbitrary-label')
results.plot_mode_share()
results.plot_vmt()
results.plot_vmt_by_link_type()

Any number of runs can be added using add_run up to the limit of readability on the generated plots.

__init__(inputs: PolarisInputs, cache_dir: Path, population_scale_factor: float)#

Methods

__init__(inputs, cache_dir, ...)

available_metrics()

cache_all_available_metrics([verbose, ...])

cached_metrics()

close()

from_args(files, iteration_dir[, ...])

from_dir(iteration_dir, **kwargs)

Create a KPI object from a given directory.

from_iteration(iteration, **kwargs)

Create a KPI object from a ConvergenceIteration object.

get_cached_kpi_value(kpi_name[, skip_cache, ...])

get_kpi_value(kpi_name)

has_cached_kpi(kpi_name)

load_link_types()

metric_activity_distances()

metric_activity_duration_distribution()

metric_activity_rate_distribution()

metric_activity_start_distribution()

metric_activity_start_time_distributions()

metric_avo_by_tnc_operator()

metric_calibration_act_gen()

metric_calibration_destination()

metric_calibration_mode_share()

metric_calibration_timing()

metric_distance_by_act_type()

metric_ev_charging()

metric_executed_activity_mode_share_by_income()

metric_executed_modes()

metric_gaps()

metric_mode_shares()

metric_network_gaps_by_hour()

metric_network_gaps_by_link_type()

metric_num_adults()

metric_num_employed()

metric_num_hh()

metric_num_hh_by_hh_size()

metric_num_persons_by_age_band_10()

metric_num_persons_by_age_band_5()

metric_planned_modes()

metric_population()

metric_rmse_vs_observed()

metric_road_pricing()

metric_skim_stats()

metric_summary()

metric_tnc_request_stats()

metric_tnc_stats()

metric_tnc_trip_stats()

metric_traffic_cumulative_gap()

metric_transit_boardings()

metric_trip_length_distribution()

metric_tts()

metric_vehicle_technology()

metric_vmt_vht()

metric_vmt_vht_by_link()

network_gaps_by_x(x)

one_value(conn, query[, default])

Attributes

result_time_step = 3600#
__init__(inputs: PolarisInputs, cache_dir: Path, population_scale_factor: float)#
classmethod from_iteration(iteration: ConvergenceIteration, **kwargs)#

Create a KPI object from a ConvergenceIteration object.

classmethod from_dir(iteration_dir: Path, **kwargs)#

Create a KPI object from a given directory.

classmethod from_args(files: PolarisInputs, iteration_dir: Path, cache_name: str = 'kpi.cache', clear_cache=False, exit_if_no_cache=False, population_scale_factor=None)#
cache_all_available_metrics(verbose=True, metrics_to_cache=None)#
classmethod available_metrics()#
close()#
get_kpi_value(kpi_name)#
get_cached_kpi_value(kpi_name, skip_cache=False, force_cache=False)#
has_cached_kpi(kpi_name)#
cached_metrics()#
metric_summary()#
metric_gaps()#
static one_value(conn, query, default=0)#
metric_population()#
metric_num_adults()#
metric_num_employed()#
metric_num_persons_by_age_band_5()#
metric_num_persons_by_age_band_10()#
metric_num_hh()#
metric_num_hh_by_hh_size()#
metric_tts()#
metric_distance_by_act_type()#
metric_planned_modes()#
metric_executed_modes()#
metric_mode_shares()#
metric_executed_activity_mode_share_by_income()#
metric_activity_start_distribution()#
metric_activity_rate_distribution()#
metric_activity_duration_distribution()#
metric_vmt_vht()#
metric_ev_charging()#
metric_activity_distances()#
metric_vehicle_technology()#
metric_tnc_request_stats()#
metric_tnc_trip_stats()#
metric_tnc_stats()#
metric_avo_by_tnc_operator()#
metric_road_pricing()#
metric_transit_boardings()#
network_gaps_by_x(x)#
metric_network_gaps_by_hour()#
metric_skim_stats()#
metric_rmse_vs_observed()#
metric_calibration_act_gen()#
metric_calibration_mode_share()#
metric_calibration_timing()#
metric_calibration_destination()#
metric_trip_length_distribution()#
metric_activity_start_time_distributions()#
metric_traffic_cumulative_gap()#