Skip to content

Add arithmetic Voronoi speed and alignment parameter calculations - #597

Open
M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:feat/arithmetic-voronoi-speed-and-alignment
Open

M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:feat/arithmetic-voronoi-speed-and-alignment

Conversation

@M-Colley

Copy link
Copy Markdown

Summary

Fixes #260
Fixes #522

Adds two velocity-based analysis functions to pedpy.methods.speed_calculator (and exports them at top level in pedpy):

  • compute_arithmetic_voronoi_speed (Compute arithmetic Voronoi speed #260): Computes the unweighted per-frame arithmetic mean speed {\mathrm{arithmetic}}(t) = \frac{1}{|P_M(t)|} \sum_{i \in P_M(t)} v_i(t)$ over all pedestrians (t)$ whose Voronoi cell intersects the measurement area with positive area ((V_i \cap M) > 0$, matching JPSreport and SpeedMethod.ARITHMETIC in profile_calculator.py).
  • compute_alignment_parameter (Calculate alignment parameter #522): Computes the per-frame directional alignment parameter $\phi_d(t) = \frac{1}{N(t)} \sum_{n=1}^{N(t)} \frac{\vec{v}_t^n \cdot \vec{u}_t^n}{|\vec{v}_t^n|} \in [-1, 1]$ from Feliciani et al. (2020, Scientific Reports, 10, 15947, doi:10.1038/s41598-020-72733-w), supporting desired unit vectors toward a target_point (e.g. exit door), a constant 2D desired_direction, or a per-pedestrian/per-frame desired_direction DataFrame, with optional measurement_area filtering and safe zero-speed handling.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.97%. Comparing base (0604d9a) to head (91fbce3).

Files with missing lines Patch % Lines
pedpy/methods/speed_calculator.py 90.76% 6 Missing ⚠️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calculate alignment parameter Compute arithmetic Voronoi speed

1 participant