Skip to content

Add single-file 1D density calculation and optimize Voronoi profile intersections - #599

Open
M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:feat/single-file-1d-density-and-profile-masking
Open

M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:feat/single-file-1d-density-and-profile-masking

Conversation

@M-Colley

Copy link
Copy Markdown

Summary

Fixes #182
Fixes #67

Adds 1D single-file trajectory density analysis and optimizes 2D profile intersection calculations for non-rectangular geometries:

  • Single-file 1D density (Add function to compute densities in Singlefile trajectories #182): Adds SingleFileMethod (VORONOI and HEADWAY) and compute_single_file_density in pedpy.methods.density_calculator (exported in pedpy), supporting projection along x, y, or an arbitrary shapely.LineString centerline, open corridors as well as periodic oval/circular loops (closed=True, track_length), and optional per-frame 1D section density via measurement_interval=(s_min, s_max).
  • Profile grid optimization (Optimize profile calculation #67): Pre-filters grid cells whose interiors overlap walkable_area.polygon (shapely.intersects & ~shapely.touches) once before the frame loop and indexes active cells with shapely.STRtree so cells outside non-rectangular geometries (e.g. corners, T-junctions, bottlenecks) and disjoint cell-polygon pairs are skipped while preserving the full (rows, cols) output shape expected by plot_profiles. Also vectorizes get_grid_cells box construction.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.02454% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.84%. Comparing base (0604d9a) to head (b71cf04).

Files with missing lines Patch % Lines
pedpy/methods/density_calculator.py 90.90% 10 Missing ⚠️
pedpy/methods/profile_calculator.py 94.33% 3 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.

Add function to compute densities in Singlefile trajectories Optimize profile calculation

1 participant