-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
@shankari as I had mentioned earlier today, trajectory_evaluation_timestamp_metric_selection and trajectory_evaluation_spatio_temporal are currently failing due to issues with the emeval.metrics.reference_trajectory module.
The error in the former notebook occurs at:
ref_tree = {}
coverage_list = []
coverage_list.extend(get_reference_coverage(pv_la, ref_tree))
coverage_list.extend(get_reference_coverage(pv_sj, ref_tree))
coverage_list.extend(get_reference_coverage(pv_ucb, ref_tree))
coverage_df = pd.DataFrame(coverage_list)and the stack trace is as follows:
ValueError Traceback (most recent call last)
<ipython-input-33-2252b9dd9ae9> in <module>
3 coverage_list.extend(get_reference_coverage(pv_la, ref_tree))
4 coverage_list.extend(get_reference_coverage(pv_sj, ref_tree))
----> 5 coverage_list.extend(get_reference_coverage(pv_ucb, ref_tree))
6
7 coverage_df = pd.DataFrame(coverage_list)
<ipython-input-31-95ac980592cc> in get_reference_coverage(pv, ref_tree_root)
74 ref_tree = get_reference_trajectory_tree(pv)
75 ref_tree_root[pv.spec_details.curr_spec["id"]] = ref_tree
---> 76 [fill_ref_tree_entry(e) for e in ref_tree.values()]
77 return get_coverage(pv, ref_tree)
<ipython-input-31-95ac980592cc> in <listcomp>(.0)
74 ref_tree = get_reference_trajectory_tree(pv)
75 ref_tree_root[pv.spec_details.curr_spec["id"]] = ref_tree
---> 76 [fill_ref_tree_entry(e) for e in ref_tree.values()]
77 return get_coverage(pv, ref_tree)
<ipython-input-31-95ac980592cc> in fill_ref_tree_entry(e)
49 # So the "latitude" and "longitude" here is actually in meters and the points can't be displayed directly
50 # TODO: figure out the best way to support both
---> 51 e["travel_forward_25"] = emr.ref_travel_forward(e, 25, tz=curr_tz)
52 e["travel_forward_50"] = emr.ref_travel_forward(e, 50, tz=curr_tz)
53 e["ct_midpoint_25"] = emr.ref_ct_general(e, emr.b_merge_midpoint, 25, tz=curr_tz)
~/mobilitynet-analysis-scripts/emeval/metrics/reference_trajectory.py in ref_travel_forward(e, dist_threshold, tz)
362 emd.to_geo_df(e["temporal_control"]["ios"]["location_df"]),
363 section_gt_shapes.filter(["start_loc","end_loc"]))
--> 364 new_location_df_a = get_int_aligned_trajectory(filtered_utm_loc_df_a, tz)
365 new_location_df_i = get_int_aligned_trajectory(filtered_utm_loc_df_b, tz)
366
~/mobilitynet-analysis-scripts/emeval/metrics/reference_trajectory.py in get_int_aligned_trajectory(location_df, tz)
41
42 def get_int_aligned_trajectory(location_df, tz="UTC"):
---> 43 lat_fn = sci.interp1d(x=location_df.ts, y=location_df.latitude)
44 lon_fn = sci.interp1d(x=location_df.ts, y=location_df.longitude)
45 # In order to avoid extrapolation, we use ceil for the first int and floor
~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/scipy/interpolate/interpolate.py in __init__(self, x, y, kind, axis, copy, bounds_error, fill_value, assume_sorted)
466 # Interpolation goes internally along the first axis
467 self.y = y
--> 468 self._y = self._reshape_yi(self.y)
469 self.x = x
470 del y, x # clean up namespace to prevent misuse; use attributes
~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/scipy/interpolate/polyint.py in _reshape_yi(self, yi, check)
109 self._y_extra_shape[:-self._y_axis])
110 raise ValueError("Data must be of shape %s" % ok_shape)
--> 111 return yi.reshape((yi.shape[0], -1))
112
113 def _set_yi(self, yi, xi=None, axis=None):
ValueError: cannot reshape array of size 0 into shape (0,newaxis)Here, it is clear that the error occurs in reference_trajectory's get_int_aligned_trajectory function (line 42).
For the latter notebook, the error occurs at:
ref_tree = {}
get_reference_trajectory_tree(pv_la, ref_tree)
get_reference_trajectory_tree(pv_sj, ref_tree)
get_reference_trajectory_tree(pv_ucb, ref_tree)with the following stack trace:
AttributeError Traceback (most recent call last)
<ipython-input-12-10e416badc4c> in <module>
2 get_reference_trajectory_tree(pv_la, ref_tree)
3 get_reference_trajectory_tree(pv_sj, ref_tree)
----> 4 get_reference_trajectory_tree(pv_ucb, ref_tree)
<ipython-input-11-00a6964e029f> in get_reference_trajectory_tree(pv, ref_tree_root)
55 curr_ref_tree = get_reference_trajectory_input_tree(pv)
56 ref_tree_root[pv.spec_details.CURR_SPEC_ID] = curr_ref_tree
---> 57 [fill_ref_tree_entry(pv, e) for e in curr_ref_tree.values()]
<ipython-input-11-00a6964e029f> in <listcomp>(.0)
55 curr_ref_tree = get_reference_trajectory_input_tree(pv)
56 ref_tree_root[pv.spec_details.CURR_SPEC_ID] = curr_ref_tree
---> 57 [fill_ref_tree_entry(pv, e) for e in curr_ref_tree.values()]
<ipython-input-11-00a6964e029f> in fill_ref_tree_entry(pv, e)
50 curr_tz = pv.spec_details.eval_tz
51 assert "android" in e["temporal_control"] and "ios" in e["temporal_control"]
---> 52 (e["reference_algo"], e["reference_df"]) = emr.final_ref_ensemble(e, 25, tz=curr_tz)
53
54 def get_reference_trajectory_tree(pv, ref_tree_root):
~/mobilitynet-analysis-scripts/emeval/metrics/reference_trajectory.py in final_ref_ensemble(e, dist_threshold, tz)
432 ct_stats = {
433 "coverage_density": coverage_density(ct_ref_df, e),
--> 434 "coverage_time": coverage_time(ct_ref_df, e),
435 "coverage_max_gap": coverage_max_gap(ct_ref_df, e)
436 }
~/mobilitynet-analysis-scripts/emeval/metrics/reference_trajectory.py in <lambda>(df, sr)
417
418 coverage_density = lambda df, sr: len(df)/(sr["end_ts"] - sr["start_ts"])
--> 419 coverage_time = lambda df, sr: (df.ts.iloc[-1] - df.ts.iloc[0])/(sr["end_ts"] - sr["start_ts"])
420 coverage_max_gap = lambda df, sr: df.ts.diff().max()/(sr["end_ts"] - sr["start_ts"])
421
~/miniconda3/envs/emissioneval/lib/python3.8/site-packages/pandas/core/generic.py in __getattr__(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.__getattribute__(self, name)
5275
5276 def __setattr__(self, name: str, value) -> None:
AttributeError: 'GeoDataFrame' object has no attribute 'ts'Here, final_ref_ensemble is the problematic function.
These errors need to be fixed for the above notebooks to work properly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working