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, ...)cache_all_available_metrics
([verbose, ...])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)This metric retrieves the average household vehicle ownership from the synthetic population in the output
This metric is slow, memory heavy, broken after hdf5 migration and not used very often.
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=1, metrics_to_cache=None, skip_cache=False)#
- 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_file_sizes()#
- metric_polaris_exe()#
- metric_gaps()#
- static one_value(conn, query, default=0)#
- metric_population()#
- 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_activity_start_distribution()#
- metric_activity_rate_distribution()#
- metric_activity_duration_distribution()#
- metric_vmt_vht()#
- metric_ev_charging()#
- metric_vmt_vht_by_link()#
- metric_flow_density_fd()#
- 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()#
- metric_transit_experience()#
- network_gaps_by_x(x)#
- metric_network_gaps_by_link_type()#
- metric_network_gaps_by_hour()#
- metric_skim_stats()#
- metric_count_validation()#
- metric_rmse_vs_observed()#
- metric_calibration_act_gen()#
- metric_calibration_timing()#
- metric_calibration_destination()#
- metric_calibration_boardings()#
- metric_validation_speed()#
- metric_trip_length_distribution()#
- metric_activity_start_time_distributions()#
- m_etric_average_vehicle_ownership()#
This metric retrieves the average household vehicle ownership from the synthetic population in the output
- m_etric_traffic_cumulative_gap()#
This metric is slow, memory heavy, broken after hdf5 migration and not used very often. Renaming it to m_etric to remove it from auto-running.