polaris.analyze.result_kpis.ResultKPIs#
- class polaris.analyze.result_kpis.ResultKPIs(inputs: PolarisInputs, cache_dir: Path, population_scale_factor: float, include_kpis: Tuple[KPITag, ...], exclude_kpis: Tuple[KPITag, ...] = (KPITag.HIGH_MEMORY, KPITag.BROKEN))#
Bases:
objectThis 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, include_kpis: Tuple[KPITag, ...], exclude_kpis: Tuple[KPITag, ...] = (KPITag.HIGH_MEMORY, KPITag.BROKEN))#
Methods
__init__(inputs, cache_dir, ...[, exclude_kpis])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
metric_freight_mode_trade_type(**kwargs)This metric is slow, memory heavy, broken after hdf5 migration and not used very often.
metric_vehicle_technology(**kwargs)one_value(conn, query[, default])Attributes
- result_time_step = 3600#
- __init__(inputs: PolarisInputs, cache_dir: Path, population_scale_factor: float, include_kpis: Tuple[KPITag, ...], exclude_kpis: Tuple[KPITag, ...] = (KPITag.HIGH_MEMORY, KPITag.BROKEN))#
- 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, include_kpis: Tuple[KPITag, ...] = (KPITag.SYSTEM, KPITag.POPULATION, KPITag.ACTIVITIES, KPITag.TRIPS, KPITag.TNC, KPITag.TRAFFIC, KPITag.TRANSIT, KPITag.VEHICLES, KPITag.CALIBRATION, KPITag.VALIDATION, KPITag.CONVERGENCE, KPITag.GLOBAL, KPITag.PARKING, KPITag.FREIGHT), exclude_kpis: Tuple[KPITag, ...] = (KPITag.HIGH_MEMORY, KPITag.BROKEN))#
- cache_all_available_metrics(verbose=False, 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_ev_consumption()#
- metric_vmt_vht_by_link()#
- metric_flow_density_fd()#
- metric_activity_distances()#
- metric_vehicle_technology(**kwargs)#
- 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_planned_rmse_vs_observed()#
- metric_calibration_act_gen()#
- metric_calibration_act_gen_planned()#
- metric_calibration_timing()#
- metric_calibration_timing_planned()#
- metric_calibration_destination()#
- metric_calibration_boardings()#
- metric_validation_speed()#
- metric_trip_length_distribution()#
- metric_trip_costs()#
- metric_activity_start_time_distributions()#
- metric_planned_activity_start_time_distributions()#
- metric_county_to_county_demand()#
- metric_average_vehicle_ownership()#
This metric retrieves the average household vehicle ownership from the synthetic population in the output
- metric_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.
- metric_spatial_trips()#
- metric_sov_parking_access_time()#
- metric_escooter_utilization_at_garage()#
- metric_parking_utilization()#
- metric_garage_access_w_escooters()#
- metric_parking_stats()#
- metric_parking_delay_stats()#
- metric_freight_shipping_cost()#
- metric_freight_mode_trade_type(**kwargs)#
- metric_freight_trip()#
- metric_freight_distance_distribution()#