UXsim icon indicating copy to clipboard operation
UXsim copied to clipboard

Analyzer: Add time_bin argument to area_to_pandas

Open EwoutH opened this issue 1 year ago • 15 comments

This PR introduces time-binned analysis capabilities to the link_to_pandas and area_to_pandas methods in the Analyzer class, while also addressing an issue with traffic volume calculation. These changes allow for more flexible, granular, and accurate analysis of traffic data over time.

Changes

  1. Added time_bin argument to link_to_pandas:

    • When time_bin is None, the method behaves as before.
    • When time_bin is specified, data is aggregated into time bins.
    • Performance is improved for time-binned analysis due to reduced iterations.
  2. Updated area_to_pandas to work with time-binned data:

    • Now uses the time-binned data from link_to_pandas when time_bin is specified.
    • Calculates area statistics for each time bin.
  3. Fixed traffic volume calculation in area_to_pandas:

    • Now correctly counts vehicles entering the area from outside.
    • Also counts vehicles starting their trip within the area.
    • Avoids double-counting vehicles passing through multiple links within the area.
  4. Data validation:

    • traffic_volume now represents the volume per bin instead of cumulative.
    • total_travel_time is calculated per bin, which is more logical for a binned approach.

Notes

  • The test suite has been updated to reflect the changes in traffic volume calculation.
  • The new approach provides a more accurate representation of traffic patterns over time.

Part of #120.

TODO

  • [x] Validate data
  • [x] Add argument to link_to_pandas
  • [x] Fix traffic volume calculation

EwoutH avatar Sep 14 '24 10:09 EwoutH