You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recurrence quantification (RQA) for sway/trajectory analysis #357
Candidate from the stillstanding study's spatiotemporal analyses: recurrence rate / determinism (RQA) on sway trajectories, plus sway-axis rotation-over-session and heading-persistence metrics. The existing implementation is tightly bound to that study's loaders — porting means extraction from scratch into _posture with synthetic known-answer tests (as done for SDA/DFA/SampEn in #352).
All three descriptors are in micromotion, and the last of them shipped today in 1.15.0. Markers are that package's domain under the four-toolbox rule and musicalgestures/_posture.py has been a re-export shim since 2026-07-29, so this closes with a pointer, as #356 and #358 did.
axis_deg per window; axial concentration across them
heading persistence
micromotion.heading_persistence
persistence, straightness
Two things worth knowing rather than discovering.
rqa solves its threshold per plot for a fixed recurrence rate rather than using a fixed absolute one, so recordings of different amplitude are comparable — which the study script this came from did not do.
Heading persistence reads backwards from the intuition. A sway that reverses along one line reads near +1, because it holds its heading through each excursion and turns only at the ends; standstill reads about 0.95. Reaching −1 takes a zigzag flipping at the sampling rate, which is a noise signature. Its docstring says so and a test pins it, because a reader who assumes "reversing means negative" would otherwise change the code to match. Two bugs in the first attempt were caught by those known-answer tests rather than by reading.
It is also acutely sensitive to how a series was brought to its sampling rate: a bare polyphase resample read 0.15 for two 120 Hz editions against 0.95 for the rest. Use micromotion.to_rate.
Import from micromotion directly._posture re-exports only the functions that used to live in MGT, so these are not reachable through it — that is deliberate and its docstring says so.
Activity
Design: the road to 2.0, and what order the open issues get closed in
alexarje commentedon Aug 24, 2026
All three descriptors are in micromotion, and the last of them shipped today in 1.15.0. Markers are that package's domain under the four-toolbox rule and
musicalgestures/_posture.pyhas been a re-export shim since 2026-07-29, so this closes with a pointer, as #356 and #358 did.Checked by running them, not by reading the API:
micromotion.dynamics.rqaRR,DET, plusENTR,Lmax,Lmeanmicromotion.sway_geometry+micromotion.circular.axial_dispersionaxis_degper window; axial concentration across themmicromotion.heading_persistencepersistence,straightnessTwo things worth knowing rather than discovering.
rqasolves its threshold per plot for a fixed recurrence rate rather than using a fixed absolute one, so recordings of different amplitude are comparable — which the study script this came from did not do.Heading persistence reads backwards from the intuition. A sway that reverses along one line reads near +1, because it holds its heading through each excursion and turns only at the ends; standstill reads about 0.95. Reaching −1 takes a zigzag flipping at the sampling rate, which is a noise signature. Its docstring says so and a test pins it, because a reader who assumes "reversing means negative" would otherwise change the code to match. Two bugs in the first attempt were caught by those known-answer tests rather than by reading.
It is also acutely sensitive to how a series was brought to its sampling rate: a bare polyphase resample read 0.15 for two 120 Hz editions against 0.95 for the rest. Use
micromotion.to_rate.Import from micromotion directly.
_posturere-exports only the functions that used to live in MGT, so these are not reachable through it — that is deliberate and its docstring says so.