Skip to content

Commit 384f25c

Browse files
mbel-techclaude
andauthored
feat(idtrackerai): report every missing video field at once, name loose exports, explain units (#154)
* feat(idtrackerai): report every missing video field at once, name loose exports, explain units - normaliser: fps, width and height missing together give one error naming all of them - scan: names an idtracker.ai export lying outside a trajectories/ folder and says where to put it - run README: Units note under body-length calibration, user-supplied reader options, identity slots that are more than 90% missing - IDT_VERSION_UNKNOWN is information for 4.x files - handoff and changelog updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(tracker-formats): replace the dataset CSV with the 41-row revision, pin the FishTank survey, record which idtracker.ai rows Track2Data has run Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * chore: keep the pinned FishTank survey byte-exact on checkout Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(types): give the README slot helper a real DataFrame type (mypy) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(gui): Validate pipeline also reports sessions the run could not open A bare idtracker.ai export added without its video size passed Validate with 'Ready to run.' and then failed in the run. The GUI action now adds Engine.session_read_issues(), as 'track2data validate' does. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * feat(idtrackerai): pickle refusal asks for the video size; README lists all-NaN columns with reasons Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 33cd1a2 commit 384f25c

21 files changed

Lines changed: 648 additions & 28 deletions

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ docs/tracker-formats/importer_priority.csv -text
66
docs/tracker-formats/tracker_test_datasets.csv -text
77

88
tests/real_samples/fixtures_manifest.json -text
9+
docs/tracker-formats/fishtank_idtracker_survey.csv -text

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
4545

4646
- **IL-15 on fused 3-D projects: `frac_outside_extent` no longer grows with top-view gaps.** The share was counted over samples that also had a depth, which needs the top view as well, so a fish the top view lost for half the video reported twice the true share of side-view samples outside the water column (0.20 against 0.10 in the review's probe), and the warning blamed the fusion settings. The fused session now records where the side view had a position (`depth_side_valid`) and the share is over those samples. A side sample with a y but no x now gives a depth (x is only used for the view-agreement check). Native 3-D files are unchanged.
4747
- **Native 3-D files: the vertical axis is now preprocessed like the horizontal plane.** `z` was laid out and then left raw, so a smoothed x/y was combined with an unsmoothed z in IL-16 and IL-17 and no setting could reduce the vertical share of the 3-D path. It now goes through the same steps and settings as x/y: blanked where a jump was replaced, bridged across tracking intervals, gap-filled (same `max_gap_frames`, same limits) and smoothed (same method, window and polyorder). On a synthetic helix with 2 mm noise (true 3-D path 251.5 cm, true vertical path 15.96 cm) the vertical contribution to IL-16 was 129.14 cm at every smoothing setting; it is now 60.09 cm at window 5 (default) and 16.49 cm at window 41, and IL-16 is 275.78 cm and 252.06 cm (was 307.66 and 294.20). **Native 3-D IL-16 and `max_speed_3d_cm_s` will be lower than before on noisy files**; the sensitivity sweep now varies the vertical half too. Cached preprocessing is rebuilt once (cache schema 7); `project_hash` is unchanged.
48-
- **idtracker.ai bare exports.** A CSV bundle written without a time column (idtracker.ai omits it when the frame rate is unknown) no longer crashes with a bare `ValueError`: the column count decides whether a leading time column is present, for `trajectories.csv` and `id_probabilities.csv` alike. `id_probabilities` that do not match the trajectories (frames or animals) are now refused with `IDT_SHAPE_MISMATCH` instead of passing silently. The idtracker.ai reader gains optional `fps`, `width_px` and `height_px` options for exports that record no video size or frame rate; they fill gaps only, behind the trajectory file and `session.json`. A folder whose only trajectory format is a pickle and has no consent now fails with `IDT_PICKLE_REFUSED` (was `IDT_FORMAT_AMBIGUOUS`). `track2data add --option fps=... --option width_px=... --option height_px=...` now works for idtracker.ai (the reader's detection carried no options, so the CLI and the confirm dialog rejected them). New `track2data add --allow-pickle` records consent for pickled trajectories on the project. `track2data validate` now also opens each session and reports what a run would fail on (missing video size or frame rate, pickle without consent), even when no metric is selected.
48+
- **idtracker.ai bare exports.** A CSV bundle written without a time column (idtracker.ai omits it when the frame rate is unknown) no longer crashes with a bare `ValueError`: the column count decides whether a leading time column is present, for `trajectories.csv` and `id_probabilities.csv` alike. `id_probabilities` that do not match the trajectories (frames or animals) are now refused with `IDT_SHAPE_MISMATCH` instead of passing silently. The idtracker.ai reader gains optional `fps`, `width_px` and `height_px` options for exports that record no video size or frame rate; they fill gaps only, behind the trajectory file and `session.json`. A folder whose only trajectory format is a pickle and has no consent now fails with `IDT_PICKLE_REFUSED` (was `IDT_FORMAT_AMBIGUOUS`). `track2data add --option fps=... --option width_px=... --option height_px=...` now works for idtracker.ai (the reader's detection carried no options, so the CLI and the confirm dialog rejected them). New `track2data add --allow-pickle` records consent for pickled trajectories on the project. `track2data validate` now also opens each session and reports what a run would fail on (missing video size or frame rate, pickle without consent), even when no metric is selected. A bare export that lacks the frame rate and the video size now gets one error naming every missing field (also from `validate`), and `scan` explains a loose idtracker.ai export outside a `trajectories/` folder. The run README gains a **Units** note (why `*_cm` columns are empty under body-length calibration), lists the reader options the user supplied, and lists identity slots that are more than 90% missing; `IDT_VERSION_UNKNOWN` is information for 4.x files. The README also gains a **Columns with no values** section that lists every metric column that is entirely NaN with the reason (for example the fragment diagnostics D-7 to D-9, D-13 and D-14 need `list_of_fragments.json`, which a bare export lacks). A pickle refused for lack of consent now also says that pickled files usually record no video size, so the size options can be given in the same step.
4949
- **The test run no longer crashes at exit, and runs about three times faster.** After every test had passed, the Qt
5050
tests intermittently ended with "QObject: shared QObject was deleted directly" and a segfault (exit 139), which
5151
failed CI on a green run. The cause was in the application, not the tests: PySide keeps a `lambda` or

‎app/main_window.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,10 @@ def _action_validate(self) -> None:
777777
plan_lines += skipped_lines(state.plan)
778778
else:
779779
issues = engine.validate()
780+
# What `track2data validate` also reports: a session the run could not open (a bare
781+
# idtracker.ai export added without its video size, a pickle without consent).
782+
# Validate is an explicit action, so opening each session is affordable here.
783+
issues += engine.session_read_issues()
780784
plan_text = "\n\n" + "\n".join(plan_lines) if plan_lines else ""
781785
if plan_lines:
782786
self._store.append_log(

‎docs/tracker-formats/HANDOFF_idtrackerai_real_dataset_run.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,19 @@ file (h5, no-fps CSV, MoveR pickled dict: `new`, `add --option width_px=... heig
3333
through the CLI on the cached fixtures (h5, CSV bundle, no-fps CSV, MoveR pickled dict) and checks the output file set,
3434
frames x animals row counts, h5-vs-CSV agreement, the `validate` refusal without options/consent, and that the input folder
3535
is unchanged. The 464k-frame FishTank file is not in it (not in the fixture manifest; ~100 s).
36-
Still open: items 4, 5, 6 and 8 (one error at a time, flat folders, all-NaN cm columns, smaller points).
36+
- Items 4, 5, 6 and 8 done in the same PR:
37+
- 4: a bare export's missing fps / width / height are now reported in one error (and by `validate`) instead of one per run.
38+
A pickle without consent is still reported before the video size (the file must be opened to know whether it records
39+
one), but the refusal now says so: when neither `width_px`/`height_px` nor a `session.json` width/height is given, its
40+
remediation (and so `validate`) adds that pickled files usually record no video size and to give both options. Nothing is
41+
unpickled to find out, and the code stays `IDT_PICKLE_REFUSED`. Closed.
42+
- 5: `scan` names a loose idtracker.ai export (`trajectories.h5/.npy/.parquet/.pickle` or a `trajectories_csv` folder outside
43+
a `trajectories/` folder) and says to put it in `<name>/trajectories/`. It is still not claimed as a session.
44+
- 6: the run README has a `## Units` section when calibration is 'bodylength', saying the `*_cm` columns are empty on purpose
45+
and how to get centimetres. A `## Columns with no values` section now lists every other entirely-NaN metric column with a
46+
reason keyed by metric id (D-2, D-3, D-5..D-9, D-12..D-15; anything else gets the generic "no valid values" reason). Closed.
47+
- 8: the README lists reader options the user gave ("not recorded in the files"); it lists identity slots that are more than
48+
90 % missing; `IDT_VERSION_UNKNOWN` is information, not a warning, for 4.x files.
3749

3850
## 2. Method
3951

‎docs/tracker-formats/README.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Tracker output formats: research notes and rollout inputs
22

3-
Inputs for the multi-tracker import work (scan, detect, confirm, read). The four
4-
research files below are third-party notes, kept **byte-identical** to the copies
3+
Inputs for the multi-tracker import work (scan, detect, confirm, read). The research
4+
files below are third-party notes and data, kept **byte-identical** to the copies
55
supplied. Do not edit them in place: re-copy the file, then update its pin in
66
`tests/test_docs_tracker_formats.py` and its row here (a test keeps the two in step).
77

@@ -10,7 +10,12 @@ supplied. Do not edit them in place: re-copy the file, then update its pin in
1010
| `animal_tracking_output_formats.md` | The per-tool description of output layouts. This is the 2026-10-07 12:57 revision, which corrects the earlier copy and is canonical | `4b683240…` |
1111
| `animal_tracking_formats_table.csv` | One-row-per-tool summary table. It predates the corrections above (see below) | `9c9f3df7…` |
1212
| `importer_priority.csv` | Importer priority by recent citation share. Seven importers cover 80.5 % of animal-tracker citations, and the rollout follows this order | `b4307f31…` |
13-
| `tracker_test_datasets.csv` | Public datasets for each importer, with licence and what was verified. The provenance record for every fixture | `195247aa…` |
13+
| `tracker_test_datasets.csv` | Public datasets for each importer, with licence and what was verified. The provenance record for every fixture. The 41-row revision of 2026-10-11. Its Track2Data sentences ("main @7052e9b … fails with …") describe the code before the fixes of #146, #151 and #154; what Track2Data does now is in `idtrackerai_track2data_runs.csv` | `136bf05e…` |
14+
| `fishtank_idtracker_survey.csv` | Per-file survey of the 22 FishTank idtracker.ai files (version, fps, shape, NaN share, sha256 of each zip); row 39 of the dataset CSV cites it | `ad90fcc5…` |
15+
16+
Ours, not pinned: `idtrackerai_track2data_runs.csv` records which of the dataset CSV's idtracker.ai rows
17+
Track2Data has run, how, with which test, and with what caveat (placeholder video sizes, manual runs).
18+
A test keeps it keyed to the dataset CSV. Update it whenever a row is run or a test is added.
1419

1520
Not copied here: the reader fixture-test suite (`t2d_reader_fixture_tests.zip`)
1621
lives in `tests/real_samples/`, because it is test code, not documentation.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
kind,version,fps,shape,nan_frac,keys,body_length,est_acc,idprob,zip,sha256,bytes
2+
dict,,100.0,"(971756, 2, 2)",0.1575,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",59.0,,True,FishTank20200127_143538.zip,349deaec0393c1a49823248af3ce54596caa5c9b95d091ed39b116d0a0dc7e09,46644920
3+
pickle-nonnumpy,,,,,,,,,FishTank20200129_140656.zip,fc0324f0d0c841368c17e5377ad1dc39ef891574ac1e99c0b61bb64440e963dc,48112580
4+
dict,,100.0,"(501943, 2, 2)",0.0914,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",55.0,,True,FishTank20200130_153857.zip,7f63e43922ea237977b1ecc427629da71e3563a0fb34276d0b84b92115c21275,24093896
5+
pickle-nonnumpy,,,,,,,,,FishTank20200130_181614.zip,6c78fa8c51b82541139e2d2fd94164cb1726ed19a1543e307c2022c6bbdee9d9,32976117
6+
dict,4.0.9,100.0,"(463997, 2, 2)",0.1032,"['areas', 'body_length', 'frames_per_second', 'id_probabilities', 'identities_groups', 'setup_points', 'stats', 'trajectories', 'version', 'video_path']",52.0,0.9996785031733496,True,FishTank20200207_161445.zip,236015ade4082b9f6c166619976f349b8234ab4b2caf9188e76a5a47d3273d63,29696850
7+
pickle-nonnumpy,,,,,,,,,FishTank20200213_154940.zip,6a79d178cb615180c92340f676342491951499d214dbee80fb2feeac62a6883d,46429461
8+
pickle-nonnumpy,,,,,,,,,FishTank20200214_153519.zip,db553f1ba3991b74b11c0c47df9f9c8d6226e0c072dc5308189e1b7c8a1c8c79,31525005
9+
pickle-nonnumpy,,,,,,,,,FishTank20200217_160052.zip,7a990d779cde0777bc6eab3c995bb012878da08610db487df5df57d96e25e3ee,38475003
10+
dict,,100.0,"(537880, 2, 2)",0.1037,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",56.0,,True,FishTank20200218_153008.zip,ac4a315be635ed4eae826e4b3c377892983d8d85df45f02f2cbcc1b075cdda92,25818872
11+
dict,4.0.9,100.0,"(1032353, 2, 2)",0.0225,"['areas', 'body_length', 'frames_per_second', 'id_probabilities', 'identities_groups', 'setup_points', 'stats', 'trajectories', 'version', 'video_path']",54.0,0.99988121257647,True,FishTank20200316_163320.zip,224287d1a5e9a30ec3da2ec408b4d10177b392fe6bbd0e31dffbf56341471476,66071628
12+
dict,,100.0,"(561010, 2, 2)",0.0612,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",62.0,,True,FishTank20200327_154737.zip,44b85ea94914663ba357d18e771b28440d6df6a0b45d3a691ba6650c144449b4,26929112
13+
pickle-nonnumpy,,,,,,,,,FishTank20200330_161100.zip,8de42c1b16b0e381c94832208a3307d122984cac61091f9ae547b0bac9b3941d,35347756
14+
dict,,100.0,"(746434, 2, 2)",0.1234,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",56.0,,True,FishTank20200331_162136.zip,ffe30869d6b27ec88624525d761f7fa0901a2cc92c6e30d41da40895f7436d84,35829464
15+
dict,,100.0,"(1248577, 2, 2)",0.0536,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",49.0,,True,FishTank20200520_152810.zip,572a09523cb908bf86cccfa3176c6ca56bafdb710de86ba9b4612685ccadd8cc,59932328
16+
dict,,100.0,"(596607, 2, 2)",0.0503,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",60.0,,True,FishTank20200521_154541.zip,eaa21fdd27fd1262c41a125bff4f7ab74e99445624336bf9f3599dfa850ad64f,28637841
17+
dict,,100.0,"(588962, 2, 2)",0.1893,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",60.0,,True,FishTank20200525_161602.zip,3b2c7421af7ca834bccf2b711fc662c909920b33e8787b93cc5e345fe2d2eb95,28270808
18+
dict,,100.0,"(689100, 2, 2)",0.1172,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",56.0,,True,FishTank20200526_160100.zip,8e8cae743c3c75191239e81aea46a290855be6d75577466efd9943aa102e086e,33077432
19+
dict,4.0.8,100.0,"(497635, 2, 2)",0.0191,"['areas', 'body_length', 'frames_per_second', 'id_probabilities', 'identities_groups', 'setup_points', 'stats', 'trajectories', 'version', 'video_path']",54.0,0.9999119100663236,True,FishTank20200527_152401.zip,a227d2760d73a5e1e9336e3f5aeba7b023a903859752c4e63a1c5080531bff77,31849615
20+
dict,,100.0,"(1695643, 2, 2)",0.0717,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",57.0,,True,FishTank20200824_151740.zip,d5878d0a75e9b0151c090078d2473926c623f5f25dc5fe4bd59c7aa30c82f3f6,81391496
21+
dict,,100.0,"(798382, 2, 2)",0.056,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",56.0,,True,FishTank20200828_155504.zip,408351ce9e3a2be18c934f69c0e7af88f95cc56dda55bb04855beeb2abf751ee,38322968
22+
dict,,100.0,"(717814, 2, 2)",0.0913,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",58.0,,True,FishTank20200902_160124.zip,a5a4b3f7953d1f196b809ed830fb605674a1a4103831c4223a4944b656371c57,34455704
23+
dict,,100.0,"(726000, 2, 2)",0.126,"['body_length', 'frames_per_second', 'git_commit', 'id_probabilities', 'trajectories', 'video_path']",56.0,,True,FishTank20200903_160946.zip,9e1c903897f104f32096a19dbe2451a54dc62f88e652bdd434166b26894aff1b,34848632
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dataset,track2data_status,test,what_was_run,caveats
2+
movement-data: data/idtrackerai/trajectories.h5,run_through_cli,tests/real_samples/test_idtrackerai_cli_run.py::test_a_bare_export_goes_through_add_validate_and_run[h5],"scan, add --option width_px/height_px, validate, run; output row count, preprocessing and the CSV-bundle twin checked",Video size is a placeholder (1000x1000): no value in cm or cm/s is a result. Frame rate comes from the file.
3+
movement-data: data/idtrackerai/trajectories_csv/,run_through_cli,tests/real_samples/test_idtrackerai_cli_run.py::test_a_bare_export_goes_through_add_validate_and_run[csv],same as the h5 row; agrees with the h5 export (test_the_h5_and_csv_exports_of_one_session_run_to_the_same_table),Placeholder video size (1000x1000).
4+
movement-data: data/idtrackerai/trajectories_csv_no_fps/ (SYNTHETIC),run_through_cli,tests/real_samples/test_idtrackerai_cli_run.py::test_a_bare_export_goes_through_add_validate_and_run[nofps],"scan, add with fps=28 and a placeholder size, validate, run; both animals and their probabilities kept",Frame rate and video size are supplied by the user (placeholders); the file records neither. Synthetic data.
5+
MoveR_SampleData: sample_1/IdTrackerOutput/2602_ISA3080_Low_5.npy,run_through_cli,tests/real_samples/test_idtrackerai_cli_run.py::test_a_bare_export_goes_through_add_validate_and_run[moveR_pickled],"scan, add --allow-pickle with a placeholder size, validate, run",Placeholder size 3840x2160 (width assumed). 7 of the 20 identity slots are mostly empty; the run README lists them.
6+
idtracker.ai v6 benchmark data repository (Google Drive linked from idtracker.ai),not_run,,"Google Drive repository not opened: layout, size and licence unverified.",
7+
Romero-Ferrero et al. 2019 Nature Methods data (idtracker.ai site),not_run,,Download not opened; whether it holds v4 session folders is unverified.,
8+
"Heras et al. 2019 PLoS Comput Biol: zebrafish collective-motion videos (60, 80, 100 fish)",not_run,,No trajectory files located (the Figshare record holds supplementary PDFs only).,
9+
idtracker.ai docs test videos: test_B.avi and zebrafish_60_1.avi,not_run,,"Input videos, not tracker output.",
10+
Zenodo 10.5281/zenodo.10103747: FishTank*.zip / idtracker_results/trajectories.npy (16 of 22 files parsed),run_by_hand,none (not in the automated suite),"One file of the 16 parsed (FishTank20200207_161445, 4.0.9): scan, add --allow-pickle, validate, run, exit 0 on 2026-10-11, about 98 s, 134 MB of output, 463,997 frames",Placeholder size 1000x1000. The other 15 readable files were not run.
11+
Zenodo 10.5281/zenodo.10103747: FishTank*.zip / idtracker_results/trajectories.npy (6 of 22 files not opened),not_run,,Pickles reference _codecs.encode: needs a restricted unpickler first.,
12+
Zenodo 10.5281/zenodo.22650910: DRerio LogAI supporting data (idtracker.ai arm of a benchmark),not_run,,"Derived, subsampled position tables, not idtracker.ai trajectory files.",
13+
Zenodo 10.5281/zenodo.18835630: Zebrafish aggression (gt1-3 and new_dataset trajectories),not_run,,Tool (idtracker.ai or the original idTracker) not established; only the header was read.,

0 commit comments

Comments
 (0)