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
Commit 547ceee
Browse filesBrowse the repository at this point in the historyBrowse files
"Integrate 3-D movement" is four independent projects. Each gets its own spec, plan and
8
+
build cycle.
9
+
10
+
|| Sub-project | Needs first |
11
+
|---|---|---|
12
+
|**C**|**Side-view depth**: a camera-view setting and a continuous vertical-position metric from ordinary 2-D side recordings | nothing unmerged, no 3-D data |
13
+
| A | Read 3-D tracker files (Anipose pose-3d CSV, DLC-3D). Metrics run on a chosen plane and z is stored (D-031 as written) |`feat/native-units` merged |
14
+
| B | Metrics that use z: 3-D speed and path length, vertical position, 3-D neighbour distance. **Amends D-031**| A for data, C for the vertical-axis setting |
15
+
| D | Fuse top and side recordings into one 3-D session | B's data model, frame sync, identity matching across views |
16
+
17
+
**Order: C, A, B, D.** A moves first if real 3-D files turn up. C goes first because no data
18
+
of any kind exists yet, it is testable on synthetic tracks, and it creates the project-level
19
+
camera-view setting that B reuses.
20
+
21
+
## Hand-offs between the sub-projects
22
+
23
+
-`KeypointSelection.plane` and `camera_view` have no defined precedence. A and B must define
24
+
a vertical axis for 3-D data.
25
+
- The `has_pixel_frame` guard from native-units joins the IL-15 extent derivation when A lands.
26
+
- Per-session camera views arrive with D (`Engine.camera_view_for(session)` is the seam).
27
+
- Whether IL-3 and IL-14, which assume a top-down view, should be gated for side views is
Copy file name to clipboardExpand all lines: docs/METRICS_SPEC.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,8 @@ exporters, not metrics.
93
93
**Binning rules.** Each bin is a slice of the session, but anything a metric
94
94
derives *from the data* is resolved once on the whole session so bins stay
95
95
comparable: the IL-4/IL-7 activity threshold (`mean speed x multiplier`), the fitted
96
-
bout criterion (IL-7, Z-3/Z-4/Z-5), the IL-3/IL-14 arena, the Z-2/Z-8 zone areas.
96
+
bout criterion (IL-7, Z-3/Z-4/Z-5), the IL-3/IL-14 arena, the IL-15 water column, the
97
+
Z-2/Z-8 zone areas.
97
98
Consequences: IL-1 path length loses the one step across each bin edge, so bins sum
98
99
to slightly less than the whole session; Z-1 `time_s` is exactly additive; Z-6
99
100
`first_entry_t_s` is a latency from the start of the bin. Z-5 event `frame`/`t_s` stay
@@ -127,6 +128,7 @@ Level Category IDs
127
128
Individual Locomotion IL-1, IL-2, IL-6
128
129
Activity / freezing IL-4, IL-7
129
130
Space use IL-3, IL-9, IL-10, IL-14
131
+
Vertical position IL-15
130
132
Path geometry IL-5, IL-8, IL-11
131
133
Group Social spacing GL-1, GL-2, GL-13
132
134
Cohesion GL-4, GL-6, GL-10, GL-15
@@ -389,6 +391,24 @@ info-button modal (§6).
389
391
|**Reference**| Simon et al. 1994, Behav. Brain Res. 61(1):59-64 (thigmotaxis as an index of anxiety in mice) — DOI [10.1016/0166-4328(94)90008-6](https://doi.org/10.1016/0166-4328(94)90008-6)|
390
392
|**Supporting references**| Schnorr et al. 2012, Behav. Brain Res. 228(2):367-374 (thigmotaxis in larval zebrafish) (DOI: 10.1016/j.bbr.2011.12.016); Maximino et al. 2010, Behav. Brain Res. 214(2):157-171 (measuring anxiety in zebrafish: a critical review) (DOI: 10.1016/j.bbr.2010.05.031) |
391
393
394
+
#### IL-15 — Vertical position (depth)
395
+
396
+
| Field | Value |
397
+
|---|---|
398
+
|**Manuscript label**| Vertical position (depth in the water column) |
399
+
|**Level**| Individual; trial summary |
400
+
|**Priority**| Optional |
401
+
|**Inputs**|`PreprocessedSession.xy` (the y column); the water column, derived per session from the main zones (never user-supplied); `px_per_cm` when calibrated |
402
+
|**Required preprocessing**| Zone assignment is not needed; main-level zones must exist. The project's **camera view must be set to side view** (Calibration screen) or the metric is skipped and the run records why |
403
+
|**Formula**|`T`, `B` = top and bottom image rows of the main zones (`T < B`); `d[t,k] = (y[t,k] − T) / (B − T)` for frames with `T ≤ y[t,k] ≤ B`; `mean_depth_fraction`, `median_depth_fraction` and `sd_depth_fraction` (n − 1) over those frames; `mean_depth_cm = mean(y − T) / px_per_cm`; `frac_outside_extent` = share of non-NaN frames with `y < T` or `y > B`|
|**Units**| fraction (0 = water surface, 1 = tank floor); cm; fraction; categorical |
406
+
|**Assumptions**| The project declares a side camera view, and the top edge of the main zones is the water surface and the bottom edge the tank floor. The camera is upright: image rows grow downward, so a larger y is deeper. Every main-level additive ("+") zone is pooled into one column, so tanks side by side share it; tanks stacked on top of each other would pool into one tall column. Subtractive ("−") zones and secondary-level zones do not move the extent. Frames outside the column are dropped and counted, never clipped to the surface or floor. Interpolated frames are included. |
407
+
|**Warnings**| No refraction or parallax correction: a fish near the front glass looks larger and sits at a different apparent depth than one at the back, and depth in cm uses a single scale for the whole picture. A column taken from zones that do not match the video, or a tracker following reflections, shows up as a high `frac_outside_extent` (a warning is logged above 5 %). Without a main zone there is no depth: the values are NaN and `depth_extent_source` says why (`none:no_main_zone`, `none:degenerate_zone`, `none:frame_size_mismatch` for zones drawn at another recorded frame size, `none:not_derived`); the video frame is never used instead. Depth is measured from the surface; height above the floor is `1 − depth`. For band occupancy, latency, visits and dwell on a side view, draw stacked secondary-level zones and use Z-1 to Z-9. |
408
+
|**Parameters**|`water_column` is `derived=True` and cannot be overridden. |
409
+
|**Reference**| Standard descriptive statistic of vertical position in the water column; no single originating work defines this mean-depth fraction. The construct, vertical position as a behavioural measure in novel-tank assays, is in the supporting references. |
410
+
|**Supporting references**| Cachat et al. 2010, Nat. Protoc. 5(11):1786-1799 (measuring behavioral and endocrine responses to novelty stress in adult zebrafish) (DOI: 10.1038/nprot.2010.140); Egan et al. 2009, Behav. Brain Res. 205(1):38-44 (understanding behavioral and physiological phenotypes of stress and anxiety in zebrafish) (DOI: 10.1016/j.bbr.2009.06.022); Maximino et al. 2010, Behav. Brain Res. 214(2):157-171 (measuring anxiety in zebrafish: a critical review) (DOI: 10.1016/j.bbr.2010.05.031); Stewart et al. 2012, Neuropharmacology 62(1):135-143 (modeling anxiety using adult zebrafish: a conceptual review -- no operational threshold given) (DOI: 10.1016/j.neuropharm.2011.07.037); Kalueff et al. 2013, Zebrafish 10(1):70-86 (towards a comprehensive catalog of zebrafish behavior 1.0 and beyond) (DOI: 10.1089/zeb.2012.0861) |
411
+
392
412
### 4.2 Zone metrics
393
413
394
414
#### Z-1 — Time in each zone
@@ -804,6 +824,7 @@ three together.
804
824
| IL-10 Roaming Entropy | ❌ | Per-animal time series |
805
825
| IL-11 Circular Statistics of Heading | ❌ | Per-animal time series |
806
826
| IL-14 Wall-Distance Thigmotaxis | ❌ | Per-animal time series |
827
+
| IL-15 Vertical Position (Depth) | ❌ | Per-animal time series |
807
828
| GL-1 Nearest-Neighbour Distance | ✅ | Unordered point set per frame |
808
829
| GL-2 Inter-Individual Distance | ✅ | Unordered point set per frame |
| IL-14 |`metrics/individual.py`|`WallDistanceThigmotaxis`|`shapely` -- the only IL-* metric with that dependency |
1154
+
| IL-15 |`metrics/individual.py`|`VerticalPosition`| np-only; the water column comes from `zones/extent.py`, derived in `metrics/derived.py`; gated by `Metric.valid_camera_views` (`metrics/availability.py`) |
1133
1155
1134
1156
### 5.1 Shared computations (no duplicated work)
1135
1157
@@ -1360,7 +1382,7 @@ exposed so future per-user opt-outs are non-breaking.
1360
1382
flicker debounce. The GUI's ⚙ button now opens `MetricConfigDialog`
1361
1383
(`ui/dialogs/metric_config_dialog.py`) for any metric that declares
1362
1384
`parameters`, one widget per parameter keyed off `MetricParameter.kind`;
1363
-
it is disabled with an explanatory tooltip for the 15 of the 34
1385
+
it is disabled with an explanatory tooltip for the 15 of the 35
1364
1386
metrics it lists that declare none (diagnostics always run and
1365
1387
aren't selectable there, so they don't count towards either
0 commit comments