Repository navigation
fix(checks): duration-weight final_pose_speed and retain on sparse streams - #701
Conversation
|
806015b to
bb2c352
Compare
kstonekuan
left a comment
There was a problem hiding this comment.
Thanks, the overlap weighting is right and fixes both halves of #700. One change: drop the fallback to the last measured step. With overlap weighting, a sparse stream's final step already overlaps the window, so the fallback only fires when the final steps are unmeasurable (non-finite). Then it reports speed from earlier in the episode as the final pose. Omitting the measurement is the honest answer there. Please also add a test for that case.
|
Thanks very much for merging this pr looking forward to do more contribution |
Closes #700
Summary
final_pose_speedon low-frequency / sparse streams:final_window_maskpreviously matched against step start timestamps (profile.stamps_ns[:-1]), silently droppingfinal_pose_speedandfinal_pose_unsettled_ratiowhenever the step period exceededfinal_pose_window_s(e.g. 1 Hz streams with the default 0.5s window). Steps ending after the window start now represent the settling motion, with a fallback to the last measured step.final_pose_speed: previously computed using unweightednp.mean(profile.speeds[final_window_mask]), which violated HFlow's sampling-invariance principle and skewed under irregular sampling or jitter.final_speedis now weighted byprofile.step_durations_s, matchingmean_velocity.final_pose_speedmatchesmean_velocityidentically andfinal_pose_unsettled_ratioevaluates to1.0.tests/test_checks.pyverifying that low-frequency streams emitfinal_pose_speedand that duration weighting matchesmean_velocityon full-window episodes.Testing
uv run ruff check src/hflow/checks.py tests/test_checks.py(passes)uv run ruff format --check(passes)uv run ty check(passes)uv run pytest tests/test_checks.py -k trajectory_metrics(7 passed)uv run pytest -m "not slow" -q(2483 passed, 49 skipped)