Skip to content

fix(readers): take a native file's horizontal plane in cyclic axis order (SP5 item 4) - #160

Merged
mbel-tech merged 2 commits into
mainfrom
fatina-del-codice/sp5-item4-handedness
Oct 11, 2026
Merged

mbel-tech merged 2 commits into
mainfrom
fatina-del-codice/sp5-item4-handedness

Conversation

@mbel-tech

Copy link
Copy Markdown
Owner

What and why

Item 4 of SP5 (finding 9, handedness), per the design note (merged in #156, section 5) and the requester's decision to fix it. Independent of #157-#159.

native3d.horizontal_axes returned the two non-vertical axes in file order. For vertical_axis = "y" that is (x, z), the mirror image of the right-handed (z, x). Magnitudes (distances, speeds, |dtheta|) were unaffected, but any signed quantity was reflected: IL-11's mean_heading_rad (theta became pi/2 - theta) and the sign of left_right_turn_bias.

  • horizontal_axes now returns the two axes in cyclic order after the vertical one: z -> (x, y), x -> (y, z), y -> (z, x). In that order first x second = up, so the plane is right-handed seen from above.
  • Correction to the design note: the note said vertical_axis of x or y was mirrored. Only y was: for x the file order (y, z) was already cyclic (those test cases passed before the fix). Behaviour changes only for files read with vertical_axis = y; z (the default) and x are unchanged.
  • flip still reverses the vertical axis alone, which also mirrors the view from above. Not changed here (documented limit; the Known Issues wording is SP6).
  • The user guide's native-3D section describes the plane order.

Test plan

In tests/test_readers/test_native3d.py (written first; the y cases failed, the x and z ones passed): horizontal_axes values; a right-handedness property test (first cross second = up) for each axis; and an invariance test that rotates one physical track by the proper (cyclic) rotation for each vertical axis and requires the reader to return the identical horizontal track. The reader tests for Anipose and DeepLabCut 3-D that pinned the old (x, z) order for y now expect (z, x).

  • Full suite, Qt included: 4477 passed, 24 skipped, 0 failed.
  • ruff check passes.

Checklist

  • Tests added or updated (written before the fix)
  • ruff check passes
  • Docs updated if behaviour changed: user guide native-3D section
  • CHANGELOG.md entry under [Unreleased] (says which values change and for which files)

🤖 Generated with Claude Code

https://claude.ai/code/session_012btUjvTQTf6i51Rpr3t8Hc


Generated by Claude Code

horizontal_axes returned the two non-vertical axes in file order, so vertical_axis = y gave
(x, z), the mirror image of the right-handed (z, x). Magnitudes were unaffected, but signed
quantities (IL-11's mean heading, the sign of left_right_turn_bias) were reflected. The plane is
now taken in cyclic order after the vertical axis (z: x,y; x: y,z; y: z,x). z (the default) and x
are unchanged; only files read with y change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012btUjvTQTf6i51Rpr3t8Hc
Keeps all CHANGELOG bullets; the guide paragraph merged cleanly (plane order and axis rule).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012btUjvTQTf6i51Rpr3t8Hc
@mbel-tech
mbel-tech merged commit ca83cc5 into main Oct 11, 2026
7 checks passed
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.

2 participants