File size: 5,190 Bytes
e05ba68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
license: cc0-1.0
language:
  - en
tags:
  - biology
  - animal-behavior
  - collective-behavior
  - animal-tracking
  - mosaic
pretty_name: "Golden shiners: collective motion across group size"
size_categories:
  - 10M<n<100M
---

# Golden shiners, collective motion across group size

Pose tracks for ten trials of free-swimming golden shiners (*Notemigonus
crysoleucas*) at four group sizes, converted to
[mosaic](https://github.com/EcodylicScience/mosaic) parquet tables and ready to
analyse without a conversion step.

Worked example:
[`notebooks/collective-motion-shiners.ipynb`](https://github.com/EcodylicScience/mosaic/blob/main/notebooks/collective-motion-shiners.ipynb).
Set `SOURCE = "download"` (the default) and it fetches both files below.

## Read this before comparing against another tracker

**`X` / `Y` is the fish's HEAD, not its body centre.** SchoolTracker measures no
centroid. It locates the head, within 2 px of the midpoint between the two eyes,
and that is what these tables carry. Every other tracker mosaic converts (TRex,
SLEAP, Ultralytics, DeepLabCut) puts a body centroid in `X` / `Y`, so a feature
reading `X` across this dataset and one of those is comparing two landmarks about
half a body length apart, with nothing in the numbers to say so.

The same warning travels with the data: it is written into the `schooltracker_v1`
schema description recorded in `tracks/index.csv`.

There are **no `poseX*` / `poseY*` columns**. The head is the one point measured
and it is already in `X` / `Y`; a keypoint pair would be a verbatim copy under a
name promising a second, separately detected landmark.

## Files

| File | Size | What it is |
| --- | --- | --- |
| `shiners-tracks.tar.gz` | 350 MB | A complete mosaic dataset: `dataset.yaml` + `tracks/`. Ten trials, 10,827,539 rows. |
| `shiners-raw-sample.tar.gz` | 8.9 MB | One trial (`10-fish/0066`, 7 segments) of raw SchoolTracker `_fov.h5`, reduced to the fields the converter reads. |

`SHA256SUMS` carries the checksums.

The raw sample exists so the example notebook can *run* its converter rather than
only display it. Converting the sample reproduces the shipped table for that
trial exactly, and the notebook asserts this before going on.

## Contents

| group | trials | frames each | individuals |
| --- | --- | --- | --- |
| `10-fish` | 0066, 0105, 0126 | ~24,600 | 10 |
| `30-fish` | 0084, 0115, 0120 | ~24,580 | 30 |
| `70-fish` | 0103, 0107, 0124 | ~24,570 | 70 |
| `150-fish` | one trial | 17,999 | **151** |

The last row is not a typo: the source directory is named `150-fish` and the file
reports 151 tracks. Both are preserved rather than one being corrected to match
the other.

Columns: `frame, time, id, group, sequence, X, Y, ANGLE, body_length`. Positions
are **video pixels**. `ANGLE` is the tracker's own measured body-axis heading, not
an inference from displacement — which is why the schema is `schooltracker_v1`
(`mosaic_v1` plus `ANGLE`) rather than plain `mosaic_v1`.

## Use

```python
import tarfile
from huggingface_hub import hf_hub_download
from mosaic.core.dataset import Dataset

path = hf_hub_download("EcodylicScience/mosaic-example-shiners",
                       "shiners-tracks.tar.gz", repo_type="dataset")
with tarfile.open(path) as tar:
    tar.extractall("data")

ds = Dataset("data/shiners-tracks/dataset.yaml").load()
tracks = ds.load_tracks("10-fish", "0066")
```

`huggingface_hub >= 1.2.0` is worth pinning: older clients retry a rate-limit
response with a 25-second backoff against a 5-minute window, so they fail where a
current client waits.

## Provenance and changes

Derived from the Dryad record accompanying Davidson et al. (2021). **CC0 1.0**,
so this derivative carries the same terms.

Source: [doi:10.5061/dryad.sbcc2fr2h](https://doi.org/10.5061/dryad.sbcc2fr2h)
(32 GB across 11 zips; about 45 GB of `_fov.h5` unpacked).

What was changed:

- The `_fov.h5` pose arrays were converted to mosaic `schooltracker_v1` parquet
  tables. Column names and layout differ from the original release. **Positions
  and headings are unaltered** — `x`, `y` and the heading vector are carried
  through verbatim, with `ANGLE = arctan2(heading_y, heading_x)`.
- Each trial's segment files were joined into one table: frame numbers offset by
  the preceding segments' lengths, and track identities re-linked across joins by
  linear-sum assignment on the last and first frames. The converter's docstring
  gives the margins.
- Fields not converted: the 256-ray visual field (`fov_*`, the bulk of the
  45 GB), the body-local midline and shape descriptors, the eye positions, and
  the all-zero stimulus-object fields.
- The raw sample additionally has every unread field removed, which is why one
  trial is 8.9 MB rather than 932 MB. Kept arrays are byte-identical to the
  originals.

Not included: video, and the visual-field arrays. Both are in the Dryad record.

## Citation

Davidson JD, Sosna MMG, Twomey CR, Sridhar VH, Leblanc SP, Couzin ID (2021)
Collective detection based on visual information in animal groups. *Journal of
the Royal Society Interface* 18: 20210142.
[doi:10.1098/rsif.2021.0142](https://doi.org/10.1098/rsif.2021.0142)