Skip to content

Add Jupyter animation functions for trajectories and Voronoi cells - #596

Open
M-Colley wants to merge 2 commits into
PedestrianDynamics:mainfrom
M-Colley:feat/jupyter-trajectory-and-voronoi-animations
Open

M-Colley wants to merge 2 commits into
PedestrianDynamics:mainfrom
M-Colley:feat/jupyter-trajectory-and-voronoi-animations

Conversation

@M-Colley

Copy link
Copy Markdown

Summary

Fixes #550

Adds animate_trajectories and animate_voronoi_cells in pedpy.plotting.animation (re-exported at top level in pedpy) for interactive frame-by-frame visualization in Jupyter notebooks:

  • animate_trajectories: Renders pedestrian markers over an optional WalkableArea via matplotlib.animation.FuncAnimation, supporting adjustable marker size (marker_size / traj_frame_marker_size), frame subsampling (every_nth_frame), playback rate (fps), and scalar coloring from either an external analysis DataFrame (color_data + color_column) or an existing column in traj.data.
  • animate_voronoi_cells: Renders per-frame Voronoi polygons (and optional measurement-area intersections and pedestrian positions) colored by density, speed, or any scalar column.
  • Optional IPython dependency: Declares notebook = [ipython>=8.0] under [project.optional-dependencies] in pyproject.toml and raises a descriptive PedPyRuntimeError when as_html=True is called without ipython installed or outside an active notebook environment (while as_html=False returns the underlying FuncAnimation instance).
  • Documentation & tests: Added API reference entry in docs/source/api/plotting.rst, usage examples in notebooks/user_guide.ipynb, and unit tests in tests/unit_tests/plotting/test_animation.py.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.07%. Comparing base (0604d9a) to head (b5613ce).

☔ 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 animation functions for trajectories and Voronoi cells in Jupyter notebooks

1 participant