Skip to content

feat(review): measure heatmap and zones from chosen keypoints - #242

Merged
gbradham merged 1 commit into
mainfrom
feat/review-keypoint-subset
Nov 3, 2026
Merged

gbradham merged 1 commit into
mainfrom
feat/review-keypoint-subset

Conversation

@gbradham

@gbradham gbradham commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Session review measured the heatmap and time-in-zone from the centroid only. For novel-object investigation that is the wrong point: the body sits beside the object while the head investigates it.

  • Right-click the Heatmap or Zones toggle to choose the keypoints: Centroid (all keypoints) (default), one keypoint, or several.
  • Several keypoints: the heatmap bins their mean (e.g. head = nose + ears). A zone holds the animal when any chosen keypoint is inside it, so a nose reaching into an object's zone counts. A frame counts as dropped only when every chosen keypoint is missing.
  • Applies to the zone table, the heatmap overlay and its PNG/CSV export, and the per-zone columns in the cohort export.
  • Saved per keypoint set, like the Distances pairs. Names a session lacks are dropped, so a stale choice falls back to the centroid instead of blanking the zones.
  • The zone table title names the choice, e.g. ZONES (2) · nose + l_ear + r_ear.

spatial.position_track / tracking_frame / zone_occupancy / occupancy_grid now accept a list of keypoint names for point. String values behave as before.

Test plan

  • 11 new tests in test_spatial.py (mean position, dropped keypoints, any-inside zone rule, head-out/body-in, occupancy, heatmap)
  • 5 new tests in test_analysis_window.py (default, menu, toggling, persistence, wiring to zones and heatmap)
  • tests/unit/analysis, tests/unit/gui/review, tests/unit/gui/behavior: 2382 passed, 6 skipped
  • ruff, black
  • Try it in the app on a novel-object session

Right-click the Heatmap or Zones toggle to pick the keypoints session review
measures position from: the centroid (default), one keypoint, or several.
With several, the heatmap bins their mean (e.g. the head from nose + ears)
and a zone holds the animal when any chosen keypoint is inside it, so a nose
reaching into a novel object's zone counts.

The choice is saved per keypoint set, applies to the zone table, heatmap
export and cohort zone columns, and is named on the zone table title.
@gbradham
gbradham merged commit 0d1d724 into main Nov 3, 2026
4 checks passed
@gbradham
gbradham deleted the feat/review-keypoint-subset branch November 3, 2026 20:40
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.

1 participant