Skip to content

Improved trajectory_projector calculations through vectorization#542

Merged
awestphal1 merged 57 commits into
PedestrianDynamics:mainfrom
awestphal1:use_numpy_functions
Jun 2, 2026
Merged

Improved trajectory_projector calculations through vectorization#542
awestphal1 merged 57 commits into
PedestrianDynamics:mainfrom
awestphal1:use_numpy_functions

Conversation

@awestphal1
Copy link
Copy Markdown
Collaborator

Closes #518 #519 #520 #521

The trajectory_projector functions now have significantly better performance due to vectorization. Furthermore, I replaced large parts of the calculations with shapely and numpy methods. The functions now work directly on Shapely geometries, so a geo_data structure is no longer necessary.

The correct_invalid_trajectory function now also returns a list of all person IDs containing invalid trajectory points (similar to the outlier detection). This makes it possible to plot the modified trajectories before and after correction for easier comparison. I also added corresponding code to the preprocessing notebook.

awestphal1 and others added 30 commits November 13, 2025 11:34
Copy link
Copy Markdown
Collaborator

@schroedtert schroedtert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, have only looked at the latest three commits containing the changes for the vectorization improvement.

It would be great if you could move the shapely normalization to the constructor of the WalkableArea (#521 and see comment). And if you could take a look at the missed lines in the code coverage and construct test cases that would cover them.

Comment thread notebooks/preprocessing.ipynb
Comment thread notebooks/preprocessing.ipynb Outdated
Comment thread pedpy/preprocessing/trajectory_projector.py Outdated
Comment thread pedpy/preprocessing/trajectory_projector.py Outdated
Comment thread pedpy/preprocessing/trajectory_projector.py Outdated
Comment thread pedpy/preprocessing/trajectory_projector.py Outdated
Comment thread pedpy/preprocessing/trajectory_projector.py Outdated
Comment thread pedpy/preprocessing/trajectory_projector.py Outdated
Comment thread docs/source/images/invalid_trajectory_person_7_original.svg Outdated
Copy link
Copy Markdown
Collaborator

@JuleAdrian JuleAdrian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! The method does not appear in the API references.
I think we should make an entry in methods.rst.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 98.66071% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.01%. Comparing base (24d747a) to head (4a5b106).

Files with missing lines Patch % Lines
...edpy/preprocessing/trajectory_outlier_detection.py 98.61% 3 Missing ⚠️
pedpy/preprocessing/trajectory_projector.py 98.70% 3 Missing ⚠️

☔ View full report in Codecov by Sentry.
📢 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.

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.

Refactor correct_invalid_trajectories to use NumPy/Shapely helpers

3 participants