Open nikolayilyin opened 8 months ago
Here is how reproduce the analysis with python notebook
import pandas as pd
def analyze_pte_last_link_travel_time(events_df):
ptes = events_df[(events_df['type'] == 'PathTraversal') & (events_df['linkTravelTime'].notna())].copy()
ptes['linkTravelTime_list'] = ptes.apply(lambda r: r['linkTravelTime'].split(","), axis=1)
ptes['linkTravelTime_last'] = ptes.apply(lambda r: r['linkTravelTime_list'][-1], axis=1)
def last_time_is(row):
if row['linkTravelTime_last'] == '0':
return '0'
if row['linkTravelTime_last'] == '-0':
return '-0'
return 'not_zero'
ptes['last_linkTravelTime_value'] = ptes.apply(last_time_is, axis=1)
return ptes
path_to_events_1 = "../beam_root/output/beamville/beamville-urbansimv2_input__2023-12-30_17-17-58_qze/ITERS/it.0/0.events.csv"
events = pd.read_csv(path_to_events_1)
ptes = analyze_pte_last_link_travel_time(events)
display(ptes.groupby('last_linkTravelTime_value')['mode'].value_counts().to_frame())
for beamville simulation the results looks like that:
Reproducible on production and beamville simulations.
For linkTravelTime, the last value often is equal to '0' or '-0', usually it is for bus PathTraversal events