Skip to content

feat(preprocessing): add moving-average and Savitzky-Golay trajectory smoothing filters - #594

Open
M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:feat/trajectory-smoothing-filters
Open

M-Colley wants to merge 1 commit into
PedestrianDynamics:mainfrom
M-Colley:feat/trajectory-smoothing-filters

Conversation

@M-Colley

Copy link
Copy Markdown

Summary

Fixes #578
Fixes #577
Fixes #576

Adds first-class trajectory jitter-removal filters in pedpy.preprocessing.trajectory_smoother (re-exported from pedpy and included in all):

  • moving_average_filter (scipy.ndimage.uniform_filter1d + cumulative-sum adaptive borders)
  • savitzky_golay_filter (scipy.signal.savgol_filter with configurable odd window_size and polyorder)
  • SmoothingBorderMethod (ADAPTIVE, EXCLUDE, NEAREST, INTERP)

Highlights

  • Smooths x and y independently per pedestrian (id), ordered by rame, without ever mixing samples across pedestrians.
  • Supports optional ped_ids subset filtering while leaving unselected pedestrians untouched.
  • Retains all original pedestrian IDs, frame numbers, extra non-coordinate columns, regenerated point geometries, and rame_rate.
  • Emits a UserWarning and preserves the original trajectory when a pedestrian's trajectory is shorter than window_size.
  • Validates window_size and polyorder with descriptive PedPyTypeError / PedPyValueError exceptions.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.15068% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.09%. Comparing base (0604d9a) to head (20e39c4).

Files with missing lines Patch % Lines
pedpy/preprocessing/trajectory_smoother.py 93.10% 10 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.

Jitter removal with Savitzky-Golay filter Jitter removal with moving average Jitter removal

1 participant