Skip to content

Recurrence quantification (RQA) for sway/trajectory analysis #357

Closed

Description

@alexarje

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).

🤖 Generated with Claude Code

Activity

  1. alexarje commented on Aug 24, 2026

    @alexarje
    ContributorAuthor

    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.

    Checked by running them, not by reading the API:

    this issue asked for where it is returns
    recurrence rate / determinism (RQA) micromotion.dynamics.rqa RR, DET, plus ENTR, Lmax, Lmean
    sway-axis rotation over a session micromotion.sway_geometry + micromotion.circular.axial_dispersion 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions