cccat6 commited on
Commit
eb4fc81
·
verified ·
1 Parent(s): 069fbac

Complete FlowMo reproducibility materials and record input provenance

Browse files

Preserve the original study and completed rebuttal results. Add final checkpoints, explicitly classified original/restored/reconstructed simulation inputs, version-specific commands, figure reconstruction and reviewed manuscript assets. Remove redundant GIFs, intermediate checkpoints and obsolete release files from the current tree; preserve the initial revision in history and by tag. No new license grant.

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +0 -0
  2. .gitignore +5 -19
  3. .hfignore +0 -25
  4. DATASETS.md +34 -0
  5. MANIFEST.json +0 -0
  6. METRICS.md +31 -0
  7. README.md +69 -108
  8. assets/FlowMo_WM_architecture.pptx +3 -0
  9. control.py +99 -0
  10. data/manifest.json +3329 -0
  11. data/rebuttal/dynamic_frequency_sweep/test_freq_0020mhz.npz +3 -0
  12. data/rebuttal/dynamic_frequency_sweep/test_freq_0040mhz.npz +3 -0
  13. data/rebuttal/dynamic_frequency_sweep/test_freq_0160mhz.npz +3 -0
  14. data/rebuttal/dynamic_frequency_sweep/test_freq_0320mhz.npz +3 -0
  15. data/rebuttal/dynamic_frequency_sweep/test_freq_0640mhz.npz +3 -0
  16. data/rebuttal/test_dynamic_slow.npz +3 -0
  17. data/rebuttal/test_flow_switch_100.npz +3 -0
  18. data/rebuttal/test_magnitude_100.npz +3 -0
  19. data/rebuttal/test_magnitude_125.npz +3 -0
  20. data/rebuttal/test_magnitude_150.npz +3 -0
  21. data/rebuttal/test_magnitude_200.npz +3 -0
  22. data/rebuttal/test_with_params.npz +3 -0
  23. data/rebuttal/train_with_params.npz +3 -0
  24. data/rebuttal/validation_dynamic_slow.npz +3 -0
  25. data/rebuttal/validation_id.npz +3 -0
  26. data/rebuttal/validation_magnitude_150.npz +3 -0
  27. driftwm/data/generate.py +138 -19
  28. driftwm/sim/flow.py +77 -0
  29. experiments/BASELINES.md +0 -44
  30. experiments/EXPERIMENT_MATRIX.md +0 -166
  31. experiments/METHOD_AUDIT.md +0 -30
  32. experiments/README.md +0 -86
  33. experiments/TASK_PLAN.md +0 -131
  34. experiments/current_estimator_los_controller/README.md +0 -3
  35. experiments/current_estimator_los_controller/result/.gitkeep +0 -0
  36. experiments/docs/EXPERIMENT_PROTOCOL.md +0 -231
  37. experiments/evaluate_flowmo_latent_probes.py +335 -9
  38. experiments/evaluate_image_planning.py +47 -4
  39. experiments/evaluate_image_world_models.py +289 -16
  40. experiments/evaluate_temporal_flow_probes.py +565 -0
  41. experiments/export_paper_artifacts.py +5 -5
  42. experiments/flowmo/README.md +0 -9
  43. experiments/flowmo/checkpoint/.gitkeep +0 -0
  44. experiments/flowmo/checkpoint/paper_step_002000.pt +0 -3
  45. experiments/flowmo/checkpoint/paper_step_004000.pt +0 -3
  46. experiments/flowmo/checkpoint/paper_step_006000.pt +0 -3
  47. experiments/flowmo/checkpoint/paper_step_008000.pt +0 -3
  48. experiments/flowmo/checkpoint/paper_step_010000.pt +0 -3
  49. experiments/flowmo/checkpoint/paper_step_012000.pt +0 -3
  50. experiments/flowmo/checkpoint/paper_step_014000.pt +0 -3
.gitattributes CHANGED
The diff for this file is too large to render. See raw diff
 
.gitignore CHANGED
@@ -1,25 +1,11 @@
1
  __pycache__/
2
  *.pyc
3
  .pytest_cache/
 
4
  .cache/
5
- .ipynb_checkpoints/
6
-
7
- # Local runtime noise
8
- logs/
9
- external/
10
- flowmo_remote_outputs/
11
-
12
- # Local paper-build artifacts are not part of the reproducibility package.
13
- CoRL_2026___FlowMo_World_Model*
14
- FlowMo-WM_CoRL2026*_draft.pdf
15
  *.aux
16
- *.bbl
17
- *.blg
18
- *.fdb_latexmk
19
- *.fls
20
  *.log
21
- *.out
22
- *.synctex.gz
23
-
24
- # Render caches are reproducible intermediates, not paper artifacts.
25
- experiments/shared/result/image_cache*/
 
1
  __pycache__/
2
  *.pyc
3
  .pytest_cache/
4
+ .venv/
5
  .cache/
6
+ outputs/
7
+ runs/
 
 
 
 
 
 
 
 
8
  *.aux
 
 
 
 
9
  *.log
10
+ *.fls
11
+ *.fdb_latexmk
 
 
 
.hfignore DELETED
@@ -1,25 +0,0 @@
1
- .git/
2
- .venv/
3
- __pycache__/
4
- *.pyc
5
- .pytest_cache/
6
- .cache/
7
- .ipynb_checkpoints/
8
- logs/
9
- external/
10
- flowmo_remote_outputs/
11
-
12
- # Local paper-build artifacts are not part of the reproducibility package.
13
- CoRL_2026___FlowMo_World_Model*
14
- FlowMo-WM_CoRL2026*_draft.pdf
15
- *.aux
16
- *.bbl
17
- *.blg
18
- *.fdb_latexmk
19
- *.fls
20
- *.log
21
- *.out
22
- *.synctex.gz
23
-
24
- # Render caches are reproducible intermediates, not paper artifacts.
25
- experiments/shared/result/image_cache*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
DATASETS.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Simulation inputs
2
+
3
+ This release separates historical originals from reconstructions. All files are supplied, so material reconstruction and checkpoint evaluation do not download hidden inputs.
4
+
5
+ | Dataset | Episodes | Status | Historical container exact |
6
+ |---|---:|---|---|
7
+ | `data/paper/test.npz` | 480 | Archived original | Yes |
8
+ | `data/paper/train.npz` | 2400 | Archived original | Yes |
9
+ | `data/rebuttal/dynamic_frequency_sweep/test_freq_0020mhz.npz` | 480 | Recorded-protocol reconstruction | No |
10
+ | `data/rebuttal/dynamic_frequency_sweep/test_freq_0040mhz.npz` | 480 | Recorded-protocol reconstruction | No |
11
+ | `data/rebuttal/dynamic_frequency_sweep/test_freq_0160mhz.npz` | 480 | Recorded-protocol reconstruction | No |
12
+ | `data/rebuttal/dynamic_frequency_sweep/test_freq_0320mhz.npz` | 480 | Recorded-protocol reconstruction | No |
13
+ | `data/rebuttal/dynamic_frequency_sweep/test_freq_0640mhz.npz` | 480 | Recorded-protocol reconstruction | No |
14
+ | `data/rebuttal/test_dynamic_slow.npz` | 480 | Recorded-protocol reconstruction | No |
15
+ | `data/rebuttal/test_flow_switch_100.npz` | 480 | Archived original | Yes |
16
+ | `data/rebuttal/test_magnitude_100.npz` | 480 | Recorded-protocol reconstruction | No |
17
+ | `data/rebuttal/test_magnitude_125.npz` | 480 | Recorded-protocol reconstruction | No |
18
+ | `data/rebuttal/test_magnitude_150.npz` | 480 | Recorded-protocol reconstruction | No |
19
+ | `data/rebuttal/test_magnitude_200.npz` | 480 | Recorded-protocol reconstruction | No |
20
+ | `data/rebuttal/test_with_params.npz` | 480 | Exact after metadata restoration | Yes |
21
+ | `data/rebuttal/train_with_params.npz` | 2400 | Exact after metadata restoration | Yes |
22
+ | `data/rebuttal/validation_dynamic_slow.npz` | 480 | Recorded-protocol reconstruction | No |
23
+ | `data/rebuttal/validation_id.npz` | 480 | Recorded-protocol reconstruction | No |
24
+ | `data/rebuttal/validation_magnitude_150.npz` | 480 | Recorded-protocol reconstruction | No |
25
+
26
+ Archived originals and the two exact metadata restorations match their historical containers. The thirteen reconstructed inputs follow the fixed generation commands, including paired episode seeds, hidden-flow instances, boat parameters and initial states across stress/frequency conditions. Existing-input design checks pass and are recorded in `data/manifest.json`.
27
+
28
+ The original containers of those thirteen derived splits were not recovered. Their equality to the historical numerical trajectories is therefore not asserted. Published tables and figures are rebuilt from the preserved historical per-seed and per-episode results, never from substituted reconstructed-input evaluations. New evaluations record the provenance of the inputs actually used.
29
+
30
+ The ten base derived splits match the historical recorded shapes, metadata fields and family/trajectory counts. All numerical arrays are finite. The release also checks train/test/validation episode separation, hidden-flow-pool separation, paired stress/frequency conditions, exact labeled/original trajectory identity and the locked switching transitions. These are input checks, not a replacement experiment campaign.
31
+
32
+ Training contains 2,400 episodes, 720,000 transitions and 722,400 simulator states; the original test contains 480 episodes, 144,000 transitions and 144,480 states. NPZ files hold simulator trajectories and commands. RGB observations are rendered online, without visualization overlays.
33
+
34
+ Use `sh run.sh generate-data --output runs/generated_inputs` to create a separate set from the recorded commands. Cross-platform floating-point and serialization equality is not assumed. The existing license state is retained; this update adds no license grant.
MANIFEST.json ADDED
The diff for this file is too large to render. See raw diff
 
METRICS.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Metric and experiment map
2
+
3
+ | Paper item | Input records | Meaning |
4
+ |---|---|---|
5
+ | Table I | `experiments/reports/paper_planning/*.json.gz` | Eight methods, two boats, four tasks, ten flow families, fifty episodes per cell; 32,000 inferred-context episodes |
6
+ | Table II | `experiments/reports/rebuttal/core/seed_*/id_h*_prediction.json.gz` | Five matched predictors, seeds 1-8; mean and sample standard deviation |
7
+ | Figure 3 | Eight `ep000` GIFs under `paper_planning/gifs/` | First/middle/final frames of the same selected execution per row and boat |
8
+ | Figure 4 | `experiments/reports/paper_prediction.json.gz` | Initial adapted-model prediction comparison |
9
+ | Figure 5 | Initial planning episode records | Failure fraction by flow family and morphology |
10
+ | Figure 6A | Core per-seed predictions | Matched history and conditioning, H20 and H60 |
11
+ | Figure 6B | `ood_extension/family_ood/` and `switching_ood/combined/` | Held-out flow-family H60/H120 and switching H60 |
12
+ | Figure 6C | `dynamic_frequency_sweep/raw/` plus the 0.08-Hz stress anchor | Smooth time variation from 0.02 to 0.64 Hz |
13
+ | Figure 6D | `rebuttal/stress/` | Flow magnitude multipliers 1, 1.25, 1.5 and 2 |
14
+ | Figure 6E | `rebuttal/planning/seed_*/` | Four methods in six twin-boat control conditions |
15
+ | Figure 6F | `rebuttal/scaling/` | FlowMo with 300, 600, 1,200 and 2,400 training episodes |
16
+
17
+ Paths in the table are relative to the repository or the stated report root. Large report JSON files are losslessly gzip-compressed. Standard Python `gzip.open(path, 'rt')` reads them.
18
+
19
+ **Position error.** `posK` is the mean Euclidean position error at rollout step K in raw simulator coordinates. Paper tables/plots multiply by 10, equivalently `100 * error / W` for W=10. It is not a calibrated physical distance. Heading error is the absolute wrapped angular difference in radians.
20
+
21
+ **Horizon.** H20 and H60 values in Table II use the H60 evaluation windows; H120 uses its separately sampled H120 windows. Changing the rollout length also changes the valid-window population. Do not take H60 from an H120 file and label it as the primary H60 experiment.
22
+
23
+ **Uncertainty.** Table II uses the sample standard deviation across eight independent model seeds. Figure 6A/C/D/E/F use the archived Student-t 95% mean intervals (seven degrees of freedom). Figure 6B uses the archived 50,000-draw seed bootstrap. These error bars are not independent-window confidence intervals.
24
+
25
+ **Success and conditioning.** Planning success is the task-specific Boolean recorded per episode. Table I final distance uses all episodes; energy and number of steps use successful episodes only. The corrected FlowMo initial count is 3,942/4,000, or 98.55%. Counts come directly from individual records, not rounded rates.
26
+
27
+ **Figure 6E condition labels.** R0: reach in no flow; R1: reach in uniform flow; SV: station keeping in a vortex; SD: station keeping in smooth dynamic flow; S2: station keeping with doubled uniform-flow magnitude; ZF: zigzag in a random Fourier field. Each plotted seed summarizes thirty episodes.
28
+
29
+ **Context interventions.** The formal `same_flow` donor shares the exact hidden-flow instance and comes from another episode. Only 8,558 of 16,384 sampled windows are eligible; `same_flow_reference` evaluates ordinary inferred context on that same subset. The shuffled donor is from a different flow instance. Neither test establishes physically identifiable flow coordinates in the context latent.
30
+
31
+ **Model names.** Full-32 is the matched single-branch full-history control; Recent-8 uses the latest eight frames. Additive and FiLM retain the two-branch setup while changing conditioning. `Enc.` counts image encodings, not measured wall-clock latency. The model comparisons retain all formal negative as well as positive results.
README.md CHANGED
@@ -1,150 +1,111 @@
1
  ---
2
- library_name: pytorch
3
  tags:
4
  - robotics
5
  - world-model
6
- - visual-world-model
7
- - model-based-control
8
- - surface-vehicle
9
- - hidden-drift
10
  ---
11
 
12
- # FlowMo-WM
13
 
14
- FlowMo-WM is a visual world model for surface vehicles under hidden ambient drift. The model uses clean top-down image histories and action histories to infer a short-history object-motion state and a long-history drift context, then predicts future latent states with a zero-context residual transition.
15
 
16
- This repository contains the code, canonical datasets, trained checkpoints, evaluation outputs, GIFs, tables, and report files needed to reproduce the paper experiments.
17
 
18
- ## Repository Layout
19
 
20
- ```text
21
- data/paper/ canonical train/test splits
22
- driftwm/ simulator and flow-field code
23
- experiments/shared/ shared data, renderer, planner, metrics, model utilities
24
- experiments/flowmo/ proposed model
25
- experiments/leworldmodel/ JEPA-style latent world-model baseline
26
- experiments/planet/ PlaNet RSSM baseline
27
- experiments/tdmpc2/ TD-MPC2-style latent dynamics baseline
28
- experiments/*_los_controller/ traditional non-WM controllers
29
- experiments/reports/ prediction, probes, planning JSON, GIFs, paper tables/figures
30
- tests/ interface and pipeline tests
31
- ```
32
 
33
- ## Data
 
 
 
 
34
 
35
- The canonical paper data are:
36
 
37
- ```text
38
- data/paper/train.npz
39
- data/paper/test.npz
40
- data/paper/generation_config.json
41
- data/paper/dataset_card.md
42
- ```
43
 
44
- All learned models use the same splits, image renderer, optimizer budget, rollout targets, and evaluation protocol. Images are rendered online from simulator states as clean RGB frames. Model inputs do not include flow arrows, goal markers, velocity vectors, trajectory overlays, flow labels, or low-dimensional ground-truth state.
45
-
46
- The train split, test split, and final planning tasks use the same static flow-family set:
47
-
48
- ```text
49
- noflow
50
- uniform
51
- vortex_center
52
- double_gyre
53
- source_sink
54
- source_sink_pair
55
- gradient
56
- shear
57
- turbulent_patch
58
- random_fourier
59
  ```
60
 
61
- ## Methods
62
 
63
- Learned world models:
64
 
65
- | Directory | Report name | Role |
66
- |---|---|---|
67
- | `experiments/flowmo` | FlowMo | Proposed short-state / long-context residual world model. |
68
- | `experiments/leworldmodel` | LeWorldModel | JEPA-style image latent prediction baseline. |
69
- | `experiments/planet` | PlaNet RSSM | Recurrent state-space world-model baseline. |
70
- | `experiments/tdmpc2` | TD-MPC2 Dynamics | Compact task-oriented latent dynamics baseline. |
71
 
72
- Traditional non-WM controllers:
73
 
74
- | Directory | Report name | Role |
75
- |---|---|---|
76
- | `experiments/pid_los_controller` | PID/LOS | Hand-designed waypoint tracking baseline. |
77
- | `experiments/no_flow_los_controller` | No-Flow LOS | LOS controller that ignores ambient current. |
78
- | `experiments/current_estimator_los_controller` | Current-Estimator LOS | LOS controller with recent-drift current compensation. |
79
- | `experiments/oracle_flow_los_controller` | Oracle-Flow LOS | LOS controller with privileged true local-flow feed-forward. |
80
 
81
- Baseline definitions are in `experiments/BASELINES.md`. The complete experiment matrix is in `experiments/EXPERIMENT_MATRIX.md`.
82
 
83
- ## Install
84
 
85
- ```bash
86
- python -m venv .venv
87
- source .venv/bin/activate
88
- python -m pip install --upgrade pip
89
- python -m pip install -e .
 
90
  ```
91
 
92
- Run tests:
93
 
94
- ```bash
95
- python -m pytest -q tests
96
- ```
97
 
98
- ## Reproduce
99
 
100
- Run the complete paper pipeline:
101
 
102
- ```bash
103
- python -m experiments.run_paper_image_pipeline
 
 
 
104
  ```
105
 
106
- The command trains all learned models, evaluates prediction, runs FlowMo latent probes, evaluates planning for learned and traditional methods, generates GIFs, exports paper artifacts, and writes:
107
 
108
- ```text
109
- experiments/reports/paper_prediction.json
110
- experiments/reports/paper_flowmo_latent_probes.json
111
- experiments/reports/paper_planning/*.json
112
- experiments/reports/paper_planning/gifs/*.gif
113
- experiments/reports/paper_artifacts/
114
- experiments/reports/paper_report.md
115
- ```
116
 
117
- Stages can be rerun separately:
118
 
119
- ```bash
120
- python -m experiments.run_paper_image_pipeline --stages train
121
- python -m experiments.run_paper_image_pipeline --stages prediction
122
- python -m experiments.run_paper_image_pipeline --stages probe
123
- python -m experiments.run_paper_image_pipeline --stages planning
124
- python -m experiments.run_paper_image_pipeline --stages report
125
  ```
126
 
127
- To rebuild tables and figure-ready artifacts from existing results:
 
 
128
 
129
- ```bash
130
- python -m experiments.summarize_paper_image_results
131
- python -m experiments.export_paper_artifacts
 
132
  ```
133
 
134
- ## Formal Outputs
135
 
136
- The repository includes the current formal outputs:
137
 
138
- ```text
139
- experiments/<learned_method>/checkpoint/paper.pt
140
- experiments/<learned_method>/checkpoint/paper_step_*.pt
141
- experiments/<learned_method>/result/parameter_count.json
142
- experiments/<learned_method>/result/paper_training.json
143
- experiments/reports/paper_prediction.json
144
- experiments/reports/paper_flowmo_latent_probes.json
145
- experiments/reports/paper_planning/
146
- experiments/reports/paper_artifacts/
147
- experiments/reports/paper_report.md
148
- ```
149
 
150
- Planning JSON files record every episode, including success, final distance, trajectory length, control effort `sum_t ||a_t||_2^2`, time to goal, path, actions, and per-frame metadata. Planning GIFs render the task background with flow arrows, the oriented boat, targets, and executed trajectory.
 
1
  ---
 
2
  tags:
3
  - robotics
4
  - world-model
5
+ - visual-dynamics
6
+ - reproducibility
7
+ library_name: pytorch
 
8
  ---
9
 
10
+ # FlowMo-WM: A World Model with Object Momentum and Hidden Ambient Drift
11
 
12
+ Code, simulation inputs, trained checkpoints, numerical results and figure sources for FlowMo-WM. The [original preprint](https://arxiv.org/abs/2606.13817) and the revised manuscript describe a predictor with a recent-history state, sparse longer-history context and zero-context residual dynamics. This repository contains the original FlowMo study and its completed eight-seed follow-up controls.
13
 
14
+ The matched H60 comparison supports lower error than Recent-8 and error close to Full-32 with 16 instead of 32 image encodings. Image-encoding count is not a measured end-to-end latency improvement. The LeWorldModel-, RSSM- and TD-MPC2-style comparisons are adaptations to the common supervised pose-prediction interface, not reproductions of complete agents.
15
 
16
+ ## Rebuild the paper materials
17
 
18
+ Download this repository with the Hugging Face CLI or Git LFS. Install the analysis dependencies and run:
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ ```sh
21
+ python -m pip install -r requirements.txt
22
+ sh run.sh verify
23
+ sh run.sh figures --output outputs
24
+ ```
25
 
26
+ The command recomputes both tables and the statistics underlying the four data-derived figure assets from the retained original records. It checks all 100 plotted eight-seed estimates, including confidence intervals, and counts initial planning successes directly from 32,000 individual inferred-context episodes. It does not train a model. Outputs go to a separate directory; supplied records remain unchanged.
27
 
28
+ With Tectonic or `latexmk` installed, one command also compiles the manuscript:
 
 
 
 
 
29
 
30
+ ```sh
31
+ sh run.sh paper --output outputs --tex-engine /path/to/tectonic
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ```
33
 
34
+ The resulting manuscript is `outputs/paper/main.pdf`. The reviewed supplied PDF is in `paper/`. Figure 1 is editable PowerPoint artwork; Figure 2 is supplied environment artwork. Their reviewed exports are retained. Quantitative and rollout panels are regenerated by code. Panel fonts use Arial when available, then Liberation Sans or DejaVu Sans; a substitution can change image pixels while preserving the reported data and selection.
35
 
36
+ ## Inputs and provenance
37
 
38
+ `data/manifest.json` distinguishes three archived NPZs, two labeled NPZs restored exactly after neutral metadata normalization, and thirteen reconstructed simulation inputs generated from the recorded protocol. Every file has a release checksum and a provenance status. `DATASETS.md` describes their scope and validation.
 
 
 
 
 
39
 
40
+ The reconstructed inputs preserve the documented seeds, shapes, metadata, family counts and paired-condition design. Their original historical containers were not recovered, so equality to the original trajectories is not asserted. Archived evaluation records remain the source of published statistics; those records have not been replaced with evaluations on reconstructed inputs. The supplied original train/test and switching data are unchanged.
41
 
42
+ All simulation inputs are numerical states and commands. Clean 160-by-160 RGB observations are rendered online. Flow arrows, trajectories and goal overlays in the explanatory figures are not model inputs.
 
 
 
 
 
43
 
44
+ ## Evaluate the supplied checkpoints
45
 
46
+ The recorded Linux rebuttal runtime uses Python 3.12, PyTorch 2.12.0 with CUDA 13.0, NumPy 2.4.6, Pillow 12.2.0 and PyYAML 6.0.3. `requirements-recorded-linux.txt` records these components and the separately validated plotting dependency. A CUDA installation is required for the recorded GPU path.
47
 
48
+ ```sh
49
+ python -m pip install -r requirements-recorded-linux.txt
50
+ sh run.sh verify --models
51
+ sh run.sh replay --suites core --output runs/core
52
+ sh run.sh replay --suites family switch interventions --output runs/additional
53
+ sh run.sh replay --suites magnitude frequency scaling --output runs/stress
54
  ```
55
 
56
+ Each receipt records the actual inputs, source version, runtime, seed coverage and differences from the archived measurements. `--dry-run` prints the selected jobs without running models. `--seeds 1` selects one formal seed; `--limit-jobs` produces a receipt explicitly marked partial.
57
 
58
+ Numerical comparisons are diagnostic by default. The optional `--strict-compare --rtol ... --atol ...` makes a caller-selected tolerance an exit criterion. A tolerance is not an acceptance test for a scientific claim. In particular, reevaluations using reconstructed inputs should be read as new measurements under the recorded protocol. Cross-platform bitwise equality is not promised.
 
 
59
 
60
+ ## Train and run control experiments
61
 
62
+ The final-checkpoint rule and optimizer budgets are retained. No checkpoint selection uses evaluation results. Training writes to its own directory.
63
 
64
+ ```sh
65
+ sh run.sh train --groups all --output runs/training --dry-run
66
+ sh run.sh train --groups core --output runs/training
67
+ sh run.sh replay --suites core --training-output runs/training --output runs/new_predictions
68
+ sh run.sh control --suite formal --training-output runs/training --output runs/new_control
69
  ```
70
 
71
+ `all` specifies 108 endpoints: 4 initial models, 40 core controls, 40 held-out-family controls and 24 smaller-training-set endpoints. Core seeds are 1-8. The 2,400-episode scaling point reuses the corresponding core model. Candidate pilots are not included in paper statistics.
72
 
73
+ For the supplied checkpoints, omit `--training-output`. The formal control protocol contains four methods, six twin-boat conditions, eight seeds and thirty episodes per condition, totaling 5,760 episodes. It retains the original CEM budget, per-condition environment seeds and per-episode planner reseeding.
74
+
75
+ ## Initial protocol
 
 
 
 
 
76
 
77
+ The original published source snapshot is preserved under `protocols/initial/src/`. The initial training, prediction and planning commands select this snapshot automatically:
78
 
79
+ ```sh
80
+ sh run.sh train --groups initial --output runs/initial_training
81
+ sh run.sh replay --suites initial --output runs/initial_prediction
82
+ sh run.sh control --suite initial --output runs/initial_control
 
 
83
  ```
84
 
85
+ This matters for the initial batch-roll shuffled-context intervention and its planner random-number policy. The later rebuttal uses a cross-flow-instance context donor and explicit planner reseeding. These are distinct protocols, not interchangeable implementations of the same saved result. The later September deterministic reevaluation is retained as an earlier verification record and does not replace the August statistics used by this manuscript.
86
+
87
+ ## Generate new simulation inputs
88
 
89
+ ```sh
90
+ sh run.sh generate-data --output runs/generated_inputs --dry-run
91
+ sh run.sh generate-data --output runs/generated_inputs
92
+ sh run.sh replay --suites core --data-root runs/generated_inputs/data --output runs/generated_data_evaluation
93
  ```
94
 
95
+ The generator invokes the recorded commands and never overwrites supplied input files. A generated file receives a new provenance record; its container checksum is not substituted into the historical experiment manifest.
96
 
97
+ ## Contents
98
 
99
+ | Location | Material |
100
+ |---|---|
101
+ | `data/` | Original or explicitly reconstructed inputs and their manifest |
102
+ | `experiments/` | Rebuttal source, 108 final checkpoints, original numerical records and eight figure-used rollout GIFs |
103
+ | `protocols/` | Initial source snapshot, frozen data commands and protocol notes |
104
+ | `paper/` | Reviewed manuscript, references, tables and six figures |
105
+ | `assets/` | Editable PowerPoint architecture source |
106
+ | `provenance/` | Source mapping and verification summaries |
107
+ | `MANIFEST.json` | Checksums of the files in this release |
108
+
109
+ Spatial errors are reported as `100 * error / workspace_width`, with workspace width 10 simulator coordinates. Relative improvements use `100 * (reference - candidate) / reference`. These denominators differ. Table I's energy and step counts are conditioned on successful episodes; final distance and success rate use all episodes. Table II reports mean and sample standard deviation across seeds 1-8. H60 is the primary prediction horizon and H120 is extrapolative. Additional definitions and panel mappings are in `METRICS.md`.
110
 
111
+ Redundant GIFs, intermediate checkpoints, caches, old manuscript drafts and development logs are omitted from this release tree. The earlier Hub commit remains available in history. No new license grant is added by this update.
assets/FlowMo_WM_architecture.pptx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2a2c90fdfaed4b6f3366998318845b2d6419bddcd59f2fa9273b13a95550d23
3
+ size 1345672
control.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Run the original planning protocols with their fixed CEM settings."""
2
+ from pathlib import Path
3
+ import argparse
4
+ import json
5
+ import os
6
+ import subprocess
7
+ import sys
8
+ import time
9
+
10
+ INITIAL = ['flowmo', 'leworldmodel', 'planet', 'tdmpc2', 'pid_los_controller',
11
+ 'no_flow_los_controller', 'current_estimator_los_controller', 'oracle_flow_los_controller']
12
+ FORMAL = ['flowmo', 'history32', 'flowmo_additive', 'flowmo_film']
13
+
14
+
15
+ def main():
16
+ parser = argparse.ArgumentParser()
17
+ parser.add_argument('--package', type=Path, default=Path(__file__).resolve().parent)
18
+ parser.add_argument('--output', type=Path, required=True)
19
+ parser.add_argument('--suite', choices=['initial', 'formal'], default='formal')
20
+ parser.add_argument('--seeds', nargs='+', type=int, default=list(range(1, 9)))
21
+ parser.add_argument('--methods', nargs='+', choices=sorted(set(INITIAL + FORMAL)))
22
+ parser.add_argument('--device', default='cuda')
23
+ parser.add_argument('--training-output', type=Path, help='Output directory produced by train.py')
24
+ parser.add_argument('--smoke', action='store_true', help='One episode per selected setting, with the original planner budget')
25
+ parser.add_argument('--dry-run', action='store_true')
26
+ args = parser.parse_args()
27
+ root, out = args.package.resolve(), args.output.resolve()
28
+ work = args.training_output.resolve() if args.training_output else root
29
+ if out == root or out in root.parents or any(out == root / d or root / d in out.parents for d in ['data', 'experiments', 'paper', 'assets', 'provenance']):
30
+ raise ValueError('Choose a separate control output directory')
31
+ if any(s not in range(1, 9) for s in args.seeds):
32
+ raise ValueError('Formal seeds are 1 through 8')
33
+ cfg = json.loads((root / 'experiments/shared/config' / ('paper_image.json' if args.suite == 'initial' else 'rebuttal_v1.json')).read_text())
34
+ plan = cfg['planning_eval']
35
+ conditions = []
36
+ if args.suite == 'initial':
37
+ representative = {'reach_target': 'uniform', 'station_keeping': 'vortex_center', 'waypoint_square': 'gradient', 'waypoint_zigzag': 'random_fourier'}
38
+ for task in plan['tasks']:
39
+ for boat in plan['boats']:
40
+ for flow in ([representative[task]] if args.smoke else cfg['flow_families']):
41
+ conditions.append(dict(name=f'{task}_{boat}_{flow}', task=task, boat=boat, flow_type=flow,
42
+ magnitude_scale=1.0, dynamic=False, max_steps=plan['task_max_steps'][task]))
43
+ seeds = [None]
44
+ methods = args.methods or INITIAL
45
+ else:
46
+ conditions = plan['conditions']
47
+ seeds = args.seeds
48
+ methods = args.methods or FORMAL
49
+ jobs = []
50
+ for seed in seeds:
51
+ cp = 'paper.pt' if seed is None else f'rebuttal_core_seed_{seed:04d}.pt'
52
+ for i, cond in enumerate(conditions):
53
+ name = f'initial/{cond["name"]}' if seed is None else f'formal/seed_{seed:04d}/{cond["name"]}'
54
+ destination = out / name
55
+ cmd = [sys.executable, '-m', 'experiments.evaluate_image_planning', '--methods', *methods,
56
+ '--task', cond['task'], '--boat', cond['boat'], '--flow-type', cond['flow_type'],
57
+ '--flow-magnitude-scale', str(cond['magnitude_scale']), '--episodes', '1' if args.smoke else str(plan['episodes']),
58
+ '--max-steps', str(cond['max_steps']), '--history-len', '32', '--image-size', '160', '--visual-scale', '2.5',
59
+ '--checkpoint-name', cp, '--context-modes', 'inferred', '--success-radius', str(plan.get('success_radius', .65)),
60
+ '--make-gifs', '0', '--seed', '33' if seed is None else str(7300 + i*100),
61
+ '--device', args.device, '--precision', 'fp32', '--out', str(destination)]
62
+ for key, value in plan.items():
63
+ if key.startswith('cem_'):
64
+ cmd += ['--' + key.replace('_', '-'), str(value)]
65
+ if args.suite == 'initial':
66
+ for flag in ['--flow-magnitude-scale', '--context-modes']:
67
+ index = cmd.index(flag)
68
+ del cmd[index:index + 2]
69
+ if cond['dynamic']:
70
+ cmd += ['--flow-temporal-amplitude', '0.45', '--flow-temporal-frequency', '0.08', '--flow-rotation-amplitude', '0.65']
71
+ jobs.append(dict(name=name, methods=methods, checkpoint=cp, command=cmd,
72
+ source_tree='protocols/initial/src' if args.suite == 'initial' else '.'))
73
+ if args.dry_run:
74
+ print(json.dumps({'smoke': args.smoke, 'jobs': jobs}, indent=2))
75
+ return
76
+ out.mkdir(parents=True, exist_ok=True)
77
+ env = os.environ.copy()
78
+ env['PYTHONPATH'] = str(root) + os.pathsep + env.get('PYTHONPATH', '')
79
+ env['OMP_NUM_THREADS'] = '1'
80
+ env['PYTHONPYCACHEPREFIX'] = str(out / 'pycache')
81
+ completed = []
82
+ for job in jobs:
83
+ env['PYTHONPATH'] = str(root / job['source_tree']) + os.pathsep + str(root)
84
+ dest = out / job['name']
85
+ if dest.is_dir() and any(dest.glob('*.json')):
86
+ raise FileExistsError(f'Control outputs already exist: {dest}')
87
+ dest.mkdir(parents=True, exist_ok=True)
88
+ started = time.monotonic()
89
+ with (dest / 'execution.log').open('w') as log:
90
+ subprocess.run(job['command'], cwd=work, env=env, stdout=log, stderr=subprocess.STDOUT, check=True)
91
+ assert list(dest.glob('*.json'))
92
+ completed.append(dict(name=job['name'], elapsed_seconds=time.monotonic() - started))
93
+ (out / 'control_receipt.json').write_text(json.dumps({'smoke': args.smoke, 'suite': args.suite,
94
+ 'completed': len(completed), 'planned': len(jobs), 'jobs': completed}, indent=2))
95
+ print(json.dumps(completed[-1]), flush=True)
96
+
97
+
98
+ if __name__ == '__main__':
99
+ main()
data/manifest.json ADDED
@@ -0,0 +1,3329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "description": "Release integrity and input provenance; reconstructed inputs are not asserted identical to missing historical trajectories.",
3
+ "datasets": [
4
+ {
5
+ "path": "data/paper/test.npz",
6
+ "status": "archived_original",
7
+ "sha256": "2d63357e9d4502a3ff9e7ee1420065e18e6ae62840853ac7fe886d1aac926a9a",
8
+ "historical_container_sha256": "2d63357e9d4502a3ff9e7ee1420065e18e6ae62840853ac7fe886d1aac926a9a",
9
+ "historical_container_exact": true,
10
+ "bytes": 6323010,
11
+ "arrays": {
12
+ "obs": {
13
+ "shape": [
14
+ 480,
15
+ 301,
16
+ 4
17
+ ],
18
+ "dtype": "float32"
19
+ },
20
+ "actions": {
21
+ "shape": [
22
+ 480,
23
+ 300,
24
+ 3
25
+ ],
26
+ "dtype": "float32"
27
+ },
28
+ "states": {
29
+ "shape": [
30
+ 480,
31
+ 301,
32
+ 9
33
+ ],
34
+ "dtype": "float32"
35
+ },
36
+ "true_flow": {
37
+ "shape": [
38
+ 480,
39
+ 301,
40
+ 2
41
+ ],
42
+ "dtype": "float32"
43
+ },
44
+ "boat_ids": {
45
+ "shape": [
46
+ 480
47
+ ],
48
+ "dtype": "int64"
49
+ },
50
+ "action_dims": {
51
+ "shape": [
52
+ 480
53
+ ],
54
+ "dtype": "int64"
55
+ },
56
+ "flow_type_ids": {
57
+ "shape": [
58
+ 480
59
+ ],
60
+ "dtype": "int64"
61
+ },
62
+ "flow_ids": {
63
+ "shape": [
64
+ 480
65
+ ],
66
+ "dtype": "int64"
67
+ },
68
+ "traj_type_ids": {
69
+ "shape": [
70
+ 480
71
+ ],
72
+ "dtype": "int64"
73
+ }
74
+ },
75
+ "metadata": {
76
+ "boats": {
77
+ "twin": 0,
78
+ "triangle": 1
79
+ },
80
+ "flows": {
81
+ "noflow": 0,
82
+ "uniform": 1,
83
+ "vortex_center": 2,
84
+ "double_gyre": 3,
85
+ "source_sink": 4,
86
+ "source_sink_pair": 5,
87
+ "gradient": 6,
88
+ "shear": 7,
89
+ "turbulent_patch": 8,
90
+ "random_fourier": 9
91
+ },
92
+ "trajectories": {
93
+ "noflow_random_action": 0,
94
+ "noflow_action_then_zero": 1,
95
+ "flow_zero_action": 2,
96
+ "flow_active_control": 3,
97
+ "flow_waypoint_control": 4
98
+ },
99
+ "steps": 300,
100
+ "workspace": [
101
+ 0.0,
102
+ 10.0,
103
+ 0.0,
104
+ 10.0
105
+ ],
106
+ "boundary": "terminate",
107
+ "seed": 4302,
108
+ "max_action_dim": 3,
109
+ "flow_pool_size": 80
110
+ },
111
+ "counts": {
112
+ "boat_ids": {
113
+ "0": 219,
114
+ "1": 261
115
+ },
116
+ "flow_type_ids": {
117
+ "0": 121,
118
+ "1": 39,
119
+ "2": 39,
120
+ "3": 51,
121
+ "4": 46,
122
+ "5": 46,
123
+ "6": 30,
124
+ "7": 32,
125
+ "8": 47,
126
+ "9": 29
127
+ },
128
+ "traj_type_ids": {
129
+ "0": 57,
130
+ "1": 64,
131
+ "2": 75,
132
+ "3": 134,
133
+ "4": 150
134
+ }
135
+ },
136
+ "content_checks": {
137
+ "finite_arrays": true
138
+ }
139
+ },
140
+ {
141
+ "path": "data/paper/train.npz",
142
+ "status": "archived_original",
143
+ "sha256": "694da292a0345412ce295933b20abe0c7176ac472923821ff4f72326ca8fcbe5",
144
+ "historical_container_sha256": "694da292a0345412ce295933b20abe0c7176ac472923821ff4f72326ca8fcbe5",
145
+ "historical_container_exact": true,
146
+ "bytes": 31936052,
147
+ "arrays": {
148
+ "obs": {
149
+ "shape": [
150
+ 2400,
151
+ 301,
152
+ 4
153
+ ],
154
+ "dtype": "float32"
155
+ },
156
+ "actions": {
157
+ "shape": [
158
+ 2400,
159
+ 300,
160
+ 3
161
+ ],
162
+ "dtype": "float32"
163
+ },
164
+ "states": {
165
+ "shape": [
166
+ 2400,
167
+ 301,
168
+ 9
169
+ ],
170
+ "dtype": "float32"
171
+ },
172
+ "true_flow": {
173
+ "shape": [
174
+ 2400,
175
+ 301,
176
+ 2
177
+ ],
178
+ "dtype": "float32"
179
+ },
180
+ "boat_ids": {
181
+ "shape": [
182
+ 2400
183
+ ],
184
+ "dtype": "int64"
185
+ },
186
+ "action_dims": {
187
+ "shape": [
188
+ 2400
189
+ ],
190
+ "dtype": "int64"
191
+ },
192
+ "flow_type_ids": {
193
+ "shape": [
194
+ 2400
195
+ ],
196
+ "dtype": "int64"
197
+ },
198
+ "flow_ids": {
199
+ "shape": [
200
+ 2400
201
+ ],
202
+ "dtype": "int64"
203
+ },
204
+ "traj_type_ids": {
205
+ "shape": [
206
+ 2400
207
+ ],
208
+ "dtype": "int64"
209
+ }
210
+ },
211
+ "metadata": {
212
+ "boats": {
213
+ "twin": 0,
214
+ "triangle": 1
215
+ },
216
+ "flows": {
217
+ "noflow": 0,
218
+ "uniform": 1,
219
+ "vortex_center": 2,
220
+ "double_gyre": 3,
221
+ "source_sink": 4,
222
+ "source_sink_pair": 5,
223
+ "gradient": 6,
224
+ "shear": 7,
225
+ "turbulent_patch": 8,
226
+ "random_fourier": 9
227
+ },
228
+ "trajectories": {
229
+ "noflow_random_action": 0,
230
+ "noflow_action_then_zero": 1,
231
+ "flow_zero_action": 2,
232
+ "flow_active_control": 3,
233
+ "flow_waypoint_control": 4
234
+ },
235
+ "steps": 300,
236
+ "workspace": [
237
+ 0.0,
238
+ 10.0,
239
+ 0.0,
240
+ 10.0
241
+ ],
242
+ "boundary": "terminate",
243
+ "seed": 4301,
244
+ "max_action_dim": 3,
245
+ "flow_pool_size": 80
246
+ },
247
+ "counts": {
248
+ "boat_ids": {
249
+ "0": 1145,
250
+ "1": 1255
251
+ },
252
+ "flow_type_ids": {
253
+ "0": 679,
254
+ "1": 186,
255
+ "2": 179,
256
+ "3": 189,
257
+ "4": 201,
258
+ "5": 176,
259
+ "6": 194,
260
+ "7": 204,
261
+ "8": 199,
262
+ "9": 193
263
+ },
264
+ "traj_type_ids": {
265
+ "0": 313,
266
+ "1": 366,
267
+ "2": 368,
268
+ "3": 669,
269
+ "4": 684
270
+ }
271
+ },
272
+ "content_checks": {
273
+ "finite_arrays": true
274
+ }
275
+ },
276
+ {
277
+ "path": "data/rebuttal/dynamic_frequency_sweep/test_freq_0020mhz.npz",
278
+ "status": "reconstructed_from_recorded_protocol",
279
+ "sha256": "cb0eb08880ea463f75f96e409413dabe6890fc014ab089c47eb4fb6cd4d272e7",
280
+ "historical_container_sha256": "9b2d9e0ca35f1df548ce5a3a0453895c04cc12a6ae8ba013c65324c922f4c62f",
281
+ "historical_container_exact": false,
282
+ "bytes": 6575731,
283
+ "arrays": {
284
+ "obs": {
285
+ "shape": [
286
+ 480,
287
+ 301,
288
+ 4
289
+ ],
290
+ "dtype": "float32"
291
+ },
292
+ "actions": {
293
+ "shape": [
294
+ 480,
295
+ 300,
296
+ 3
297
+ ],
298
+ "dtype": "float32"
299
+ },
300
+ "states": {
301
+ "shape": [
302
+ 480,
303
+ 301,
304
+ 9
305
+ ],
306
+ "dtype": "float32"
307
+ },
308
+ "true_flow": {
309
+ "shape": [
310
+ 480,
311
+ 301,
312
+ 2
313
+ ],
314
+ "dtype": "float32"
315
+ },
316
+ "boat_ids": {
317
+ "shape": [
318
+ 480
319
+ ],
320
+ "dtype": "int64"
321
+ },
322
+ "action_dims": {
323
+ "shape": [
324
+ 480
325
+ ],
326
+ "dtype": "int64"
327
+ },
328
+ "flow_type_ids": {
329
+ "shape": [
330
+ 480
331
+ ],
332
+ "dtype": "int64"
333
+ },
334
+ "flow_ids": {
335
+ "shape": [
336
+ 480
337
+ ],
338
+ "dtype": "int64"
339
+ },
340
+ "traj_type_ids": {
341
+ "shape": [
342
+ 480
343
+ ],
344
+ "dtype": "int64"
345
+ },
346
+ "boat_params": {
347
+ "shape": [
348
+ 480,
349
+ 10
350
+ ],
351
+ "dtype": "float32"
352
+ }
353
+ },
354
+ "metadata": {
355
+ "boats": {
356
+ "twin": 0,
357
+ "triangle": 1
358
+ },
359
+ "flows": {
360
+ "noflow": 0,
361
+ "uniform": 1,
362
+ "vortex_center": 2,
363
+ "double_gyre": 3,
364
+ "source_sink": 4,
365
+ "source_sink_pair": 5,
366
+ "gradient": 6,
367
+ "shear": 7,
368
+ "turbulent_patch": 8,
369
+ "random_fourier": 9
370
+ },
371
+ "trajectories": {
372
+ "noflow_random_action": 0,
373
+ "noflow_action_then_zero": 1,
374
+ "flow_zero_action": 2,
375
+ "flow_active_control": 3,
376
+ "flow_waypoint_control": 4
377
+ },
378
+ "steps": 300,
379
+ "workspace": [
380
+ 0.0,
381
+ 10.0,
382
+ 0.0,
383
+ 10.0
384
+ ],
385
+ "boundary": "terminate",
386
+ "seed": 5302,
387
+ "max_action_dim": 3,
388
+ "flow_pool_size": 80,
389
+ "episode_rng_mode": "indexed",
390
+ "boat_param_names": [
391
+ "mass",
392
+ "inertia",
393
+ "t_max",
394
+ "drag_linear_x",
395
+ "drag_linear_y",
396
+ "drag_quad_x",
397
+ "drag_quad_y",
398
+ "drag_angular",
399
+ "drag_angular_quad",
400
+ "actuator_tau"
401
+ ],
402
+ "flow_transform": {
403
+ "magnitude_scale": 1.0,
404
+ "temporal_amplitude": 0.45,
405
+ "temporal_frequency": 0.02,
406
+ "rotation_amplitude": 0.65
407
+ },
408
+ "flow_switching": {
409
+ "enabled": false,
410
+ "interval_steps": 0,
411
+ "switch_steps": [],
412
+ "distinct_consecutive_families": false
413
+ }
414
+ },
415
+ "counts": {
416
+ "boat_ids": {
417
+ "0": 236,
418
+ "1": 244
419
+ },
420
+ "flow_type_ids": {
421
+ "0": 125,
422
+ "1": 48,
423
+ "2": 47,
424
+ "3": 32,
425
+ "4": 40,
426
+ "5": 36,
427
+ "6": 39,
428
+ "7": 38,
429
+ "8": 35,
430
+ "9": 40
431
+ },
432
+ "traj_type_ids": {
433
+ "0": 76,
434
+ "1": 49,
435
+ "2": 70,
436
+ "3": 132,
437
+ "4": 153
438
+ }
439
+ },
440
+ "content_checks": {
441
+ "finite_arrays": true
442
+ }
443
+ },
444
+ {
445
+ "path": "data/rebuttal/dynamic_frequency_sweep/test_freq_0040mhz.npz",
446
+ "status": "reconstructed_from_recorded_protocol",
447
+ "sha256": "a5d8f5f6d5a8492297de51195f4ca9ac251358264b0221e28f96557c9365c9cf",
448
+ "historical_container_sha256": "8d7cce960f7a1b4a72eb232cbda30fdabf964dd6c680518641b2a7e548925b94",
449
+ "historical_container_exact": false,
450
+ "bytes": 6601726,
451
+ "arrays": {
452
+ "obs": {
453
+ "shape": [
454
+ 480,
455
+ 301,
456
+ 4
457
+ ],
458
+ "dtype": "float32"
459
+ },
460
+ "actions": {
461
+ "shape": [
462
+ 480,
463
+ 300,
464
+ 3
465
+ ],
466
+ "dtype": "float32"
467
+ },
468
+ "states": {
469
+ "shape": [
470
+ 480,
471
+ 301,
472
+ 9
473
+ ],
474
+ "dtype": "float32"
475
+ },
476
+ "true_flow": {
477
+ "shape": [
478
+ 480,
479
+ 301,
480
+ 2
481
+ ],
482
+ "dtype": "float32"
483
+ },
484
+ "boat_ids": {
485
+ "shape": [
486
+ 480
487
+ ],
488
+ "dtype": "int64"
489
+ },
490
+ "action_dims": {
491
+ "shape": [
492
+ 480
493
+ ],
494
+ "dtype": "int64"
495
+ },
496
+ "flow_type_ids": {
497
+ "shape": [
498
+ 480
499
+ ],
500
+ "dtype": "int64"
501
+ },
502
+ "flow_ids": {
503
+ "shape": [
504
+ 480
505
+ ],
506
+ "dtype": "int64"
507
+ },
508
+ "traj_type_ids": {
509
+ "shape": [
510
+ 480
511
+ ],
512
+ "dtype": "int64"
513
+ },
514
+ "boat_params": {
515
+ "shape": [
516
+ 480,
517
+ 10
518
+ ],
519
+ "dtype": "float32"
520
+ }
521
+ },
522
+ "metadata": {
523
+ "boats": {
524
+ "twin": 0,
525
+ "triangle": 1
526
+ },
527
+ "flows": {
528
+ "noflow": 0,
529
+ "uniform": 1,
530
+ "vortex_center": 2,
531
+ "double_gyre": 3,
532
+ "source_sink": 4,
533
+ "source_sink_pair": 5,
534
+ "gradient": 6,
535
+ "shear": 7,
536
+ "turbulent_patch": 8,
537
+ "random_fourier": 9
538
+ },
539
+ "trajectories": {
540
+ "noflow_random_action": 0,
541
+ "noflow_action_then_zero": 1,
542
+ "flow_zero_action": 2,
543
+ "flow_active_control": 3,
544
+ "flow_waypoint_control": 4
545
+ },
546
+ "steps": 300,
547
+ "workspace": [
548
+ 0.0,
549
+ 10.0,
550
+ 0.0,
551
+ 10.0
552
+ ],
553
+ "boundary": "terminate",
554
+ "seed": 5302,
555
+ "max_action_dim": 3,
556
+ "flow_pool_size": 80,
557
+ "episode_rng_mode": "indexed",
558
+ "boat_param_names": [
559
+ "mass",
560
+ "inertia",
561
+ "t_max",
562
+ "drag_linear_x",
563
+ "drag_linear_y",
564
+ "drag_quad_x",
565
+ "drag_quad_y",
566
+ "drag_angular",
567
+ "drag_angular_quad",
568
+ "actuator_tau"
569
+ ],
570
+ "flow_transform": {
571
+ "magnitude_scale": 1.0,
572
+ "temporal_amplitude": 0.45,
573
+ "temporal_frequency": 0.04,
574
+ "rotation_amplitude": 0.65
575
+ },
576
+ "flow_switching": {
577
+ "enabled": false,
578
+ "interval_steps": 0,
579
+ "switch_steps": [],
580
+ "distinct_consecutive_families": false
581
+ }
582
+ },
583
+ "counts": {
584
+ "boat_ids": {
585
+ "0": 236,
586
+ "1": 244
587
+ },
588
+ "flow_type_ids": {
589
+ "0": 125,
590
+ "1": 48,
591
+ "2": 47,
592
+ "3": 32,
593
+ "4": 40,
594
+ "5": 36,
595
+ "6": 39,
596
+ "7": 38,
597
+ "8": 35,
598
+ "9": 40
599
+ },
600
+ "traj_type_ids": {
601
+ "0": 76,
602
+ "1": 49,
603
+ "2": 70,
604
+ "3": 132,
605
+ "4": 153
606
+ }
607
+ },
608
+ "content_checks": {
609
+ "finite_arrays": true
610
+ }
611
+ },
612
+ {
613
+ "path": "data/rebuttal/dynamic_frequency_sweep/test_freq_0160mhz.npz",
614
+ "status": "reconstructed_from_recorded_protocol",
615
+ "sha256": "e7dd0008cbdae43f55dba8a0c1eeb329ef3389c7daf98521230092cb2eab40f1",
616
+ "historical_container_sha256": "669c38eb1049946856287de66ea46b1de5092a7d1c641dbcca32411085f006cb",
617
+ "historical_container_exact": false,
618
+ "bytes": 6542097,
619
+ "arrays": {
620
+ "obs": {
621
+ "shape": [
622
+ 480,
623
+ 301,
624
+ 4
625
+ ],
626
+ "dtype": "float32"
627
+ },
628
+ "actions": {
629
+ "shape": [
630
+ 480,
631
+ 300,
632
+ 3
633
+ ],
634
+ "dtype": "float32"
635
+ },
636
+ "states": {
637
+ "shape": [
638
+ 480,
639
+ 301,
640
+ 9
641
+ ],
642
+ "dtype": "float32"
643
+ },
644
+ "true_flow": {
645
+ "shape": [
646
+ 480,
647
+ 301,
648
+ 2
649
+ ],
650
+ "dtype": "float32"
651
+ },
652
+ "boat_ids": {
653
+ "shape": [
654
+ 480
655
+ ],
656
+ "dtype": "int64"
657
+ },
658
+ "action_dims": {
659
+ "shape": [
660
+ 480
661
+ ],
662
+ "dtype": "int64"
663
+ },
664
+ "flow_type_ids": {
665
+ "shape": [
666
+ 480
667
+ ],
668
+ "dtype": "int64"
669
+ },
670
+ "flow_ids": {
671
+ "shape": [
672
+ 480
673
+ ],
674
+ "dtype": "int64"
675
+ },
676
+ "traj_type_ids": {
677
+ "shape": [
678
+ 480
679
+ ],
680
+ "dtype": "int64"
681
+ },
682
+ "boat_params": {
683
+ "shape": [
684
+ 480,
685
+ 10
686
+ ],
687
+ "dtype": "float32"
688
+ }
689
+ },
690
+ "metadata": {
691
+ "boats": {
692
+ "twin": 0,
693
+ "triangle": 1
694
+ },
695
+ "flows": {
696
+ "noflow": 0,
697
+ "uniform": 1,
698
+ "vortex_center": 2,
699
+ "double_gyre": 3,
700
+ "source_sink": 4,
701
+ "source_sink_pair": 5,
702
+ "gradient": 6,
703
+ "shear": 7,
704
+ "turbulent_patch": 8,
705
+ "random_fourier": 9
706
+ },
707
+ "trajectories": {
708
+ "noflow_random_action": 0,
709
+ "noflow_action_then_zero": 1,
710
+ "flow_zero_action": 2,
711
+ "flow_active_control": 3,
712
+ "flow_waypoint_control": 4
713
+ },
714
+ "steps": 300,
715
+ "workspace": [
716
+ 0.0,
717
+ 10.0,
718
+ 0.0,
719
+ 10.0
720
+ ],
721
+ "boundary": "terminate",
722
+ "seed": 5302,
723
+ "max_action_dim": 3,
724
+ "flow_pool_size": 80,
725
+ "episode_rng_mode": "indexed",
726
+ "boat_param_names": [
727
+ "mass",
728
+ "inertia",
729
+ "t_max",
730
+ "drag_linear_x",
731
+ "drag_linear_y",
732
+ "drag_quad_x",
733
+ "drag_quad_y",
734
+ "drag_angular",
735
+ "drag_angular_quad",
736
+ "actuator_tau"
737
+ ],
738
+ "flow_transform": {
739
+ "magnitude_scale": 1.0,
740
+ "temporal_amplitude": 0.45,
741
+ "temporal_frequency": 0.16,
742
+ "rotation_amplitude": 0.65
743
+ },
744
+ "flow_switching": {
745
+ "enabled": false,
746
+ "interval_steps": 0,
747
+ "switch_steps": [],
748
+ "distinct_consecutive_families": false
749
+ }
750
+ },
751
+ "counts": {
752
+ "boat_ids": {
753
+ "0": 236,
754
+ "1": 244
755
+ },
756
+ "flow_type_ids": {
757
+ "0": 125,
758
+ "1": 48,
759
+ "2": 47,
760
+ "3": 32,
761
+ "4": 40,
762
+ "5": 36,
763
+ "6": 39,
764
+ "7": 38,
765
+ "8": 35,
766
+ "9": 40
767
+ },
768
+ "traj_type_ids": {
769
+ "0": 76,
770
+ "1": 49,
771
+ "2": 70,
772
+ "3": 132,
773
+ "4": 153
774
+ }
775
+ },
776
+ "content_checks": {
777
+ "finite_arrays": true
778
+ }
779
+ },
780
+ {
781
+ "path": "data/rebuttal/dynamic_frequency_sweep/test_freq_0320mhz.npz",
782
+ "status": "reconstructed_from_recorded_protocol",
783
+ "sha256": "2a12b66bae04c44f220550d10aba0f47ccbf54f11a57612dcd774897d4962102",
784
+ "historical_container_sha256": "18bef3acaeef334011ea92d85c88b19237ce065a9a4b0ab59f7b49fb39730c4d",
785
+ "historical_container_exact": false,
786
+ "bytes": 6553777,
787
+ "arrays": {
788
+ "obs": {
789
+ "shape": [
790
+ 480,
791
+ 301,
792
+ 4
793
+ ],
794
+ "dtype": "float32"
795
+ },
796
+ "actions": {
797
+ "shape": [
798
+ 480,
799
+ 300,
800
+ 3
801
+ ],
802
+ "dtype": "float32"
803
+ },
804
+ "states": {
805
+ "shape": [
806
+ 480,
807
+ 301,
808
+ 9
809
+ ],
810
+ "dtype": "float32"
811
+ },
812
+ "true_flow": {
813
+ "shape": [
814
+ 480,
815
+ 301,
816
+ 2
817
+ ],
818
+ "dtype": "float32"
819
+ },
820
+ "boat_ids": {
821
+ "shape": [
822
+ 480
823
+ ],
824
+ "dtype": "int64"
825
+ },
826
+ "action_dims": {
827
+ "shape": [
828
+ 480
829
+ ],
830
+ "dtype": "int64"
831
+ },
832
+ "flow_type_ids": {
833
+ "shape": [
834
+ 480
835
+ ],
836
+ "dtype": "int64"
837
+ },
838
+ "flow_ids": {
839
+ "shape": [
840
+ 480
841
+ ],
842
+ "dtype": "int64"
843
+ },
844
+ "traj_type_ids": {
845
+ "shape": [
846
+ 480
847
+ ],
848
+ "dtype": "int64"
849
+ },
850
+ "boat_params": {
851
+ "shape": [
852
+ 480,
853
+ 10
854
+ ],
855
+ "dtype": "float32"
856
+ }
857
+ },
858
+ "metadata": {
859
+ "boats": {
860
+ "twin": 0,
861
+ "triangle": 1
862
+ },
863
+ "flows": {
864
+ "noflow": 0,
865
+ "uniform": 1,
866
+ "vortex_center": 2,
867
+ "double_gyre": 3,
868
+ "source_sink": 4,
869
+ "source_sink_pair": 5,
870
+ "gradient": 6,
871
+ "shear": 7,
872
+ "turbulent_patch": 8,
873
+ "random_fourier": 9
874
+ },
875
+ "trajectories": {
876
+ "noflow_random_action": 0,
877
+ "noflow_action_then_zero": 1,
878
+ "flow_zero_action": 2,
879
+ "flow_active_control": 3,
880
+ "flow_waypoint_control": 4
881
+ },
882
+ "steps": 300,
883
+ "workspace": [
884
+ 0.0,
885
+ 10.0,
886
+ 0.0,
887
+ 10.0
888
+ ],
889
+ "boundary": "terminate",
890
+ "seed": 5302,
891
+ "max_action_dim": 3,
892
+ "flow_pool_size": 80,
893
+ "episode_rng_mode": "indexed",
894
+ "boat_param_names": [
895
+ "mass",
896
+ "inertia",
897
+ "t_max",
898
+ "drag_linear_x",
899
+ "drag_linear_y",
900
+ "drag_quad_x",
901
+ "drag_quad_y",
902
+ "drag_angular",
903
+ "drag_angular_quad",
904
+ "actuator_tau"
905
+ ],
906
+ "flow_transform": {
907
+ "magnitude_scale": 1.0,
908
+ "temporal_amplitude": 0.45,
909
+ "temporal_frequency": 0.32,
910
+ "rotation_amplitude": 0.65
911
+ },
912
+ "flow_switching": {
913
+ "enabled": false,
914
+ "interval_steps": 0,
915
+ "switch_steps": [],
916
+ "distinct_consecutive_families": false
917
+ }
918
+ },
919
+ "counts": {
920
+ "boat_ids": {
921
+ "0": 236,
922
+ "1": 244
923
+ },
924
+ "flow_type_ids": {
925
+ "0": 125,
926
+ "1": 48,
927
+ "2": 47,
928
+ "3": 32,
929
+ "4": 40,
930
+ "5": 36,
931
+ "6": 39,
932
+ "7": 38,
933
+ "8": 35,
934
+ "9": 40
935
+ },
936
+ "traj_type_ids": {
937
+ "0": 76,
938
+ "1": 49,
939
+ "2": 70,
940
+ "3": 132,
941
+ "4": 153
942
+ }
943
+ },
944
+ "content_checks": {
945
+ "finite_arrays": true
946
+ }
947
+ },
948
+ {
949
+ "path": "data/rebuttal/dynamic_frequency_sweep/test_freq_0640mhz.npz",
950
+ "status": "reconstructed_from_recorded_protocol",
951
+ "sha256": "0c7aa5ddb26d6a9723e7c0eeab0ec71002157ff2a431c738980ad733db082986",
952
+ "historical_container_sha256": "246fa3a506762b7b54b3770fc6c3e0dfd2459037e676edf54d9adbd24049f7cb",
953
+ "historical_container_exact": false,
954
+ "bytes": 6541317,
955
+ "arrays": {
956
+ "obs": {
957
+ "shape": [
958
+ 480,
959
+ 301,
960
+ 4
961
+ ],
962
+ "dtype": "float32"
963
+ },
964
+ "actions": {
965
+ "shape": [
966
+ 480,
967
+ 300,
968
+ 3
969
+ ],
970
+ "dtype": "float32"
971
+ },
972
+ "states": {
973
+ "shape": [
974
+ 480,
975
+ 301,
976
+ 9
977
+ ],
978
+ "dtype": "float32"
979
+ },
980
+ "true_flow": {
981
+ "shape": [
982
+ 480,
983
+ 301,
984
+ 2
985
+ ],
986
+ "dtype": "float32"
987
+ },
988
+ "boat_ids": {
989
+ "shape": [
990
+ 480
991
+ ],
992
+ "dtype": "int64"
993
+ },
994
+ "action_dims": {
995
+ "shape": [
996
+ 480
997
+ ],
998
+ "dtype": "int64"
999
+ },
1000
+ "flow_type_ids": {
1001
+ "shape": [
1002
+ 480
1003
+ ],
1004
+ "dtype": "int64"
1005
+ },
1006
+ "flow_ids": {
1007
+ "shape": [
1008
+ 480
1009
+ ],
1010
+ "dtype": "int64"
1011
+ },
1012
+ "traj_type_ids": {
1013
+ "shape": [
1014
+ 480
1015
+ ],
1016
+ "dtype": "int64"
1017
+ },
1018
+ "boat_params": {
1019
+ "shape": [
1020
+ 480,
1021
+ 10
1022
+ ],
1023
+ "dtype": "float32"
1024
+ }
1025
+ },
1026
+ "metadata": {
1027
+ "boats": {
1028
+ "twin": 0,
1029
+ "triangle": 1
1030
+ },
1031
+ "flows": {
1032
+ "noflow": 0,
1033
+ "uniform": 1,
1034
+ "vortex_center": 2,
1035
+ "double_gyre": 3,
1036
+ "source_sink": 4,
1037
+ "source_sink_pair": 5,
1038
+ "gradient": 6,
1039
+ "shear": 7,
1040
+ "turbulent_patch": 8,
1041
+ "random_fourier": 9
1042
+ },
1043
+ "trajectories": {
1044
+ "noflow_random_action": 0,
1045
+ "noflow_action_then_zero": 1,
1046
+ "flow_zero_action": 2,
1047
+ "flow_active_control": 3,
1048
+ "flow_waypoint_control": 4
1049
+ },
1050
+ "steps": 300,
1051
+ "workspace": [
1052
+ 0.0,
1053
+ 10.0,
1054
+ 0.0,
1055
+ 10.0
1056
+ ],
1057
+ "boundary": "terminate",
1058
+ "seed": 5302,
1059
+ "max_action_dim": 3,
1060
+ "flow_pool_size": 80,
1061
+ "episode_rng_mode": "indexed",
1062
+ "boat_param_names": [
1063
+ "mass",
1064
+ "inertia",
1065
+ "t_max",
1066
+ "drag_linear_x",
1067
+ "drag_linear_y",
1068
+ "drag_quad_x",
1069
+ "drag_quad_y",
1070
+ "drag_angular",
1071
+ "drag_angular_quad",
1072
+ "actuator_tau"
1073
+ ],
1074
+ "flow_transform": {
1075
+ "magnitude_scale": 1.0,
1076
+ "temporal_amplitude": 0.45,
1077
+ "temporal_frequency": 0.64,
1078
+ "rotation_amplitude": 0.65
1079
+ },
1080
+ "flow_switching": {
1081
+ "enabled": false,
1082
+ "interval_steps": 0,
1083
+ "switch_steps": [],
1084
+ "distinct_consecutive_families": false
1085
+ }
1086
+ },
1087
+ "counts": {
1088
+ "boat_ids": {
1089
+ "0": 236,
1090
+ "1": 244
1091
+ },
1092
+ "flow_type_ids": {
1093
+ "0": 125,
1094
+ "1": 48,
1095
+ "2": 47,
1096
+ "3": 32,
1097
+ "4": 40,
1098
+ "5": 36,
1099
+ "6": 39,
1100
+ "7": 38,
1101
+ "8": 35,
1102
+ "9": 40
1103
+ },
1104
+ "traj_type_ids": {
1105
+ "0": 76,
1106
+ "1": 49,
1107
+ "2": 70,
1108
+ "3": 132,
1109
+ "4": 153
1110
+ }
1111
+ },
1112
+ "content_checks": {
1113
+ "finite_arrays": true
1114
+ }
1115
+ },
1116
+ {
1117
+ "path": "data/rebuttal/test_dynamic_slow.npz",
1118
+ "status": "reconstructed_from_recorded_protocol",
1119
+ "sha256": "7b1777f57ae41971e8a59ab94555e9d67319452e0b56de2c833ef5d20bc15a53",
1120
+ "historical_container_sha256": "92458aa4702ab985dfc3fa4fccb8c2177213d3f9368c192753b9b6a0c65a4f6a",
1121
+ "historical_container_exact": false,
1122
+ "bytes": 6597908,
1123
+ "arrays": {
1124
+ "obs": {
1125
+ "shape": [
1126
+ 480,
1127
+ 301,
1128
+ 4
1129
+ ],
1130
+ "dtype": "float32"
1131
+ },
1132
+ "actions": {
1133
+ "shape": [
1134
+ 480,
1135
+ 300,
1136
+ 3
1137
+ ],
1138
+ "dtype": "float32"
1139
+ },
1140
+ "states": {
1141
+ "shape": [
1142
+ 480,
1143
+ 301,
1144
+ 9
1145
+ ],
1146
+ "dtype": "float32"
1147
+ },
1148
+ "true_flow": {
1149
+ "shape": [
1150
+ 480,
1151
+ 301,
1152
+ 2
1153
+ ],
1154
+ "dtype": "float32"
1155
+ },
1156
+ "boat_ids": {
1157
+ "shape": [
1158
+ 480
1159
+ ],
1160
+ "dtype": "int64"
1161
+ },
1162
+ "action_dims": {
1163
+ "shape": [
1164
+ 480
1165
+ ],
1166
+ "dtype": "int64"
1167
+ },
1168
+ "flow_type_ids": {
1169
+ "shape": [
1170
+ 480
1171
+ ],
1172
+ "dtype": "int64"
1173
+ },
1174
+ "flow_ids": {
1175
+ "shape": [
1176
+ 480
1177
+ ],
1178
+ "dtype": "int64"
1179
+ },
1180
+ "traj_type_ids": {
1181
+ "shape": [
1182
+ 480
1183
+ ],
1184
+ "dtype": "int64"
1185
+ },
1186
+ "boat_params": {
1187
+ "shape": [
1188
+ 480,
1189
+ 10
1190
+ ],
1191
+ "dtype": "float32"
1192
+ }
1193
+ },
1194
+ "metadata": {
1195
+ "boats": {
1196
+ "twin": 0,
1197
+ "triangle": 1
1198
+ },
1199
+ "flows": {
1200
+ "noflow": 0,
1201
+ "uniform": 1,
1202
+ "vortex_center": 2,
1203
+ "double_gyre": 3,
1204
+ "source_sink": 4,
1205
+ "source_sink_pair": 5,
1206
+ "gradient": 6,
1207
+ "shear": 7,
1208
+ "turbulent_patch": 8,
1209
+ "random_fourier": 9
1210
+ },
1211
+ "trajectories": {
1212
+ "noflow_random_action": 0,
1213
+ "noflow_action_then_zero": 1,
1214
+ "flow_zero_action": 2,
1215
+ "flow_active_control": 3,
1216
+ "flow_waypoint_control": 4
1217
+ },
1218
+ "steps": 300,
1219
+ "workspace": [
1220
+ 0.0,
1221
+ 10.0,
1222
+ 0.0,
1223
+ 10.0
1224
+ ],
1225
+ "boundary": "terminate",
1226
+ "seed": 5302,
1227
+ "max_action_dim": 3,
1228
+ "flow_pool_size": 80,
1229
+ "episode_rng_mode": "indexed",
1230
+ "boat_param_names": [
1231
+ "mass",
1232
+ "inertia",
1233
+ "t_max",
1234
+ "drag_linear_x",
1235
+ "drag_linear_y",
1236
+ "drag_quad_x",
1237
+ "drag_quad_y",
1238
+ "drag_angular",
1239
+ "drag_angular_quad",
1240
+ "actuator_tau"
1241
+ ],
1242
+ "flow_transform": {
1243
+ "magnitude_scale": 1.0,
1244
+ "temporal_amplitude": 0.45,
1245
+ "temporal_frequency": 0.08,
1246
+ "rotation_amplitude": 0.65
1247
+ },
1248
+ "flow_switching": {
1249
+ "enabled": false,
1250
+ "interval_steps": 0,
1251
+ "switch_steps": [],
1252
+ "distinct_consecutive_families": false
1253
+ }
1254
+ },
1255
+ "counts": {
1256
+ "boat_ids": {
1257
+ "0": 236,
1258
+ "1": 244
1259
+ },
1260
+ "flow_type_ids": {
1261
+ "0": 125,
1262
+ "1": 48,
1263
+ "2": 47,
1264
+ "3": 32,
1265
+ "4": 40,
1266
+ "5": 36,
1267
+ "6": 39,
1268
+ "7": 38,
1269
+ "8": 35,
1270
+ "9": 40
1271
+ },
1272
+ "traj_type_ids": {
1273
+ "0": 76,
1274
+ "1": 49,
1275
+ "2": 70,
1276
+ "3": 132,
1277
+ "4": 153
1278
+ }
1279
+ },
1280
+ "content_checks": {
1281
+ "finite_arrays": true,
1282
+ "historical_shapes": true,
1283
+ "historical_metadata": true,
1284
+ "historical_family_and_trajectory_counts": true
1285
+ }
1286
+ },
1287
+ {
1288
+ "path": "data/rebuttal/test_flow_switch_100.npz",
1289
+ "status": "archived_original",
1290
+ "sha256": "d08662e23997a128266bb94bdc92bce1b4609c6b190aa5c76d7a107036062300",
1291
+ "historical_container_sha256": "d08662e23997a128266bb94bdc92bce1b4609c6b190aa5c76d7a107036062300",
1292
+ "historical_container_exact": true,
1293
+ "bytes": 8062308,
1294
+ "arrays": {
1295
+ "obs": {
1296
+ "shape": [
1297
+ 480,
1298
+ 301,
1299
+ 4
1300
+ ],
1301
+ "dtype": "float32"
1302
+ },
1303
+ "actions": {
1304
+ "shape": [
1305
+ 480,
1306
+ 300,
1307
+ 3
1308
+ ],
1309
+ "dtype": "float32"
1310
+ },
1311
+ "states": {
1312
+ "shape": [
1313
+ 480,
1314
+ 301,
1315
+ 9
1316
+ ],
1317
+ "dtype": "float32"
1318
+ },
1319
+ "true_flow": {
1320
+ "shape": [
1321
+ 480,
1322
+ 301,
1323
+ 2
1324
+ ],
1325
+ "dtype": "float32"
1326
+ },
1327
+ "boat_ids": {
1328
+ "shape": [
1329
+ 480
1330
+ ],
1331
+ "dtype": "int64"
1332
+ },
1333
+ "action_dims": {
1334
+ "shape": [
1335
+ 480
1336
+ ],
1337
+ "dtype": "int64"
1338
+ },
1339
+ "flow_type_ids": {
1340
+ "shape": [
1341
+ 480
1342
+ ],
1343
+ "dtype": "int64"
1344
+ },
1345
+ "flow_ids": {
1346
+ "shape": [
1347
+ 480
1348
+ ],
1349
+ "dtype": "int64"
1350
+ },
1351
+ "traj_type_ids": {
1352
+ "shape": [
1353
+ 480
1354
+ ],
1355
+ "dtype": "int64"
1356
+ },
1357
+ "boat_params": {
1358
+ "shape": [
1359
+ 480,
1360
+ 10
1361
+ ],
1362
+ "dtype": "float32"
1363
+ },
1364
+ "flow_type_ids_step": {
1365
+ "shape": [
1366
+ 480,
1367
+ 301
1368
+ ],
1369
+ "dtype": "int64"
1370
+ },
1371
+ "flow_ids_step": {
1372
+ "shape": [
1373
+ 480,
1374
+ 301
1375
+ ],
1376
+ "dtype": "int64"
1377
+ }
1378
+ },
1379
+ "metadata": {
1380
+ "boats": {
1381
+ "twin": 0,
1382
+ "triangle": 1
1383
+ },
1384
+ "flows": {
1385
+ "noflow": 0,
1386
+ "uniform": 1,
1387
+ "vortex_center": 2,
1388
+ "double_gyre": 3,
1389
+ "source_sink": 4,
1390
+ "source_sink_pair": 5,
1391
+ "gradient": 6,
1392
+ "shear": 7,
1393
+ "turbulent_patch": 8,
1394
+ "random_fourier": 9
1395
+ },
1396
+ "trajectories": {
1397
+ "noflow_random_action": 0,
1398
+ "noflow_action_then_zero": 1,
1399
+ "flow_zero_action": 2,
1400
+ "flow_active_control": 3,
1401
+ "flow_waypoint_control": 4
1402
+ },
1403
+ "steps": 300,
1404
+ "workspace": [
1405
+ 0.0,
1406
+ 10.0,
1407
+ 0.0,
1408
+ 10.0
1409
+ ],
1410
+ "boundary": "clip",
1411
+ "seed": 6302,
1412
+ "max_action_dim": 3,
1413
+ "flow_pool_size": 80,
1414
+ "episode_rng_mode": "indexed",
1415
+ "boat_param_names": [
1416
+ "mass",
1417
+ "inertia",
1418
+ "t_max",
1419
+ "drag_linear_x",
1420
+ "drag_linear_y",
1421
+ "drag_quad_x",
1422
+ "drag_quad_y",
1423
+ "drag_angular",
1424
+ "drag_angular_quad",
1425
+ "actuator_tau"
1426
+ ],
1427
+ "flow_transform": {
1428
+ "magnitude_scale": 1.0,
1429
+ "temporal_amplitude": 0.0,
1430
+ "temporal_frequency": 0.0,
1431
+ "rotation_amplitude": 0.0
1432
+ },
1433
+ "flow_switching": {
1434
+ "enabled": true,
1435
+ "interval_steps": 100,
1436
+ "switch_steps": [
1437
+ 100,
1438
+ 200
1439
+ ],
1440
+ "distinct_consecutive_families": true
1441
+ }
1442
+ },
1443
+ "counts": {
1444
+ "boat_ids": {
1445
+ "0": 243,
1446
+ "1": 237
1447
+ },
1448
+ "flow_type_ids": {
1449
+ "1": 46,
1450
+ "2": 48,
1451
+ "3": 56,
1452
+ "4": 54,
1453
+ "5": 53,
1454
+ "6": 53,
1455
+ "7": 55,
1456
+ "8": 56,
1457
+ "9": 59
1458
+ },
1459
+ "traj_type_ids": {
1460
+ "2": 78,
1461
+ "3": 209,
1462
+ "4": 193
1463
+ }
1464
+ },
1465
+ "content_checks": {
1466
+ "finite_arrays": true
1467
+ }
1468
+ },
1469
+ {
1470
+ "path": "data/rebuttal/test_magnitude_100.npz",
1471
+ "status": "reconstructed_from_recorded_protocol",
1472
+ "sha256": "66522fe1ba187a91228f8105a8318d9fe1a2722c36f50f0b0547a516d30484a8",
1473
+ "historical_container_sha256": "6d820cda5bd6d2cec67caf9887605403b0c77aa3df8086fd19058dd8ba44473f",
1474
+ "historical_container_exact": false,
1475
+ "bytes": 6458960,
1476
+ "arrays": {
1477
+ "obs": {
1478
+ "shape": [
1479
+ 480,
1480
+ 301,
1481
+ 4
1482
+ ],
1483
+ "dtype": "float32"
1484
+ },
1485
+ "actions": {
1486
+ "shape": [
1487
+ 480,
1488
+ 300,
1489
+ 3
1490
+ ],
1491
+ "dtype": "float32"
1492
+ },
1493
+ "states": {
1494
+ "shape": [
1495
+ 480,
1496
+ 301,
1497
+ 9
1498
+ ],
1499
+ "dtype": "float32"
1500
+ },
1501
+ "true_flow": {
1502
+ "shape": [
1503
+ 480,
1504
+ 301,
1505
+ 2
1506
+ ],
1507
+ "dtype": "float32"
1508
+ },
1509
+ "boat_ids": {
1510
+ "shape": [
1511
+ 480
1512
+ ],
1513
+ "dtype": "int64"
1514
+ },
1515
+ "action_dims": {
1516
+ "shape": [
1517
+ 480
1518
+ ],
1519
+ "dtype": "int64"
1520
+ },
1521
+ "flow_type_ids": {
1522
+ "shape": [
1523
+ 480
1524
+ ],
1525
+ "dtype": "int64"
1526
+ },
1527
+ "flow_ids": {
1528
+ "shape": [
1529
+ 480
1530
+ ],
1531
+ "dtype": "int64"
1532
+ },
1533
+ "traj_type_ids": {
1534
+ "shape": [
1535
+ 480
1536
+ ],
1537
+ "dtype": "int64"
1538
+ },
1539
+ "boat_params": {
1540
+ "shape": [
1541
+ 480,
1542
+ 10
1543
+ ],
1544
+ "dtype": "float32"
1545
+ }
1546
+ },
1547
+ "metadata": {
1548
+ "boats": {
1549
+ "twin": 0,
1550
+ "triangle": 1
1551
+ },
1552
+ "flows": {
1553
+ "noflow": 0,
1554
+ "uniform": 1,
1555
+ "vortex_center": 2,
1556
+ "double_gyre": 3,
1557
+ "source_sink": 4,
1558
+ "source_sink_pair": 5,
1559
+ "gradient": 6,
1560
+ "shear": 7,
1561
+ "turbulent_patch": 8,
1562
+ "random_fourier": 9
1563
+ },
1564
+ "trajectories": {
1565
+ "noflow_random_action": 0,
1566
+ "noflow_action_then_zero": 1,
1567
+ "flow_zero_action": 2,
1568
+ "flow_active_control": 3,
1569
+ "flow_waypoint_control": 4
1570
+ },
1571
+ "steps": 300,
1572
+ "workspace": [
1573
+ 0.0,
1574
+ 10.0,
1575
+ 0.0,
1576
+ 10.0
1577
+ ],
1578
+ "boundary": "terminate",
1579
+ "seed": 5302,
1580
+ "max_action_dim": 3,
1581
+ "flow_pool_size": 80,
1582
+ "episode_rng_mode": "indexed",
1583
+ "boat_param_names": [
1584
+ "mass",
1585
+ "inertia",
1586
+ "t_max",
1587
+ "drag_linear_x",
1588
+ "drag_linear_y",
1589
+ "drag_quad_x",
1590
+ "drag_quad_y",
1591
+ "drag_angular",
1592
+ "drag_angular_quad",
1593
+ "actuator_tau"
1594
+ ],
1595
+ "flow_transform": {
1596
+ "magnitude_scale": 1.0,
1597
+ "temporal_amplitude": 0.0,
1598
+ "temporal_frequency": 0.0,
1599
+ "rotation_amplitude": 0.0
1600
+ },
1601
+ "flow_switching": {
1602
+ "enabled": false,
1603
+ "interval_steps": 0,
1604
+ "switch_steps": [],
1605
+ "distinct_consecutive_families": false
1606
+ }
1607
+ },
1608
+ "counts": {
1609
+ "boat_ids": {
1610
+ "0": 236,
1611
+ "1": 244
1612
+ },
1613
+ "flow_type_ids": {
1614
+ "0": 125,
1615
+ "1": 48,
1616
+ "2": 47,
1617
+ "3": 32,
1618
+ "4": 40,
1619
+ "5": 36,
1620
+ "6": 39,
1621
+ "7": 38,
1622
+ "8": 35,
1623
+ "9": 40
1624
+ },
1625
+ "traj_type_ids": {
1626
+ "0": 76,
1627
+ "1": 49,
1628
+ "2": 70,
1629
+ "3": 132,
1630
+ "4": 153
1631
+ }
1632
+ },
1633
+ "content_checks": {
1634
+ "finite_arrays": true,
1635
+ "historical_shapes": true,
1636
+ "historical_metadata": true,
1637
+ "historical_family_and_trajectory_counts": true
1638
+ }
1639
+ },
1640
+ {
1641
+ "path": "data/rebuttal/test_magnitude_125.npz",
1642
+ "status": "reconstructed_from_recorded_protocol",
1643
+ "sha256": "32d65c71bccd50e73f8477c61866209ffcc44d698b0cad5fe8b98090529f3b29",
1644
+ "historical_container_sha256": "fdb2fed3d308addbe5d489cf5a5b2454ac17fb448e6db10d4efedfee9e9eee78",
1645
+ "historical_container_exact": false,
1646
+ "bytes": 6449021,
1647
+ "arrays": {
1648
+ "obs": {
1649
+ "shape": [
1650
+ 480,
1651
+ 301,
1652
+ 4
1653
+ ],
1654
+ "dtype": "float32"
1655
+ },
1656
+ "actions": {
1657
+ "shape": [
1658
+ 480,
1659
+ 300,
1660
+ 3
1661
+ ],
1662
+ "dtype": "float32"
1663
+ },
1664
+ "states": {
1665
+ "shape": [
1666
+ 480,
1667
+ 301,
1668
+ 9
1669
+ ],
1670
+ "dtype": "float32"
1671
+ },
1672
+ "true_flow": {
1673
+ "shape": [
1674
+ 480,
1675
+ 301,
1676
+ 2
1677
+ ],
1678
+ "dtype": "float32"
1679
+ },
1680
+ "boat_ids": {
1681
+ "shape": [
1682
+ 480
1683
+ ],
1684
+ "dtype": "int64"
1685
+ },
1686
+ "action_dims": {
1687
+ "shape": [
1688
+ 480
1689
+ ],
1690
+ "dtype": "int64"
1691
+ },
1692
+ "flow_type_ids": {
1693
+ "shape": [
1694
+ 480
1695
+ ],
1696
+ "dtype": "int64"
1697
+ },
1698
+ "flow_ids": {
1699
+ "shape": [
1700
+ 480
1701
+ ],
1702
+ "dtype": "int64"
1703
+ },
1704
+ "traj_type_ids": {
1705
+ "shape": [
1706
+ 480
1707
+ ],
1708
+ "dtype": "int64"
1709
+ },
1710
+ "boat_params": {
1711
+ "shape": [
1712
+ 480,
1713
+ 10
1714
+ ],
1715
+ "dtype": "float32"
1716
+ }
1717
+ },
1718
+ "metadata": {
1719
+ "boats": {
1720
+ "twin": 0,
1721
+ "triangle": 1
1722
+ },
1723
+ "flows": {
1724
+ "noflow": 0,
1725
+ "uniform": 1,
1726
+ "vortex_center": 2,
1727
+ "double_gyre": 3,
1728
+ "source_sink": 4,
1729
+ "source_sink_pair": 5,
1730
+ "gradient": 6,
1731
+ "shear": 7,
1732
+ "turbulent_patch": 8,
1733
+ "random_fourier": 9
1734
+ },
1735
+ "trajectories": {
1736
+ "noflow_random_action": 0,
1737
+ "noflow_action_then_zero": 1,
1738
+ "flow_zero_action": 2,
1739
+ "flow_active_control": 3,
1740
+ "flow_waypoint_control": 4
1741
+ },
1742
+ "steps": 300,
1743
+ "workspace": [
1744
+ 0.0,
1745
+ 10.0,
1746
+ 0.0,
1747
+ 10.0
1748
+ ],
1749
+ "boundary": "terminate",
1750
+ "seed": 5302,
1751
+ "max_action_dim": 3,
1752
+ "flow_pool_size": 80,
1753
+ "episode_rng_mode": "indexed",
1754
+ "boat_param_names": [
1755
+ "mass",
1756
+ "inertia",
1757
+ "t_max",
1758
+ "drag_linear_x",
1759
+ "drag_linear_y",
1760
+ "drag_quad_x",
1761
+ "drag_quad_y",
1762
+ "drag_angular",
1763
+ "drag_angular_quad",
1764
+ "actuator_tau"
1765
+ ],
1766
+ "flow_transform": {
1767
+ "magnitude_scale": 1.25,
1768
+ "temporal_amplitude": 0.0,
1769
+ "temporal_frequency": 0.0,
1770
+ "rotation_amplitude": 0.0
1771
+ },
1772
+ "flow_switching": {
1773
+ "enabled": false,
1774
+ "interval_steps": 0,
1775
+ "switch_steps": [],
1776
+ "distinct_consecutive_families": false
1777
+ }
1778
+ },
1779
+ "counts": {
1780
+ "boat_ids": {
1781
+ "0": 236,
1782
+ "1": 244
1783
+ },
1784
+ "flow_type_ids": {
1785
+ "0": 125,
1786
+ "1": 48,
1787
+ "2": 47,
1788
+ "3": 32,
1789
+ "4": 40,
1790
+ "5": 36,
1791
+ "6": 39,
1792
+ "7": 38,
1793
+ "8": 35,
1794
+ "9": 40
1795
+ },
1796
+ "traj_type_ids": {
1797
+ "0": 76,
1798
+ "1": 49,
1799
+ "2": 70,
1800
+ "3": 132,
1801
+ "4": 153
1802
+ }
1803
+ },
1804
+ "content_checks": {
1805
+ "finite_arrays": true,
1806
+ "historical_shapes": true,
1807
+ "historical_metadata": true,
1808
+ "historical_family_and_trajectory_counts": true
1809
+ }
1810
+ },
1811
+ {
1812
+ "path": "data/rebuttal/test_magnitude_150.npz",
1813
+ "status": "reconstructed_from_recorded_protocol",
1814
+ "sha256": "8d8bd17a130e88a7ad68d3747d5e750ab1556c8c81d65e1b11479dde6e72f11d",
1815
+ "historical_container_sha256": "717f363513299ada89010bceaccaee5d8d080048b6a72c883fd7103fb7f80f35",
1816
+ "historical_container_exact": false,
1817
+ "bytes": 6435332,
1818
+ "arrays": {
1819
+ "obs": {
1820
+ "shape": [
1821
+ 480,
1822
+ 301,
1823
+ 4
1824
+ ],
1825
+ "dtype": "float32"
1826
+ },
1827
+ "actions": {
1828
+ "shape": [
1829
+ 480,
1830
+ 300,
1831
+ 3
1832
+ ],
1833
+ "dtype": "float32"
1834
+ },
1835
+ "states": {
1836
+ "shape": [
1837
+ 480,
1838
+ 301,
1839
+ 9
1840
+ ],
1841
+ "dtype": "float32"
1842
+ },
1843
+ "true_flow": {
1844
+ "shape": [
1845
+ 480,
1846
+ 301,
1847
+ 2
1848
+ ],
1849
+ "dtype": "float32"
1850
+ },
1851
+ "boat_ids": {
1852
+ "shape": [
1853
+ 480
1854
+ ],
1855
+ "dtype": "int64"
1856
+ },
1857
+ "action_dims": {
1858
+ "shape": [
1859
+ 480
1860
+ ],
1861
+ "dtype": "int64"
1862
+ },
1863
+ "flow_type_ids": {
1864
+ "shape": [
1865
+ 480
1866
+ ],
1867
+ "dtype": "int64"
1868
+ },
1869
+ "flow_ids": {
1870
+ "shape": [
1871
+ 480
1872
+ ],
1873
+ "dtype": "int64"
1874
+ },
1875
+ "traj_type_ids": {
1876
+ "shape": [
1877
+ 480
1878
+ ],
1879
+ "dtype": "int64"
1880
+ },
1881
+ "boat_params": {
1882
+ "shape": [
1883
+ 480,
1884
+ 10
1885
+ ],
1886
+ "dtype": "float32"
1887
+ }
1888
+ },
1889
+ "metadata": {
1890
+ "boats": {
1891
+ "twin": 0,
1892
+ "triangle": 1
1893
+ },
1894
+ "flows": {
1895
+ "noflow": 0,
1896
+ "uniform": 1,
1897
+ "vortex_center": 2,
1898
+ "double_gyre": 3,
1899
+ "source_sink": 4,
1900
+ "source_sink_pair": 5,
1901
+ "gradient": 6,
1902
+ "shear": 7,
1903
+ "turbulent_patch": 8,
1904
+ "random_fourier": 9
1905
+ },
1906
+ "trajectories": {
1907
+ "noflow_random_action": 0,
1908
+ "noflow_action_then_zero": 1,
1909
+ "flow_zero_action": 2,
1910
+ "flow_active_control": 3,
1911
+ "flow_waypoint_control": 4
1912
+ },
1913
+ "steps": 300,
1914
+ "workspace": [
1915
+ 0.0,
1916
+ 10.0,
1917
+ 0.0,
1918
+ 10.0
1919
+ ],
1920
+ "boundary": "terminate",
1921
+ "seed": 5302,
1922
+ "max_action_dim": 3,
1923
+ "flow_pool_size": 80,
1924
+ "episode_rng_mode": "indexed",
1925
+ "boat_param_names": [
1926
+ "mass",
1927
+ "inertia",
1928
+ "t_max",
1929
+ "drag_linear_x",
1930
+ "drag_linear_y",
1931
+ "drag_quad_x",
1932
+ "drag_quad_y",
1933
+ "drag_angular",
1934
+ "drag_angular_quad",
1935
+ "actuator_tau"
1936
+ ],
1937
+ "flow_transform": {
1938
+ "magnitude_scale": 1.5,
1939
+ "temporal_amplitude": 0.0,
1940
+ "temporal_frequency": 0.0,
1941
+ "rotation_amplitude": 0.0
1942
+ },
1943
+ "flow_switching": {
1944
+ "enabled": false,
1945
+ "interval_steps": 0,
1946
+ "switch_steps": [],
1947
+ "distinct_consecutive_families": false
1948
+ }
1949
+ },
1950
+ "counts": {
1951
+ "boat_ids": {
1952
+ "0": 236,
1953
+ "1": 244
1954
+ },
1955
+ "flow_type_ids": {
1956
+ "0": 125,
1957
+ "1": 48,
1958
+ "2": 47,
1959
+ "3": 32,
1960
+ "4": 40,
1961
+ "5": 36,
1962
+ "6": 39,
1963
+ "7": 38,
1964
+ "8": 35,
1965
+ "9": 40
1966
+ },
1967
+ "traj_type_ids": {
1968
+ "0": 76,
1969
+ "1": 49,
1970
+ "2": 70,
1971
+ "3": 132,
1972
+ "4": 153
1973
+ }
1974
+ },
1975
+ "content_checks": {
1976
+ "finite_arrays": true,
1977
+ "historical_shapes": true,
1978
+ "historical_metadata": true,
1979
+ "historical_family_and_trajectory_counts": true
1980
+ }
1981
+ },
1982
+ {
1983
+ "path": "data/rebuttal/test_magnitude_200.npz",
1984
+ "status": "reconstructed_from_recorded_protocol",
1985
+ "sha256": "58ebcd3e1215976da4abfab5864836bfb629a6fbcdc6a6d5b18cd793f8b644f6",
1986
+ "historical_container_sha256": "63d0e7019979741845c5484d21ff6d3d6aa94aa51ce8f813aedc3e0d821c4594",
1987
+ "historical_container_exact": false,
1988
+ "bytes": 6403972,
1989
+ "arrays": {
1990
+ "obs": {
1991
+ "shape": [
1992
+ 480,
1993
+ 301,
1994
+ 4
1995
+ ],
1996
+ "dtype": "float32"
1997
+ },
1998
+ "actions": {
1999
+ "shape": [
2000
+ 480,
2001
+ 300,
2002
+ 3
2003
+ ],
2004
+ "dtype": "float32"
2005
+ },
2006
+ "states": {
2007
+ "shape": [
2008
+ 480,
2009
+ 301,
2010
+ 9
2011
+ ],
2012
+ "dtype": "float32"
2013
+ },
2014
+ "true_flow": {
2015
+ "shape": [
2016
+ 480,
2017
+ 301,
2018
+ 2
2019
+ ],
2020
+ "dtype": "float32"
2021
+ },
2022
+ "boat_ids": {
2023
+ "shape": [
2024
+ 480
2025
+ ],
2026
+ "dtype": "int64"
2027
+ },
2028
+ "action_dims": {
2029
+ "shape": [
2030
+ 480
2031
+ ],
2032
+ "dtype": "int64"
2033
+ },
2034
+ "flow_type_ids": {
2035
+ "shape": [
2036
+ 480
2037
+ ],
2038
+ "dtype": "int64"
2039
+ },
2040
+ "flow_ids": {
2041
+ "shape": [
2042
+ 480
2043
+ ],
2044
+ "dtype": "int64"
2045
+ },
2046
+ "traj_type_ids": {
2047
+ "shape": [
2048
+ 480
2049
+ ],
2050
+ "dtype": "int64"
2051
+ },
2052
+ "boat_params": {
2053
+ "shape": [
2054
+ 480,
2055
+ 10
2056
+ ],
2057
+ "dtype": "float32"
2058
+ }
2059
+ },
2060
+ "metadata": {
2061
+ "boats": {
2062
+ "twin": 0,
2063
+ "triangle": 1
2064
+ },
2065
+ "flows": {
2066
+ "noflow": 0,
2067
+ "uniform": 1,
2068
+ "vortex_center": 2,
2069
+ "double_gyre": 3,
2070
+ "source_sink": 4,
2071
+ "source_sink_pair": 5,
2072
+ "gradient": 6,
2073
+ "shear": 7,
2074
+ "turbulent_patch": 8,
2075
+ "random_fourier": 9
2076
+ },
2077
+ "trajectories": {
2078
+ "noflow_random_action": 0,
2079
+ "noflow_action_then_zero": 1,
2080
+ "flow_zero_action": 2,
2081
+ "flow_active_control": 3,
2082
+ "flow_waypoint_control": 4
2083
+ },
2084
+ "steps": 300,
2085
+ "workspace": [
2086
+ 0.0,
2087
+ 10.0,
2088
+ 0.0,
2089
+ 10.0
2090
+ ],
2091
+ "boundary": "terminate",
2092
+ "seed": 5302,
2093
+ "max_action_dim": 3,
2094
+ "flow_pool_size": 80,
2095
+ "episode_rng_mode": "indexed",
2096
+ "boat_param_names": [
2097
+ "mass",
2098
+ "inertia",
2099
+ "t_max",
2100
+ "drag_linear_x",
2101
+ "drag_linear_y",
2102
+ "drag_quad_x",
2103
+ "drag_quad_y",
2104
+ "drag_angular",
2105
+ "drag_angular_quad",
2106
+ "actuator_tau"
2107
+ ],
2108
+ "flow_transform": {
2109
+ "magnitude_scale": 2.0,
2110
+ "temporal_amplitude": 0.0,
2111
+ "temporal_frequency": 0.0,
2112
+ "rotation_amplitude": 0.0
2113
+ },
2114
+ "flow_switching": {
2115
+ "enabled": false,
2116
+ "interval_steps": 0,
2117
+ "switch_steps": [],
2118
+ "distinct_consecutive_families": false
2119
+ }
2120
+ },
2121
+ "counts": {
2122
+ "boat_ids": {
2123
+ "0": 236,
2124
+ "1": 244
2125
+ },
2126
+ "flow_type_ids": {
2127
+ "0": 125,
2128
+ "1": 48,
2129
+ "2": 47,
2130
+ "3": 32,
2131
+ "4": 40,
2132
+ "5": 36,
2133
+ "6": 39,
2134
+ "7": 38,
2135
+ "8": 35,
2136
+ "9": 40
2137
+ },
2138
+ "traj_type_ids": {
2139
+ "0": 76,
2140
+ "1": 49,
2141
+ "2": 70,
2142
+ "3": 132,
2143
+ "4": 153
2144
+ }
2145
+ },
2146
+ "content_checks": {
2147
+ "finite_arrays": true,
2148
+ "historical_shapes": true,
2149
+ "historical_metadata": true,
2150
+ "historical_family_and_trajectory_counts": true
2151
+ }
2152
+ },
2153
+ {
2154
+ "path": "data/rebuttal/test_with_params.npz",
2155
+ "status": "exact_metadata_restoration",
2156
+ "sha256": "26d9b1c2ff8435e0379b2aab4ee8b3361b14f61d7848178cf06f99c88f2fd98c",
2157
+ "historical_container_sha256": "26d9b1c2ff8435e0379b2aab4ee8b3361b14f61d7848178cf06f99c88f2fd98c",
2158
+ "historical_container_exact": true,
2159
+ "bytes": 6340504,
2160
+ "arrays": {
2161
+ "obs": {
2162
+ "shape": [
2163
+ 480,
2164
+ 301,
2165
+ 4
2166
+ ],
2167
+ "dtype": "float32"
2168
+ },
2169
+ "actions": {
2170
+ "shape": [
2171
+ 480,
2172
+ 300,
2173
+ 3
2174
+ ],
2175
+ "dtype": "float32"
2176
+ },
2177
+ "states": {
2178
+ "shape": [
2179
+ 480,
2180
+ 301,
2181
+ 9
2182
+ ],
2183
+ "dtype": "float32"
2184
+ },
2185
+ "true_flow": {
2186
+ "shape": [
2187
+ 480,
2188
+ 301,
2189
+ 2
2190
+ ],
2191
+ "dtype": "float32"
2192
+ },
2193
+ "boat_ids": {
2194
+ "shape": [
2195
+ 480
2196
+ ],
2197
+ "dtype": "int64"
2198
+ },
2199
+ "action_dims": {
2200
+ "shape": [
2201
+ 480
2202
+ ],
2203
+ "dtype": "int64"
2204
+ },
2205
+ "flow_type_ids": {
2206
+ "shape": [
2207
+ 480
2208
+ ],
2209
+ "dtype": "int64"
2210
+ },
2211
+ "flow_ids": {
2212
+ "shape": [
2213
+ 480
2214
+ ],
2215
+ "dtype": "int64"
2216
+ },
2217
+ "traj_type_ids": {
2218
+ "shape": [
2219
+ 480
2220
+ ],
2221
+ "dtype": "int64"
2222
+ },
2223
+ "boat_params": {
2224
+ "shape": [
2225
+ 480,
2226
+ 10
2227
+ ],
2228
+ "dtype": "float32"
2229
+ }
2230
+ },
2231
+ "metadata": {
2232
+ "boats": {
2233
+ "twin": 0,
2234
+ "triangle": 1
2235
+ },
2236
+ "flows": {
2237
+ "noflow": 0,
2238
+ "uniform": 1,
2239
+ "vortex_center": 2,
2240
+ "double_gyre": 3,
2241
+ "source_sink": 4,
2242
+ "source_sink_pair": 5,
2243
+ "gradient": 6,
2244
+ "shear": 7,
2245
+ "turbulent_patch": 8,
2246
+ "random_fourier": 9
2247
+ },
2248
+ "trajectories": {
2249
+ "noflow_random_action": 0,
2250
+ "noflow_action_then_zero": 1,
2251
+ "flow_zero_action": 2,
2252
+ "flow_active_control": 3,
2253
+ "flow_waypoint_control": 4
2254
+ },
2255
+ "steps": 300,
2256
+ "workspace": [
2257
+ 0.0,
2258
+ 10.0,
2259
+ 0.0,
2260
+ 10.0
2261
+ ],
2262
+ "boundary": "terminate",
2263
+ "seed": 4302,
2264
+ "max_action_dim": 3,
2265
+ "flow_pool_size": 80,
2266
+ "boat_param_names": [
2267
+ "mass",
2268
+ "inertia",
2269
+ "t_max",
2270
+ "drag_linear_x",
2271
+ "drag_linear_y",
2272
+ "drag_quad_x",
2273
+ "drag_quad_y",
2274
+ "drag_angular",
2275
+ "drag_angular_quad",
2276
+ "actuator_tau"
2277
+ ]
2278
+ },
2279
+ "counts": {
2280
+ "boat_ids": {
2281
+ "0": 219,
2282
+ "1": 261
2283
+ },
2284
+ "flow_type_ids": {
2285
+ "0": 121,
2286
+ "1": 39,
2287
+ "2": 39,
2288
+ "3": 51,
2289
+ "4": 46,
2290
+ "5": 46,
2291
+ "6": 30,
2292
+ "7": 32,
2293
+ "8": 47,
2294
+ "9": 29
2295
+ },
2296
+ "traj_type_ids": {
2297
+ "0": 57,
2298
+ "1": 64,
2299
+ "2": 75,
2300
+ "3": 134,
2301
+ "4": 150
2302
+ }
2303
+ },
2304
+ "content_checks": {
2305
+ "finite_arrays": true,
2306
+ "historical_shapes": true,
2307
+ "historical_metadata": true,
2308
+ "historical_family_and_trajectory_counts": true
2309
+ }
2310
+ },
2311
+ {
2312
+ "path": "data/rebuttal/train_with_params.npz",
2313
+ "status": "exact_metadata_restoration",
2314
+ "sha256": "8f31dab11ffb0e4a74865174a752861cbe216652bbce069574c1cf4e8b895ceb",
2315
+ "historical_container_sha256": "8f31dab11ffb0e4a74865174a752861cbe216652bbce069574c1cf4e8b895ceb",
2316
+ "historical_container_exact": true,
2317
+ "bytes": 32022080,
2318
+ "arrays": {
2319
+ "obs": {
2320
+ "shape": [
2321
+ 2400,
2322
+ 301,
2323
+ 4
2324
+ ],
2325
+ "dtype": "float32"
2326
+ },
2327
+ "actions": {
2328
+ "shape": [
2329
+ 2400,
2330
+ 300,
2331
+ 3
2332
+ ],
2333
+ "dtype": "float32"
2334
+ },
2335
+ "states": {
2336
+ "shape": [
2337
+ 2400,
2338
+ 301,
2339
+ 9
2340
+ ],
2341
+ "dtype": "float32"
2342
+ },
2343
+ "true_flow": {
2344
+ "shape": [
2345
+ 2400,
2346
+ 301,
2347
+ 2
2348
+ ],
2349
+ "dtype": "float32"
2350
+ },
2351
+ "boat_ids": {
2352
+ "shape": [
2353
+ 2400
2354
+ ],
2355
+ "dtype": "int64"
2356
+ },
2357
+ "action_dims": {
2358
+ "shape": [
2359
+ 2400
2360
+ ],
2361
+ "dtype": "int64"
2362
+ },
2363
+ "flow_type_ids": {
2364
+ "shape": [
2365
+ 2400
2366
+ ],
2367
+ "dtype": "int64"
2368
+ },
2369
+ "flow_ids": {
2370
+ "shape": [
2371
+ 2400
2372
+ ],
2373
+ "dtype": "int64"
2374
+ },
2375
+ "traj_type_ids": {
2376
+ "shape": [
2377
+ 2400
2378
+ ],
2379
+ "dtype": "int64"
2380
+ },
2381
+ "boat_params": {
2382
+ "shape": [
2383
+ 2400,
2384
+ 10
2385
+ ],
2386
+ "dtype": "float32"
2387
+ }
2388
+ },
2389
+ "metadata": {
2390
+ "boats": {
2391
+ "twin": 0,
2392
+ "triangle": 1
2393
+ },
2394
+ "flows": {
2395
+ "noflow": 0,
2396
+ "uniform": 1,
2397
+ "vortex_center": 2,
2398
+ "double_gyre": 3,
2399
+ "source_sink": 4,
2400
+ "source_sink_pair": 5,
2401
+ "gradient": 6,
2402
+ "shear": 7,
2403
+ "turbulent_patch": 8,
2404
+ "random_fourier": 9
2405
+ },
2406
+ "trajectories": {
2407
+ "noflow_random_action": 0,
2408
+ "noflow_action_then_zero": 1,
2409
+ "flow_zero_action": 2,
2410
+ "flow_active_control": 3,
2411
+ "flow_waypoint_control": 4
2412
+ },
2413
+ "steps": 300,
2414
+ "workspace": [
2415
+ 0.0,
2416
+ 10.0,
2417
+ 0.0,
2418
+ 10.0
2419
+ ],
2420
+ "boundary": "terminate",
2421
+ "seed": 4301,
2422
+ "max_action_dim": 3,
2423
+ "flow_pool_size": 80,
2424
+ "boat_param_names": [
2425
+ "mass",
2426
+ "inertia",
2427
+ "t_max",
2428
+ "drag_linear_x",
2429
+ "drag_linear_y",
2430
+ "drag_quad_x",
2431
+ "drag_quad_y",
2432
+ "drag_angular",
2433
+ "drag_angular_quad",
2434
+ "actuator_tau"
2435
+ ]
2436
+ },
2437
+ "counts": {
2438
+ "boat_ids": {
2439
+ "0": 1145,
2440
+ "1": 1255
2441
+ },
2442
+ "flow_type_ids": {
2443
+ "0": 679,
2444
+ "1": 186,
2445
+ "2": 179,
2446
+ "3": 189,
2447
+ "4": 201,
2448
+ "5": 176,
2449
+ "6": 194,
2450
+ "7": 204,
2451
+ "8": 199,
2452
+ "9": 193
2453
+ },
2454
+ "traj_type_ids": {
2455
+ "0": 313,
2456
+ "1": 366,
2457
+ "2": 368,
2458
+ "3": 669,
2459
+ "4": 684
2460
+ }
2461
+ },
2462
+ "content_checks": {
2463
+ "finite_arrays": true,
2464
+ "historical_shapes": true,
2465
+ "historical_metadata": true,
2466
+ "historical_family_and_trajectory_counts": true
2467
+ }
2468
+ },
2469
+ {
2470
+ "path": "data/rebuttal/validation_dynamic_slow.npz",
2471
+ "status": "reconstructed_from_recorded_protocol",
2472
+ "sha256": "31971828d3eeddbe87c8584bae868911d519cdb555c47b25c92143e8648fb183",
2473
+ "historical_container_sha256": "79cd400ef6716676654a95a287a774d4f6801e56f566b22831d47b7910cb497b",
2474
+ "historical_container_exact": false,
2475
+ "bytes": 6520807,
2476
+ "arrays": {
2477
+ "obs": {
2478
+ "shape": [
2479
+ 480,
2480
+ 301,
2481
+ 4
2482
+ ],
2483
+ "dtype": "float32"
2484
+ },
2485
+ "actions": {
2486
+ "shape": [
2487
+ 480,
2488
+ 300,
2489
+ 3
2490
+ ],
2491
+ "dtype": "float32"
2492
+ },
2493
+ "states": {
2494
+ "shape": [
2495
+ 480,
2496
+ 301,
2497
+ 9
2498
+ ],
2499
+ "dtype": "float32"
2500
+ },
2501
+ "true_flow": {
2502
+ "shape": [
2503
+ 480,
2504
+ 301,
2505
+ 2
2506
+ ],
2507
+ "dtype": "float32"
2508
+ },
2509
+ "boat_ids": {
2510
+ "shape": [
2511
+ 480
2512
+ ],
2513
+ "dtype": "int64"
2514
+ },
2515
+ "action_dims": {
2516
+ "shape": [
2517
+ 480
2518
+ ],
2519
+ "dtype": "int64"
2520
+ },
2521
+ "flow_type_ids": {
2522
+ "shape": [
2523
+ 480
2524
+ ],
2525
+ "dtype": "int64"
2526
+ },
2527
+ "flow_ids": {
2528
+ "shape": [
2529
+ 480
2530
+ ],
2531
+ "dtype": "int64"
2532
+ },
2533
+ "traj_type_ids": {
2534
+ "shape": [
2535
+ 480
2536
+ ],
2537
+ "dtype": "int64"
2538
+ },
2539
+ "boat_params": {
2540
+ "shape": [
2541
+ 480,
2542
+ 10
2543
+ ],
2544
+ "dtype": "float32"
2545
+ }
2546
+ },
2547
+ "metadata": {
2548
+ "boats": {
2549
+ "twin": 0,
2550
+ "triangle": 1
2551
+ },
2552
+ "flows": {
2553
+ "noflow": 0,
2554
+ "uniform": 1,
2555
+ "vortex_center": 2,
2556
+ "double_gyre": 3,
2557
+ "source_sink": 4,
2558
+ "source_sink_pair": 5,
2559
+ "gradient": 6,
2560
+ "shear": 7,
2561
+ "turbulent_patch": 8,
2562
+ "random_fourier": 9
2563
+ },
2564
+ "trajectories": {
2565
+ "noflow_random_action": 0,
2566
+ "noflow_action_then_zero": 1,
2567
+ "flow_zero_action": 2,
2568
+ "flow_active_control": 3,
2569
+ "flow_waypoint_control": 4
2570
+ },
2571
+ "steps": 300,
2572
+ "workspace": [
2573
+ 0.0,
2574
+ 10.0,
2575
+ 0.0,
2576
+ 10.0
2577
+ ],
2578
+ "boundary": "terminate",
2579
+ "seed": 5304,
2580
+ "max_action_dim": 3,
2581
+ "flow_pool_size": 80,
2582
+ "episode_rng_mode": "indexed",
2583
+ "boat_param_names": [
2584
+ "mass",
2585
+ "inertia",
2586
+ "t_max",
2587
+ "drag_linear_x",
2588
+ "drag_linear_y",
2589
+ "drag_quad_x",
2590
+ "drag_quad_y",
2591
+ "drag_angular",
2592
+ "drag_angular_quad",
2593
+ "actuator_tau"
2594
+ ],
2595
+ "flow_transform": {
2596
+ "magnitude_scale": 1.0,
2597
+ "temporal_amplitude": 0.45,
2598
+ "temporal_frequency": 0.08,
2599
+ "rotation_amplitude": 0.65
2600
+ },
2601
+ "flow_switching": {
2602
+ "enabled": false,
2603
+ "interval_steps": 0,
2604
+ "switch_steps": [],
2605
+ "distinct_consecutive_families": false
2606
+ }
2607
+ },
2608
+ "counts": {
2609
+ "boat_ids": {
2610
+ "0": 248,
2611
+ "1": 232
2612
+ },
2613
+ "flow_type_ids": {
2614
+ "0": 135,
2615
+ "1": 42,
2616
+ "2": 40,
2617
+ "3": 43,
2618
+ "4": 33,
2619
+ "5": 39,
2620
+ "6": 44,
2621
+ "7": 25,
2622
+ "8": 32,
2623
+ "9": 47
2624
+ },
2625
+ "traj_type_ids": {
2626
+ "0": 64,
2627
+ "1": 71,
2628
+ "2": 64,
2629
+ "3": 122,
2630
+ "4": 159
2631
+ }
2632
+ },
2633
+ "content_checks": {
2634
+ "finite_arrays": true,
2635
+ "historical_shapes": true,
2636
+ "historical_metadata": true,
2637
+ "historical_family_and_trajectory_counts": true
2638
+ }
2639
+ },
2640
+ {
2641
+ "path": "data/rebuttal/validation_id.npz",
2642
+ "status": "reconstructed_from_recorded_protocol",
2643
+ "sha256": "07853a57ae521bedcf806853de73f40d650be300c9bfacbbc8850fa624615c4f",
2644
+ "historical_container_sha256": "eef9059ba0c67f7a037db555fe8ca44d89b73c41a6dd02aa6382170132977bf1",
2645
+ "historical_container_exact": false,
2646
+ "bytes": 6496349,
2647
+ "arrays": {
2648
+ "obs": {
2649
+ "shape": [
2650
+ 480,
2651
+ 301,
2652
+ 4
2653
+ ],
2654
+ "dtype": "float32"
2655
+ },
2656
+ "actions": {
2657
+ "shape": [
2658
+ 480,
2659
+ 300,
2660
+ 3
2661
+ ],
2662
+ "dtype": "float32"
2663
+ },
2664
+ "states": {
2665
+ "shape": [
2666
+ 480,
2667
+ 301,
2668
+ 9
2669
+ ],
2670
+ "dtype": "float32"
2671
+ },
2672
+ "true_flow": {
2673
+ "shape": [
2674
+ 480,
2675
+ 301,
2676
+ 2
2677
+ ],
2678
+ "dtype": "float32"
2679
+ },
2680
+ "boat_ids": {
2681
+ "shape": [
2682
+ 480
2683
+ ],
2684
+ "dtype": "int64"
2685
+ },
2686
+ "action_dims": {
2687
+ "shape": [
2688
+ 480
2689
+ ],
2690
+ "dtype": "int64"
2691
+ },
2692
+ "flow_type_ids": {
2693
+ "shape": [
2694
+ 480
2695
+ ],
2696
+ "dtype": "int64"
2697
+ },
2698
+ "flow_ids": {
2699
+ "shape": [
2700
+ 480
2701
+ ],
2702
+ "dtype": "int64"
2703
+ },
2704
+ "traj_type_ids": {
2705
+ "shape": [
2706
+ 480
2707
+ ],
2708
+ "dtype": "int64"
2709
+ },
2710
+ "boat_params": {
2711
+ "shape": [
2712
+ 480,
2713
+ 10
2714
+ ],
2715
+ "dtype": "float32"
2716
+ }
2717
+ },
2718
+ "metadata": {
2719
+ "boats": {
2720
+ "twin": 0,
2721
+ "triangle": 1
2722
+ },
2723
+ "flows": {
2724
+ "noflow": 0,
2725
+ "uniform": 1,
2726
+ "vortex_center": 2,
2727
+ "double_gyre": 3,
2728
+ "source_sink": 4,
2729
+ "source_sink_pair": 5,
2730
+ "gradient": 6,
2731
+ "shear": 7,
2732
+ "turbulent_patch": 8,
2733
+ "random_fourier": 9
2734
+ },
2735
+ "trajectories": {
2736
+ "noflow_random_action": 0,
2737
+ "noflow_action_then_zero": 1,
2738
+ "flow_zero_action": 2,
2739
+ "flow_active_control": 3,
2740
+ "flow_waypoint_control": 4
2741
+ },
2742
+ "steps": 300,
2743
+ "workspace": [
2744
+ 0.0,
2745
+ 10.0,
2746
+ 0.0,
2747
+ 10.0
2748
+ ],
2749
+ "boundary": "terminate",
2750
+ "seed": 4304,
2751
+ "max_action_dim": 3,
2752
+ "flow_pool_size": 80,
2753
+ "episode_rng_mode": "sequential",
2754
+ "boat_param_names": [
2755
+ "mass",
2756
+ "inertia",
2757
+ "t_max",
2758
+ "drag_linear_x",
2759
+ "drag_linear_y",
2760
+ "drag_quad_x",
2761
+ "drag_quad_y",
2762
+ "drag_angular",
2763
+ "drag_angular_quad",
2764
+ "actuator_tau"
2765
+ ],
2766
+ "flow_transform": {
2767
+ "magnitude_scale": 1.0,
2768
+ "temporal_amplitude": 0.0,
2769
+ "temporal_frequency": 0.0,
2770
+ "rotation_amplitude": 0.0
2771
+ },
2772
+ "flow_switching": {
2773
+ "enabled": false,
2774
+ "interval_steps": 0,
2775
+ "switch_steps": [],
2776
+ "distinct_consecutive_families": false
2777
+ }
2778
+ },
2779
+ "counts": {
2780
+ "boat_ids": {
2781
+ "0": 248,
2782
+ "1": 232
2783
+ },
2784
+ "flow_type_ids": {
2785
+ "0": 122,
2786
+ "1": 42,
2787
+ "2": 38,
2788
+ "3": 34,
2789
+ "4": 40,
2790
+ "5": 42,
2791
+ "6": 44,
2792
+ "7": 35,
2793
+ "8": 37,
2794
+ "9": 46
2795
+ },
2796
+ "traj_type_ids": {
2797
+ "0": 59,
2798
+ "1": 63,
2799
+ "2": 65,
2800
+ "3": 142,
2801
+ "4": 151
2802
+ }
2803
+ },
2804
+ "content_checks": {
2805
+ "finite_arrays": true,
2806
+ "historical_shapes": true,
2807
+ "historical_metadata": true,
2808
+ "historical_family_and_trajectory_counts": true
2809
+ }
2810
+ },
2811
+ {
2812
+ "path": "data/rebuttal/validation_magnitude_150.npz",
2813
+ "status": "reconstructed_from_recorded_protocol",
2814
+ "sha256": "6757ef7d4824db7f1e9a36ae6459081fb63e48b57925f2aeca03318f4e117636",
2815
+ "historical_container_sha256": "865f6c22085df6a788e28cb0bcf3b1bfea2b1cae7ddedb31ca099d71a3ed4051",
2816
+ "historical_container_exact": false,
2817
+ "bytes": 6399311,
2818
+ "arrays": {
2819
+ "obs": {
2820
+ "shape": [
2821
+ 480,
2822
+ 301,
2823
+ 4
2824
+ ],
2825
+ "dtype": "float32"
2826
+ },
2827
+ "actions": {
2828
+ "shape": [
2829
+ 480,
2830
+ 300,
2831
+ 3
2832
+ ],
2833
+ "dtype": "float32"
2834
+ },
2835
+ "states": {
2836
+ "shape": [
2837
+ 480,
2838
+ 301,
2839
+ 9
2840
+ ],
2841
+ "dtype": "float32"
2842
+ },
2843
+ "true_flow": {
2844
+ "shape": [
2845
+ 480,
2846
+ 301,
2847
+ 2
2848
+ ],
2849
+ "dtype": "float32"
2850
+ },
2851
+ "boat_ids": {
2852
+ "shape": [
2853
+ 480
2854
+ ],
2855
+ "dtype": "int64"
2856
+ },
2857
+ "action_dims": {
2858
+ "shape": [
2859
+ 480
2860
+ ],
2861
+ "dtype": "int64"
2862
+ },
2863
+ "flow_type_ids": {
2864
+ "shape": [
2865
+ 480
2866
+ ],
2867
+ "dtype": "int64"
2868
+ },
2869
+ "flow_ids": {
2870
+ "shape": [
2871
+ 480
2872
+ ],
2873
+ "dtype": "int64"
2874
+ },
2875
+ "traj_type_ids": {
2876
+ "shape": [
2877
+ 480
2878
+ ],
2879
+ "dtype": "int64"
2880
+ },
2881
+ "boat_params": {
2882
+ "shape": [
2883
+ 480,
2884
+ 10
2885
+ ],
2886
+ "dtype": "float32"
2887
+ }
2888
+ },
2889
+ "metadata": {
2890
+ "boats": {
2891
+ "twin": 0,
2892
+ "triangle": 1
2893
+ },
2894
+ "flows": {
2895
+ "noflow": 0,
2896
+ "uniform": 1,
2897
+ "vortex_center": 2,
2898
+ "double_gyre": 3,
2899
+ "source_sink": 4,
2900
+ "source_sink_pair": 5,
2901
+ "gradient": 6,
2902
+ "shear": 7,
2903
+ "turbulent_patch": 8,
2904
+ "random_fourier": 9
2905
+ },
2906
+ "trajectories": {
2907
+ "noflow_random_action": 0,
2908
+ "noflow_action_then_zero": 1,
2909
+ "flow_zero_action": 2,
2910
+ "flow_active_control": 3,
2911
+ "flow_waypoint_control": 4
2912
+ },
2913
+ "steps": 300,
2914
+ "workspace": [
2915
+ 0.0,
2916
+ 10.0,
2917
+ 0.0,
2918
+ 10.0
2919
+ ],
2920
+ "boundary": "terminate",
2921
+ "seed": 5304,
2922
+ "max_action_dim": 3,
2923
+ "flow_pool_size": 80,
2924
+ "episode_rng_mode": "indexed",
2925
+ "boat_param_names": [
2926
+ "mass",
2927
+ "inertia",
2928
+ "t_max",
2929
+ "drag_linear_x",
2930
+ "drag_linear_y",
2931
+ "drag_quad_x",
2932
+ "drag_quad_y",
2933
+ "drag_angular",
2934
+ "drag_angular_quad",
2935
+ "actuator_tau"
2936
+ ],
2937
+ "flow_transform": {
2938
+ "magnitude_scale": 1.5,
2939
+ "temporal_amplitude": 0.0,
2940
+ "temporal_frequency": 0.0,
2941
+ "rotation_amplitude": 0.0
2942
+ },
2943
+ "flow_switching": {
2944
+ "enabled": false,
2945
+ "interval_steps": 0,
2946
+ "switch_steps": [],
2947
+ "distinct_consecutive_families": false
2948
+ }
2949
+ },
2950
+ "counts": {
2951
+ "boat_ids": {
2952
+ "0": 248,
2953
+ "1": 232
2954
+ },
2955
+ "flow_type_ids": {
2956
+ "0": 135,
2957
+ "1": 42,
2958
+ "2": 40,
2959
+ "3": 43,
2960
+ "4": 33,
2961
+ "5": 39,
2962
+ "6": 44,
2963
+ "7": 25,
2964
+ "8": 32,
2965
+ "9": 47
2966
+ },
2967
+ "traj_type_ids": {
2968
+ "0": 64,
2969
+ "1": 71,
2970
+ "2": 64,
2971
+ "3": 122,
2972
+ "4": 159
2973
+ }
2974
+ },
2975
+ "content_checks": {
2976
+ "finite_arrays": true,
2977
+ "historical_shapes": true,
2978
+ "historical_metadata": true,
2979
+ "historical_family_and_trajectory_counts": true
2980
+ }
2981
+ }
2982
+ ],
2983
+ "existing_input_design_checks": {
2984
+ "selection": {
2985
+ "group": "selection",
2986
+ "reference": "validation_magnitude_150",
2987
+ "comparisons": {
2988
+ "validation_dynamic_slow": {
2989
+ "boat_ids": true,
2990
+ "action_dims": true,
2991
+ "flow_type_ids": true,
2992
+ "flow_ids": true,
2993
+ "traj_type_ids": true,
2994
+ "boat_params": true,
2995
+ "initial_state": true,
2996
+ "indexed_episode_rng": true
2997
+ }
2998
+ },
2999
+ "passed": true
3000
+ },
3001
+ "formal": {
3002
+ "group": "formal",
3003
+ "reference": "magnitude_100",
3004
+ "comparisons": {
3005
+ "magnitude_125": {
3006
+ "boat_ids": true,
3007
+ "action_dims": true,
3008
+ "flow_type_ids": true,
3009
+ "flow_ids": true,
3010
+ "traj_type_ids": true,
3011
+ "boat_params": true,
3012
+ "initial_state": true,
3013
+ "indexed_episode_rng": true
3014
+ },
3015
+ "magnitude_150": {
3016
+ "boat_ids": true,
3017
+ "action_dims": true,
3018
+ "flow_type_ids": true,
3019
+ "flow_ids": true,
3020
+ "traj_type_ids": true,
3021
+ "boat_params": true,
3022
+ "initial_state": true,
3023
+ "indexed_episode_rng": true
3024
+ },
3025
+ "magnitude_200": {
3026
+ "boat_ids": true,
3027
+ "action_dims": true,
3028
+ "flow_type_ids": true,
3029
+ "flow_ids": true,
3030
+ "traj_type_ids": true,
3031
+ "boat_params": true,
3032
+ "initial_state": true,
3033
+ "indexed_episode_rng": true
3034
+ },
3035
+ "dynamic_slow": {
3036
+ "boat_ids": true,
3037
+ "action_dims": true,
3038
+ "flow_type_ids": true,
3039
+ "flow_ids": true,
3040
+ "traj_type_ids": true,
3041
+ "boat_params": true,
3042
+ "initial_state": true,
3043
+ "indexed_episode_rng": true
3044
+ }
3045
+ },
3046
+ "passed": true
3047
+ },
3048
+ "frequency": {
3049
+ "anchor_frequency_hz": 0.08,
3050
+ "comparisons": {
3051
+ "0.02": {
3052
+ "boat_ids": true,
3053
+ "action_dims": true,
3054
+ "flow_type_ids": true,
3055
+ "flow_ids": true,
3056
+ "traj_type_ids": true,
3057
+ "boat_params": true,
3058
+ "initial_state": true,
3059
+ "time_zero_true_flow": true
3060
+ },
3061
+ "0.04": {
3062
+ "boat_ids": true,
3063
+ "action_dims": true,
3064
+ "flow_type_ids": true,
3065
+ "flow_ids": true,
3066
+ "traj_type_ids": true,
3067
+ "boat_params": true,
3068
+ "initial_state": true,
3069
+ "time_zero_true_flow": true
3070
+ },
3071
+ "0.08": {
3072
+ "boat_ids": true,
3073
+ "action_dims": true,
3074
+ "flow_type_ids": true,
3075
+ "flow_ids": true,
3076
+ "traj_type_ids": true,
3077
+ "boat_params": true,
3078
+ "initial_state": true,
3079
+ "time_zero_true_flow": true
3080
+ },
3081
+ "0.16": {
3082
+ "boat_ids": true,
3083
+ "action_dims": true,
3084
+ "flow_type_ids": true,
3085
+ "flow_ids": true,
3086
+ "traj_type_ids": true,
3087
+ "boat_params": true,
3088
+ "initial_state": true,
3089
+ "time_zero_true_flow": true
3090
+ },
3091
+ "0.32": {
3092
+ "boat_ids": true,
3093
+ "action_dims": true,
3094
+ "flow_type_ids": true,
3095
+ "flow_ids": true,
3096
+ "traj_type_ids": true,
3097
+ "boat_params": true,
3098
+ "initial_state": true,
3099
+ "time_zero_true_flow": true
3100
+ },
3101
+ "0.64": {
3102
+ "boat_ids": true,
3103
+ "action_dims": true,
3104
+ "flow_type_ids": true,
3105
+ "flow_ids": true,
3106
+ "traj_type_ids": true,
3107
+ "boat_params": true,
3108
+ "initial_state": true,
3109
+ "time_zero_true_flow": true
3110
+ }
3111
+ },
3112
+ "passed": true
3113
+ },
3114
+ "label_identity": {
3115
+ "train": {
3116
+ "reference": "data/paper/train.npz",
3117
+ "trajectory_fields_equal": {
3118
+ "obs": true,
3119
+ "actions": true,
3120
+ "states": true,
3121
+ "true_flow": true,
3122
+ "boat_ids": true,
3123
+ "action_dims": true,
3124
+ "flow_type_ids": true,
3125
+ "flow_ids": true,
3126
+ "traj_type_ids": true
3127
+ },
3128
+ "passed": true
3129
+ },
3130
+ "test": {
3131
+ "reference": "data/paper/test.npz",
3132
+ "trajectory_fields_equal": {
3133
+ "obs": true,
3134
+ "actions": true,
3135
+ "states": true,
3136
+ "true_flow": true,
3137
+ "boat_ids": true,
3138
+ "action_dims": true,
3139
+ "flow_type_ids": true,
3140
+ "flow_ids": true,
3141
+ "traj_type_ids": true
3142
+ },
3143
+ "passed": true
3144
+ }
3145
+ },
3146
+ "episode_disjoint": {
3147
+ "data/paper/train.npz::data/paper/test.npz": 0,
3148
+ "data/paper/train.npz::data/rebuttal/validation_id.npz": 0,
3149
+ "data/paper/test.npz::data/rebuttal/validation_id.npz": 0
3150
+ },
3151
+ "hidden_flow_pool_disjoint": {
3152
+ "seeds": {
3153
+ "train": 4301,
3154
+ "test": 4302,
3155
+ "validation": 4304
3156
+ },
3157
+ "nonzero_instances_per_split": 720,
3158
+ "grid_points_per_instance": 441,
3159
+ "overlaps": {
3160
+ "train::test": 0,
3161
+ "train::validation": 0,
3162
+ "test::validation": 0
3163
+ },
3164
+ "passed": true
3165
+ },
3166
+ "switching": {
3167
+ "path": "data/rebuttal/test_flow_switch_100.npz",
3168
+ "sha256": "d08662e23997a128266bb94bdc92bce1b4609c6b190aa5c76d7a107036062300",
3169
+ "bytes": 8062308,
3170
+ "shapes": {
3171
+ "obs": [
3172
+ 480,
3173
+ 301,
3174
+ 4
3175
+ ],
3176
+ "actions": [
3177
+ 480,
3178
+ 300,
3179
+ 3
3180
+ ],
3181
+ "states": [
3182
+ 480,
3183
+ 301,
3184
+ 9
3185
+ ],
3186
+ "true_flow": [
3187
+ 480,
3188
+ 301,
3189
+ 2
3190
+ ],
3191
+ "flow_type_ids_step": [
3192
+ 480,
3193
+ 301
3194
+ ],
3195
+ "flow_ids_step": [
3196
+ 480,
3197
+ 301
3198
+ ]
3199
+ },
3200
+ "metadata": {
3201
+ "boats": {
3202
+ "twin": 0,
3203
+ "triangle": 1
3204
+ },
3205
+ "flows": {
3206
+ "noflow": 0,
3207
+ "uniform": 1,
3208
+ "vortex_center": 2,
3209
+ "double_gyre": 3,
3210
+ "source_sink": 4,
3211
+ "source_sink_pair": 5,
3212
+ "gradient": 6,
3213
+ "shear": 7,
3214
+ "turbulent_patch": 8,
3215
+ "random_fourier": 9
3216
+ },
3217
+ "trajectories": {
3218
+ "noflow_random_action": 0,
3219
+ "noflow_action_then_zero": 1,
3220
+ "flow_zero_action": 2,
3221
+ "flow_active_control": 3,
3222
+ "flow_waypoint_control": 4
3223
+ },
3224
+ "steps": 300,
3225
+ "workspace": [
3226
+ 0.0,
3227
+ 10.0,
3228
+ 0.0,
3229
+ 10.0
3230
+ ],
3231
+ "boundary": "clip",
3232
+ "seed": 6302,
3233
+ "max_action_dim": 3,
3234
+ "flow_pool_size": 80,
3235
+ "episode_rng_mode": "indexed",
3236
+ "boat_param_names": [
3237
+ "mass",
3238
+ "inertia",
3239
+ "t_max",
3240
+ "drag_linear_x",
3241
+ "drag_linear_y",
3242
+ "drag_quad_x",
3243
+ "drag_quad_y",
3244
+ "drag_angular",
3245
+ "drag_angular_quad",
3246
+ "actuator_tau"
3247
+ ],
3248
+ "flow_transform": {
3249
+ "magnitude_scale": 1.0,
3250
+ "temporal_amplitude": 0.0,
3251
+ "temporal_frequency": 0.0,
3252
+ "rotation_amplitude": 0.0
3253
+ },
3254
+ "flow_switching": {
3255
+ "enabled": true,
3256
+ "interval_steps": 100,
3257
+ "switch_steps": [
3258
+ 100,
3259
+ 200
3260
+ ],
3261
+ "distinct_consecutive_families": true
3262
+ }
3263
+ },
3264
+ "family_changed_at_observation": {
3265
+ "101": true,
3266
+ "201": true
3267
+ },
3268
+ "flow_id_changed_at_observation": {
3269
+ "101": true,
3270
+ "201": true
3271
+ },
3272
+ "segment_family_counts": {
3273
+ "1": 148,
3274
+ "2": 157,
3275
+ "3": 160,
3276
+ "4": 165,
3277
+ "5": 152,
3278
+ "6": 146,
3279
+ "7": 161,
3280
+ "8": 178,
3281
+ "9": 173
3282
+ },
3283
+ "adaptation_bins": {
3284
+ "post_01_08": [
3285
+ [
3286
+ 101,
3287
+ 108
3288
+ ],
3289
+ [
3290
+ 201,
3291
+ 208
3292
+ ]
3293
+ ],
3294
+ "post_09_16": [
3295
+ [
3296
+ 109,
3297
+ 116
3298
+ ],
3299
+ [
3300
+ 209,
3301
+ 216
3302
+ ]
3303
+ ],
3304
+ "post_17_32": [
3305
+ [
3306
+ 117,
3307
+ 132
3308
+ ],
3309
+ [
3310
+ 217,
3311
+ 232
3312
+ ]
3313
+ ],
3314
+ "post_33_39": [
3315
+ [
3316
+ 133,
3317
+ 139
3318
+ ],
3319
+ [
3320
+ 233,
3321
+ 239
3322
+ ]
3323
+ ]
3324
+ },
3325
+ "passed": true
3326
+ }
3327
+ },
3328
+ "new_simulation_or_model_execution": false
3329
+ }
data/rebuttal/dynamic_frequency_sweep/test_freq_0020mhz.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb0eb08880ea463f75f96e409413dabe6890fc014ab089c47eb4fb6cd4d272e7
3
+ size 6575731
data/rebuttal/dynamic_frequency_sweep/test_freq_0040mhz.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5d8f5f6d5a8492297de51195f4ca9ac251358264b0221e28f96557c9365c9cf
3
+ size 6601726
data/rebuttal/dynamic_frequency_sweep/test_freq_0160mhz.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7dd0008cbdae43f55dba8a0c1eeb329ef3389c7daf98521230092cb2eab40f1
3
+ size 6542097
data/rebuttal/dynamic_frequency_sweep/test_freq_0320mhz.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a12b66bae04c44f220550d10aba0f47ccbf54f11a57612dcd774897d4962102
3
+ size 6553777
data/rebuttal/dynamic_frequency_sweep/test_freq_0640mhz.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c7aa5ddb26d6a9723e7c0eeab0ec71002157ff2a431c738980ad733db082986
3
+ size 6541317
data/rebuttal/test_dynamic_slow.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b1777f57ae41971e8a59ab94555e9d67319452e0b56de2c833ef5d20bc15a53
3
+ size 6597908
data/rebuttal/test_flow_switch_100.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d08662e23997a128266bb94bdc92bce1b4609c6b190aa5c76d7a107036062300
3
+ size 8062308
data/rebuttal/test_magnitude_100.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66522fe1ba187a91228f8105a8318d9fe1a2722c36f50f0b0547a516d30484a8
3
+ size 6458960
data/rebuttal/test_magnitude_125.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32d65c71bccd50e73f8477c61866209ffcc44d698b0cad5fe8b98090529f3b29
3
+ size 6449021
data/rebuttal/test_magnitude_150.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d8bd17a130e88a7ad68d3747d5e750ab1556c8c81d65e1b11479dde6e72f11d
3
+ size 6435332
data/rebuttal/test_magnitude_200.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58ebcd3e1215976da4abfab5864836bfb629a6fbcdc6a6d5b18cd793f8b644f6
3
+ size 6403972
data/rebuttal/test_with_params.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26d9b1c2ff8435e0379b2aab4ee8b3361b14f61d7848178cf06f99c88f2fd98c
3
+ size 6340504
data/rebuttal/train_with_params.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f31dab11ffb0e4a74865174a752861cbe216652bbce069574c1cf4e8b895ceb
3
+ size 32022080
data/rebuttal/validation_dynamic_slow.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31971828d3eeddbe87c8584bae868911d519cdb555c47b25c92143e8648fb183
3
+ size 6520807
data/rebuttal/validation_id.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07853a57ae521bedcf806853de73f40d650be300c9bfacbbc8850fa624615c4f
3
+ size 6496349
data/rebuttal/validation_magnitude_150.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6757ef7d4824db7f1e9a36ae6459081fb63e48b57925f2aeca03318f4e117636
3
+ size 6399311
driftwm/data/generate.py CHANGED
@@ -8,7 +8,8 @@ from pathlib import Path
8
  import numpy as np
9
 
10
  from driftwm.sim.env import SurfaceBoatEnv
11
- from driftwm.sim.flow import sample_flow
 
12
  from driftwm.utils import ensure_dir, pad_action
13
 
14
 
@@ -36,6 +37,7 @@ TRAJ_TO_ID = {
36
  }
37
  ID_TO_TRAJ = {v: k for k, v in TRAJ_TO_ID.items()}
38
  PAPER_FLOW_POOL_SIZE = 80
 
39
 
40
 
41
  def smooth_random_actions(rng: np.random.Generator, steps: int, action_dim: int, scale: float = 1.0) -> np.ndarray:
@@ -74,11 +76,20 @@ def choose_trajectory_type(rng: np.random.Generator) -> str:
74
  return str(rng.choice(keys, p=weights))
75
 
76
 
 
 
 
 
 
77
  def make_flow_pool(
78
  flow_types: list[str],
79
  rng: np.random.Generator,
80
  workspace: tuple[float, float, float, float],
81
  pool_size: int = PAPER_FLOW_POOL_SIZE,
 
 
 
 
82
  ) -> dict[str, list]:
83
  pool = {ft: [] for ft in flow_types}
84
  fid = 1
@@ -87,7 +98,18 @@ def make_flow_pool(
87
  pool[ft] = [sample_flow("noflow", rng, flow_id=0, workspace=workspace)]
88
  continue
89
  for _ in range(pool_size):
90
- pool[ft].append(sample_flow(ft, rng, flow_id=fid, workspace=workspace))
 
 
 
 
 
 
 
 
 
 
 
91
  fid += 1
92
  return pool
93
 
@@ -103,11 +125,34 @@ def generate_dataset(
103
  boundary: str = "terminate",
104
  randomize_params: bool = True,
105
  flow_pool_size: int = PAPER_FLOW_POOL_SIZE,
 
 
 
 
 
 
106
  ) -> None:
 
 
 
 
 
 
 
 
107
  rng = np.random.default_rng(seed)
108
  out = Path(out)
109
  ensure_dir(out.parent)
110
- flow_pool = make_flow_pool(flow_types, rng, workspace, flow_pool_size)
 
 
 
 
 
 
 
 
 
111
 
112
  obs = np.zeros((episodes, steps + 1, 4), dtype=np.float32)
113
  actions = np.zeros((episodes, steps, 3), dtype=np.float32)
@@ -118,6 +163,9 @@ def generate_dataset(
118
  flow_type_ids = np.zeros((episodes,), dtype=np.int64)
119
  flow_ids = np.zeros((episodes,), dtype=np.int64)
120
  traj_type_ids = np.zeros((episodes,), dtype=np.int64)
 
 
 
121
 
122
  env = SurfaceBoatEnv(
123
  seed=seed,
@@ -128,16 +176,38 @@ def generate_dataset(
128
  )
129
 
130
  for ep in range(episodes):
131
- traj_type = choose_trajectory_type(rng)
132
- boat = boats[int(rng.integers(0, len(boats)))]
133
- if traj_type.startswith("noflow"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  flow_type = "noflow"
 
135
  else:
136
  available = [ft for ft in flow_types if ft != "noflow"]
137
  if not available:
138
  raise ValueError("flow_types must include at least one nonzero flow family")
139
- flow_type = available[int(rng.integers(0, len(available)))]
140
- flow_template = flow_pool[flow_type][int(rng.integers(0, len(flow_pool[flow_type])))]
141
  flow = copy.deepcopy(flow_template)
142
  random_velocity = traj_type != "flow_zero_action"
143
  env.reset(
@@ -148,18 +218,18 @@ def generate_dataset(
148
  randomize_params=randomize_params,
149
  )
150
  if traj_type == "noflow_random_action":
151
- planned_actions = smooth_random_actions(rng, steps, env.action_dim, scale=1.0)
152
  elif traj_type == "noflow_action_then_zero":
153
  planned_actions = np.zeros((steps, env.action_dim), dtype=np.float32)
154
  push_len = max(12, min(50, steps // 4))
155
- planned_actions[:push_len] = smooth_random_actions(rng, push_len, env.action_dim, scale=0.95)
156
  elif traj_type == "flow_zero_action":
157
  planned_actions = np.zeros((steps, env.action_dim), dtype=np.float32)
158
  env.state[3:6] = 0.0
159
  else:
160
- planned_actions = smooth_random_actions(rng, steps, env.action_dim, scale=0.7)
161
- goal = rng.uniform([1.5, 1.5], [8.5, 8.5]).astype(np.float32)
162
- waypoints = rng.uniform([1.5, 1.5], [8.5, 8.5], size=(4, 2)).astype(np.float32)
163
  waypoint_idx = 0
164
 
165
  boat_ids[ep] = BOAT_TO_ID[boat]
@@ -167,23 +237,33 @@ def generate_dataset(
167
  flow_type_ids[ep] = FLOW_TO_ID[flow_type]
168
  flow_ids[ep] = int(env.flow.flow_id)
169
  traj_type_ids[ep] = TRAJ_TO_ID[traj_type]
 
170
  obs[ep, 0] = env.observation()
171
  states[ep, 0, : 6 + env.action_dim] = env.full_state()
172
  true_flow[ep, 0] = env.flow_at(env.state[:2])
 
 
 
 
173
 
174
  done = False
175
  for t in range(steps):
 
 
 
 
 
176
  if traj_type == "flow_waypoint_control":
177
  goal = waypoints[min(waypoint_idx, len(waypoints) - 1)]
178
  if np.linalg.norm(env.state[:2] - goal) < 0.75 and waypoint_idx < len(waypoints) - 1:
179
  waypoint_idx += 1
180
  goal = waypoints[waypoint_idx]
181
- if rng.random() < 0.88:
182
- action = simple_goal_policy(env, goal, rng)
183
  else:
184
  action = planned_actions[t]
185
- elif traj_type == "flow_active_control" and rng.random() < 0.75:
186
- action = simple_goal_policy(env, goal, rng)
187
  else:
188
  action = planned_actions[t]
189
  actions[ep, t] = pad_action(action)
@@ -191,10 +271,17 @@ def generate_dataset(
191
  obs[ep, t + 1] = ob
192
  states[ep, t + 1, : 6 + env.action_dim] = env.full_state()
193
  true_flow[ep, t + 1] = env.flow_at(env.state[:2])
 
 
 
 
194
  if done:
195
  obs[ep, t + 2 :] = obs[ep, t + 1]
196
  states[ep, t + 2 :] = states[ep, t + 1]
197
  true_flow[ep, t + 2 :] = true_flow[ep, t + 1]
 
 
 
198
  break
199
 
200
  metadata = {
@@ -207,9 +294,24 @@ def generate_dataset(
207
  "seed": seed,
208
  "max_action_dim": 3,
209
  "flow_pool_size": flow_pool_size,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  }
211
- np.savez_compressed(
212
- out,
213
  obs=obs,
214
  actions=actions,
215
  states=states,
@@ -219,8 +321,13 @@ def generate_dataset(
219
  flow_type_ids=flow_type_ids,
220
  flow_ids=flow_ids,
221
  traj_type_ids=traj_type_ids,
 
222
  metadata=json.dumps(metadata),
223
  )
 
 
 
 
224
 
225
 
226
  def main() -> None:
@@ -233,6 +340,12 @@ def main() -> None:
233
  parser.add_argument("--seed", type=int, default=0)
234
  parser.add_argument("--boundary", choices=["terminate", "bounce", "clip"], default="terminate")
235
  parser.add_argument("--flow-pool-size", type=int, default=PAPER_FLOW_POOL_SIZE)
 
 
 
 
 
 
236
  parser.add_argument("--no-randomize-params", action="store_true")
237
  args = parser.parse_args()
238
  generate_dataset(
@@ -245,6 +358,12 @@ def main() -> None:
245
  boundary=args.boundary,
246
  flow_pool_size=args.flow_pool_size,
247
  randomize_params=not args.no_randomize_params,
 
 
 
 
 
 
248
  )
249
 
250
 
 
8
  import numpy as np
9
 
10
  from driftwm.sim.env import SurfaceBoatEnv
11
+ from driftwm.sim.boat import default_boat_params
12
+ from driftwm.sim.flow import sample_flow, transform_flow
13
  from driftwm.utils import ensure_dir, pad_action
14
 
15
 
 
37
  }
38
  ID_TO_TRAJ = {v: k for k, v in TRAJ_TO_ID.items()}
39
  PAPER_FLOW_POOL_SIZE = 80
40
+ BOAT_PARAM_NAMES = tuple(default_boat_params("twin"))
41
 
42
 
43
  def smooth_random_actions(rng: np.random.Generator, steps: int, action_dim: int, scale: float = 1.0) -> np.ndarray:
 
76
  return str(rng.choice(keys, p=weights))
77
 
78
 
79
+ def choose_flow_trajectory_type(rng: np.random.Generator) -> str:
80
+ keys = ["flow_zero_action", "flow_active_control", "flow_waypoint_control"]
81
+ return str(rng.choice(keys, p=np.array([0.20, 0.38, 0.42], dtype=np.float64)))
82
+
83
+
84
  def make_flow_pool(
85
  flow_types: list[str],
86
  rng: np.random.Generator,
87
  workspace: tuple[float, float, float, float],
88
  pool_size: int = PAPER_FLOW_POOL_SIZE,
89
+ magnitude_scale: float = 1.0,
90
+ temporal_amplitude: float = 0.0,
91
+ temporal_frequency: float = 0.0,
92
+ rotation_amplitude: float = 0.0,
93
  ) -> dict[str, list]:
94
  pool = {ft: [] for ft in flow_types}
95
  fid = 1
 
98
  pool[ft] = [sample_flow("noflow", rng, flow_id=0, workspace=workspace)]
99
  continue
100
  for _ in range(pool_size):
101
+ flow = sample_flow(ft, rng, flow_id=fid, workspace=workspace)
102
+ phase = float(np.mod(fid * 2.399963229728653, 2.0 * np.pi)) if temporal_amplitude or rotation_amplitude else 0.0
103
+ pool[ft].append(
104
+ transform_flow(
105
+ flow,
106
+ magnitude_scale=magnitude_scale,
107
+ temporal_amplitude=temporal_amplitude,
108
+ temporal_frequency=temporal_frequency,
109
+ temporal_phase=phase,
110
+ rotation_amplitude=rotation_amplitude,
111
+ )
112
+ )
113
  fid += 1
114
  return pool
115
 
 
125
  boundary: str = "terminate",
126
  randomize_params: bool = True,
127
  flow_pool_size: int = PAPER_FLOW_POOL_SIZE,
128
+ flow_magnitude_scale: float = 1.0,
129
+ flow_temporal_amplitude: float = 0.0,
130
+ flow_temporal_frequency: float = 0.0,
131
+ flow_rotation_amplitude: float = 0.0,
132
+ episode_rng_mode: str = "sequential",
133
+ flow_switch_interval_steps: int = 0,
134
  ) -> None:
135
+ if episode_rng_mode not in {"sequential", "indexed"}:
136
+ raise ValueError(f"unsupported episode_rng_mode: {episode_rng_mode}")
137
+ if flow_switch_interval_steps < 0:
138
+ raise ValueError("flow_switch_interval_steps must be nonnegative")
139
+ switching = flow_switch_interval_steps > 0
140
+ nonzero_flow_types = [flow_type for flow_type in flow_types if flow_type != "noflow"]
141
+ if switching and len(nonzero_flow_types) < 2:
142
+ raise ValueError("flow switching requires at least two nonzero flow families")
143
  rng = np.random.default_rng(seed)
144
  out = Path(out)
145
  ensure_dir(out.parent)
146
+ flow_pool = make_flow_pool(
147
+ flow_types,
148
+ rng,
149
+ workspace,
150
+ flow_pool_size,
151
+ magnitude_scale=flow_magnitude_scale,
152
+ temporal_amplitude=flow_temporal_amplitude,
153
+ temporal_frequency=flow_temporal_frequency,
154
+ rotation_amplitude=flow_rotation_amplitude,
155
+ )
156
 
157
  obs = np.zeros((episodes, steps + 1, 4), dtype=np.float32)
158
  actions = np.zeros((episodes, steps, 3), dtype=np.float32)
 
163
  flow_type_ids = np.zeros((episodes,), dtype=np.int64)
164
  flow_ids = np.zeros((episodes,), dtype=np.int64)
165
  traj_type_ids = np.zeros((episodes,), dtype=np.int64)
166
+ boat_params = np.zeros((episodes, len(BOAT_PARAM_NAMES)), dtype=np.float32)
167
+ flow_type_ids_step = np.zeros((episodes, steps + 1), dtype=np.int64) if switching else None
168
+ flow_ids_step = np.zeros((episodes, steps + 1), dtype=np.int64) if switching else None
169
 
170
  env = SurfaceBoatEnv(
171
  seed=seed,
 
176
  )
177
 
178
  for ep in range(episodes):
179
+ episode_rng = (
180
+ rng
181
+ if episode_rng_mode == "sequential"
182
+ else np.random.default_rng(np.random.SeedSequence([int(seed), int(ep), 0x53545253]))
183
+ )
184
+ traj_type = choose_flow_trajectory_type(episode_rng) if switching else choose_trajectory_type(episode_rng)
185
+ boat = boats[int(episode_rng.integers(0, len(boats)))]
186
+ if switching:
187
+ segment_count = (steps - 1) // flow_switch_interval_steps + 1
188
+ flow_sequence: list[str] = []
189
+ for _segment in range(segment_count):
190
+ candidates = [
191
+ candidate
192
+ for candidate in nonzero_flow_types
193
+ if not flow_sequence or candidate != flow_sequence[-1]
194
+ ]
195
+ flow_sequence.append(candidates[int(episode_rng.integers(0, len(candidates)))])
196
+ flow_templates = [
197
+ flow_pool[flow_type][int(episode_rng.integers(0, len(flow_pool[flow_type])))]
198
+ for flow_type in flow_sequence
199
+ ]
200
+ flow_type = flow_sequence[0]
201
+ flow_template = flow_templates[0]
202
+ elif traj_type.startswith("noflow"):
203
  flow_type = "noflow"
204
+ flow_template = flow_pool[flow_type][int(episode_rng.integers(0, len(flow_pool[flow_type])))]
205
  else:
206
  available = [ft for ft in flow_types if ft != "noflow"]
207
  if not available:
208
  raise ValueError("flow_types must include at least one nonzero flow family")
209
+ flow_type = available[int(episode_rng.integers(0, len(available)))]
210
+ flow_template = flow_pool[flow_type][int(episode_rng.integers(0, len(flow_pool[flow_type])))]
211
  flow = copy.deepcopy(flow_template)
212
  random_velocity = traj_type != "flow_zero_action"
213
  env.reset(
 
218
  randomize_params=randomize_params,
219
  )
220
  if traj_type == "noflow_random_action":
221
+ planned_actions = smooth_random_actions(episode_rng, steps, env.action_dim, scale=1.0)
222
  elif traj_type == "noflow_action_then_zero":
223
  planned_actions = np.zeros((steps, env.action_dim), dtype=np.float32)
224
  push_len = max(12, min(50, steps // 4))
225
+ planned_actions[:push_len] = smooth_random_actions(episode_rng, push_len, env.action_dim, scale=0.95)
226
  elif traj_type == "flow_zero_action":
227
  planned_actions = np.zeros((steps, env.action_dim), dtype=np.float32)
228
  env.state[3:6] = 0.0
229
  else:
230
+ planned_actions = smooth_random_actions(episode_rng, steps, env.action_dim, scale=0.7)
231
+ goal = episode_rng.uniform([1.5, 1.5], [8.5, 8.5]).astype(np.float32)
232
+ waypoints = episode_rng.uniform([1.5, 1.5], [8.5, 8.5], size=(4, 2)).astype(np.float32)
233
  waypoint_idx = 0
234
 
235
  boat_ids[ep] = BOAT_TO_ID[boat]
 
237
  flow_type_ids[ep] = FLOW_TO_ID[flow_type]
238
  flow_ids[ep] = int(env.flow.flow_id)
239
  traj_type_ids[ep] = TRAJ_TO_ID[traj_type]
240
+ boat_params[ep] = np.array([env.params[name] for name in BOAT_PARAM_NAMES], dtype=np.float32)
241
  obs[ep, 0] = env.observation()
242
  states[ep, 0, : 6 + env.action_dim] = env.full_state()
243
  true_flow[ep, 0] = env.flow_at(env.state[:2])
244
+ if switching:
245
+ assert flow_type_ids_step is not None and flow_ids_step is not None
246
+ flow_type_ids_step[ep, 0] = FLOW_TO_ID[flow_type]
247
+ flow_ids_step[ep, 0] = int(env.flow.flow_id)
248
 
249
  done = False
250
  for t in range(steps):
251
+ if switching and t > 0 and t % flow_switch_interval_steps == 0:
252
+ segment = t // flow_switch_interval_steps
253
+ flow_type = flow_sequence[segment]
254
+ env.config.flow_type = flow_type
255
+ env.flow = copy.deepcopy(flow_templates[segment])
256
  if traj_type == "flow_waypoint_control":
257
  goal = waypoints[min(waypoint_idx, len(waypoints) - 1)]
258
  if np.linalg.norm(env.state[:2] - goal) < 0.75 and waypoint_idx < len(waypoints) - 1:
259
  waypoint_idx += 1
260
  goal = waypoints[waypoint_idx]
261
+ if episode_rng.random() < 0.88:
262
+ action = simple_goal_policy(env, goal, episode_rng)
263
  else:
264
  action = planned_actions[t]
265
+ elif traj_type == "flow_active_control" and episode_rng.random() < 0.75:
266
+ action = simple_goal_policy(env, goal, episode_rng)
267
  else:
268
  action = planned_actions[t]
269
  actions[ep, t] = pad_action(action)
 
271
  obs[ep, t + 1] = ob
272
  states[ep, t + 1, : 6 + env.action_dim] = env.full_state()
273
  true_flow[ep, t + 1] = env.flow_at(env.state[:2])
274
+ if switching:
275
+ assert flow_type_ids_step is not None and flow_ids_step is not None
276
+ flow_type_ids_step[ep, t + 1] = FLOW_TO_ID[flow_type]
277
+ flow_ids_step[ep, t + 1] = int(env.flow.flow_id)
278
  if done:
279
  obs[ep, t + 2 :] = obs[ep, t + 1]
280
  states[ep, t + 2 :] = states[ep, t + 1]
281
  true_flow[ep, t + 2 :] = true_flow[ep, t + 1]
282
+ if switching:
283
+ flow_type_ids_step[ep, t + 2 :] = flow_type_ids_step[ep, t + 1]
284
+ flow_ids_step[ep, t + 2 :] = flow_ids_step[ep, t + 1]
285
  break
286
 
287
  metadata = {
 
294
  "seed": seed,
295
  "max_action_dim": 3,
296
  "flow_pool_size": flow_pool_size,
297
+ "episode_rng_mode": episode_rng_mode,
298
+ "boat_param_names": list(BOAT_PARAM_NAMES),
299
+ "flow_transform": {
300
+ "magnitude_scale": float(flow_magnitude_scale),
301
+ "temporal_amplitude": float(flow_temporal_amplitude),
302
+ "temporal_frequency": float(flow_temporal_frequency),
303
+ "rotation_amplitude": float(flow_rotation_amplitude),
304
+ },
305
+ "flow_switching": {
306
+ "enabled": switching,
307
+ "interval_steps": int(flow_switch_interval_steps),
308
+ "switch_steps": list(range(flow_switch_interval_steps, steps, flow_switch_interval_steps))
309
+ if switching
310
+ else [],
311
+ "distinct_consecutive_families": bool(switching),
312
+ },
313
  }
314
+ arrays = dict(
 
315
  obs=obs,
316
  actions=actions,
317
  states=states,
 
321
  flow_type_ids=flow_type_ids,
322
  flow_ids=flow_ids,
323
  traj_type_ids=traj_type_ids,
324
+ boat_params=boat_params,
325
  metadata=json.dumps(metadata),
326
  )
327
+ if switching:
328
+ arrays["flow_type_ids_step"] = flow_type_ids_step
329
+ arrays["flow_ids_step"] = flow_ids_step
330
+ np.savez_compressed(out, **arrays)
331
 
332
 
333
  def main() -> None:
 
340
  parser.add_argument("--seed", type=int, default=0)
341
  parser.add_argument("--boundary", choices=["terminate", "bounce", "clip"], default="terminate")
342
  parser.add_argument("--flow-pool-size", type=int, default=PAPER_FLOW_POOL_SIZE)
343
+ parser.add_argument("--flow-magnitude-scale", type=float, default=1.0)
344
+ parser.add_argument("--flow-temporal-amplitude", type=float, default=0.0)
345
+ parser.add_argument("--flow-temporal-frequency", type=float, default=0.0)
346
+ parser.add_argument("--flow-rotation-amplitude", type=float, default=0.0)
347
+ parser.add_argument("--episode-rng-mode", choices=["sequential", "indexed"], default="sequential")
348
+ parser.add_argument("--flow-switch-interval-steps", type=int, default=0)
349
  parser.add_argument("--no-randomize-params", action="store_true")
350
  args = parser.parse_args()
351
  generate_dataset(
 
358
  boundary=args.boundary,
359
  flow_pool_size=args.flow_pool_size,
360
  randomize_params=not args.no_randomize_params,
361
+ flow_magnitude_scale=args.flow_magnitude_scale,
362
+ flow_temporal_amplitude=args.flow_temporal_amplitude,
363
+ flow_temporal_frequency=args.flow_temporal_frequency,
364
+ flow_rotation_amplitude=args.flow_rotation_amplitude,
365
+ episode_rng_mode=args.episode_rng_mode,
366
+ flow_switch_interval_steps=args.flow_switch_interval_steps,
367
  )
368
 
369
 
driftwm/sim/flow.py CHANGED
@@ -48,6 +48,83 @@ class Flow:
48
  return {"flow_type": self.name, "flow_id": int(self.flow_id)}
49
 
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  @dataclass
52
  class NoFlow(Flow):
53
  def __init__(self, flow_id: int = 0):
 
48
  return {"flow_type": self.name, "flow_id": int(self.flow_id)}
49
 
50
 
51
+ @dataclass
52
+ class TransformedFlow(Flow):
53
+ """Magnitude and temporal transform around an existing spatial flow field."""
54
+
55
+ base_flow: Flow
56
+ magnitude_scale: float
57
+ temporal_amplitude: float
58
+ temporal_frequency: float
59
+ temporal_phase: float
60
+ rotation_amplitude: float
61
+
62
+ def __init__(
63
+ self,
64
+ base_flow: Flow,
65
+ magnitude_scale: float = 1.0,
66
+ temporal_amplitude: float = 0.0,
67
+ temporal_frequency: float = 0.0,
68
+ temporal_phase: float = 0.0,
69
+ rotation_amplitude: float = 0.0,
70
+ ):
71
+ super().__init__(base_flow.name, base_flow.flow_id)
72
+ self.base_flow = base_flow
73
+ self.magnitude_scale = float(magnitude_scale)
74
+ self.temporal_amplitude = float(temporal_amplitude)
75
+ self.temporal_frequency = float(temporal_frequency)
76
+ self.temporal_phase = float(temporal_phase)
77
+ self.rotation_amplitude = float(rotation_amplitude)
78
+
79
+ def velocity(self, pos: np.ndarray, t: float = 0.0) -> np.ndarray:
80
+ velocity = self.base_flow.velocity(pos, t)
81
+ phase = 2.0 * np.pi * self.temporal_frequency * float(t) + self.temporal_phase
82
+ scale = self.magnitude_scale * (1.0 + self.temporal_amplitude * np.sin(phase))
83
+ angle = self.rotation_amplitude * np.sin(phase)
84
+ c = np.cos(angle)
85
+ s = np.sin(angle)
86
+ vx = scale * (c * velocity[..., 0] - s * velocity[..., 1])
87
+ vy = scale * (s * velocity[..., 0] + c * velocity[..., 1])
88
+ return np.stack([vx, vy], axis=-1).astype(np.float32)
89
+
90
+ def metadata(self) -> dict[str, Any]:
91
+ out = self.base_flow.metadata()
92
+ out["transform"] = {
93
+ "magnitude_scale": self.magnitude_scale,
94
+ "temporal_amplitude": self.temporal_amplitude,
95
+ "temporal_frequency": self.temporal_frequency,
96
+ "temporal_phase": self.temporal_phase,
97
+ "rotation_amplitude": self.rotation_amplitude,
98
+ }
99
+ return out
100
+
101
+
102
+ def transform_flow(
103
+ flow: Flow,
104
+ *,
105
+ magnitude_scale: float = 1.0,
106
+ temporal_amplitude: float = 0.0,
107
+ temporal_frequency: float = 0.0,
108
+ temporal_phase: float = 0.0,
109
+ rotation_amplitude: float = 0.0,
110
+ ) -> Flow:
111
+ if (
112
+ magnitude_scale == 1.0
113
+ and temporal_amplitude == 0.0
114
+ and temporal_frequency == 0.0
115
+ and rotation_amplitude == 0.0
116
+ ):
117
+ return flow
118
+ return TransformedFlow(
119
+ flow,
120
+ magnitude_scale=magnitude_scale,
121
+ temporal_amplitude=temporal_amplitude,
122
+ temporal_frequency=temporal_frequency,
123
+ temporal_phase=temporal_phase,
124
+ rotation_amplitude=rotation_amplitude,
125
+ )
126
+
127
+
128
  @dataclass
129
  class NoFlow(Flow):
130
  def __init__(self, flow_id: int = 0):
experiments/BASELINES.md DELETED
@@ -1,44 +0,0 @@
1
- # Baseline Scope
2
-
3
- The public benchmark has two formal comparison groups.
4
-
5
- ## A. Learned World Models
6
-
7
- Purpose: compare image-input world-model architectures under the same data, optimizer budget, rollout target, and planning interface.
8
-
9
- | Directory | Report Name | Why It Is Included |
10
- |---|---|---|
11
- | `flowmo` | FlowMo | Proposed flow-momentum WM. Separates short object motion state from long ambient drift context. |
12
- | `leworldmodel` | LeWorldModel | Simple JEPA-style latent prediction baseline. Tests whether current-image latent dynamics are enough. |
13
- | `planet` | PlaNet RSSM | Recurrent state-space baseline. Tests whether generic recurrent memory can absorb momentum and drift. |
14
- | `tdmpc2` | TD-MPC2 Dynamics | Compact latent-dynamics baseline. Tests action-conditioned latent rollout with a task-oriented architecture. |
15
-
16
- Comparison outputs:
17
-
18
- ```text
19
- rollout prediction error
20
- heading prediction error
21
- context ablation for FlowMo
22
- planning metrics when the learned WM is used inside the shared planner
23
- ```
24
-
25
- ## B. Traditional Non-WM Controllers
26
-
27
- Purpose: compare downstream behavior against hand-designed controllers that do not train a neural world model.
28
-
29
- | Directory | Report Name | Why It Is Included |
30
- |---|---|---|
31
- | `pid_los_controller` | PID/LOS controller | Simple classical waypoint tracking baseline. |
32
- | `no_flow_los_controller` | No-Flow LOS Controller | Geometric line-of-sight controller that ignores ambient current. |
33
- | `current_estimator_los_controller` | Current-Estimator LOS Controller | Strong classical baseline that estimates current from recent drift. |
34
- | `oracle_flow_los_controller` | Oracle-Flow LOS Controller | Geometric line-of-sight controller with true local flow feed-forward. |
35
-
36
- Comparison outputs:
37
-
38
- ```text
39
- success rate
40
- final distance
41
- trajectory length over successful episodes
42
- control effort (`sum_t ||a_t||_2^2`) over successful episodes
43
- time to goal over successful episodes
44
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
experiments/EXPERIMENT_MATRIX.md DELETED
@@ -1,166 +0,0 @@
1
- # FlowMo Paper Experiment Matrix
2
-
3
- This document defines the paper-facing experiments. File and run names avoid version suffixes; regenerated artifacts replace the same public paths.
4
-
5
- ## Shared Data And Observation Protocol
6
-
7
- All learned world models use the same simulator data and clean-image observation pipeline.
8
-
9
- ```text
10
- Image input: clean top-down RGB boat image
11
- Image size: 160 x 160
12
- Visual scale: 2.5
13
- Forbidden image cues: flow arrows, velocity vectors, trajectory overlays, goal marker
14
- Train split: data/paper/train.npz
15
- Test split: data/paper/test.npz
16
- Flow families: noflow, uniform, vortex_center, double_gyre, source_sink, source_sink_pair, gradient, shear, turbulent_patch, random_fourier
17
- Config: experiments/shared/config/paper_image.json
18
- Checkpoint: paper.pt
19
- Intermediate checkpoints: paper_step_XXXXXX.pt
20
- ```
21
-
22
- All flow fields are static. Localized flow structures are sampled near the
23
- route corridors used by the training controllers and final planning tasks.
24
-
25
- Formal training budget:
26
-
27
- ```text
28
- train_episodes: 2400
29
- test_episodes: 480
30
- train_windows: 393216
31
- test_windows: 24576
32
- batch_size: 256
33
- steps: 20000
34
- checkpoint_interval: 2000
35
- num_workers: 4
36
- render_mode: device
37
- training_parallel_jobs: 2
38
- planning_parallel_jobs: 3
39
- ```
40
-
41
- Precision policy:
42
-
43
- ```text
44
- training: bf16 model autocast, fp32 losses and metrics
45
- prediction_eval: bf16 model autocast, fp32 metrics
46
- planning_eval: fp32
47
- ```
48
-
49
- ## A. Learned World-Model Comparison
50
-
51
- Purpose: measure world-model quality directly. The key question is whether FlowMo's short object-motion state plus long ambient-drift context improves rollout prediction under hidden currents and momentum.
52
-
53
- | Method | Comparison Role | What It Tests |
54
- |---|---|---|
55
- | `flowmo` | Proposed WM | Explicit flow-momentum factorization: short state/momentum latent, long drift context, zero-context residual transition. |
56
- | `leworldmodel` | JEPA-style WM baseline | Whether simple image-latent prediction without explicit history/context can handle boat momentum and flow. |
57
- | `planet` | RSSM WM baseline | Whether generic recurrent latent memory can represent momentum and drift without a separate context factor. |
58
- | `tdmpc2` | Compact latent-dynamics WM baseline | Whether a compact action-conditioned latent transition matches FlowMo under equal supervision. |
59
-
60
- Prediction dataset:
61
-
62
- ```text
63
- test
64
- ```
65
-
66
- Prediction metrics:
67
-
68
- ```text
69
- pos@1, pos@5, pos@10, pos@20, pos@40, pos@60
70
- heading@20, heading@60
71
- zero-action drift error
72
- no-flow momentum decay error
73
- same-action different-flow error
74
- ```
75
-
76
- FlowMo context diagnostics:
77
-
78
- | Diagnostic | Operation | Evidence Sought |
79
- |---|---|---|
80
- | Inferred context | Normal rollout with inferred `c_t` | Best prediction under flow. |
81
- | Zero context | Set `c_t=0` | Degraded flow prediction, smaller change in no-flow. |
82
- | Shuffled context | Use context from another episode | Worse rollout when hidden flow differs. |
83
- | Same-flow transfer | Use context from another episode with the same hidden flow | Better than wrong-flow context transfer. |
84
- | No-flow context norm | Measure `||c_t||` on no-flow data | Smaller than flow context norm. |
85
- | Context PCA | Plot `c_t` by flow family / flow id | Flow-related organization. |
86
-
87
- FlowMo latent probes:
88
-
89
- | Probe Target | Feature Sets | Purpose |
90
- |---|---|---|
91
- | Object momentum `(vx, vy, omega)` | `z_t`, `c_t`, `[z_t,c_t]` | Tests whether short-history state contains object motion. |
92
- | Local flow vector | `z_t`, `c_t`, `[z_t,c_t]` | Tests whether state plus context exposes local ambient drift. |
93
- | Episode drift vector | `z_t`, `c_t`, `[z_t,c_t]` | Tests whether long context contains environment-level drift. |
94
-
95
- ## B. Traditional Non-WM Control Comparison
96
-
97
- Purpose: provide downstream control references and report practical task behavior. The central WM claim still comes from A; B shows whether prediction differences matter for planning and control.
98
-
99
- Learned WM planners:
100
-
101
- ```text
102
- flowmo
103
- leworldmodel
104
- planet
105
- tdmpc2
106
- ```
107
-
108
- Traditional non-WM controllers:
109
-
110
- | Method | Comparison Role | What It Tests |
111
- |---|---|---|
112
- | `pid_los_controller` | Simple classical controller | Baseline waypoint tracking without learned dynamics. |
113
- | `no_flow_los_controller` | No-flow LOS controller | Effect of ignoring hidden current in a geometric controller. |
114
- | `current_estimator_los_controller` | Current-estimator LOS controller | Strength of a hand-designed drift estimator in a geometric controller. |
115
- | `oracle_flow_los_controller` | Oracle-flow LOS controller | Effect of true local flow feed-forward in a geometric controller. |
116
-
117
- Planning tasks:
118
-
119
- ```text
120
- reach_target
121
- station_keeping
122
- waypoint_square
123
- waypoint_zigzag
124
- ```
125
-
126
- Boats:
127
-
128
- ```text
129
- twin
130
- triangle
131
- ```
132
-
133
- Flow families:
134
-
135
- ```text
136
- noflow
137
- uniform
138
- vortex_center
139
- double_gyre
140
- source_sink
141
- source_sink_pair
142
- gradient
143
- shear
144
- turbulent_patch
145
- random_fourier
146
- ```
147
-
148
- Planning metrics:
149
-
150
- ```text
151
- success rate
152
- final distance
153
- trajectory length over successful episodes
154
- control effort (`sum_t ||a_t||_2^2`) over successful episodes
155
- time to goal over successful episodes
156
- ```
157
-
158
- Formal commands:
159
-
160
- ```bash
161
- python -m experiments.run_paper_image_pipeline --stages train
162
- python -m experiments.run_paper_image_pipeline --stages prediction
163
- python -m experiments.run_paper_image_pipeline --stages probe
164
- python -m experiments.run_paper_image_pipeline --stages planning
165
- python -m experiments.run_paper_image_pipeline --stages report
166
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
experiments/METHOD_AUDIT.md DELETED
@@ -1,30 +0,0 @@
1
- # FlowMo Method And Baseline Audit
2
-
3
- This document records what each paper-facing method implements and what comparison it supports.
4
-
5
- ## A. Learned World Models
6
-
7
- | Method | Implemented Architecture | Rollout State | Transition Form | Comparison Purpose |
8
- |---|---|---|---|---|
9
- | FlowMo | Shared image encoder; short state GRU; long strided context GRU; base transition plus zero-context residual | `z_t` plus `c_t` | `z + F0(z,a) + R(z,c) - R(z,0)` | Tests whether separating short object motion from long ambient drift improves prediction and planning. |
10
- | LeWorldModel | Image encoder; current-frame latent state; action-conditioned residual transition | `z_t` | `z + F(z,a)` | Tests a simple JEPA-style image-latent predictor without temporal drift context. |
11
- | PlaNet RSSM | Image encoder; deterministic recurrent state; stochastic latent posterior/prior; decoder from recurrent plus stochastic state | deterministic recurrent state plus stochastic latent | recurrent transition plus prior/posterior latent | Tests generic recurrent state-space memory under the shared rollout protocol. |
12
- | TD-MPC2 Dynamics | Image encoder; short action-conditioned history encoder; residual latent dynamics | `z_t` | `z + F(z,a)` after history encoding | Tests compact action-conditioned latent dynamics without explicit drift context. |
13
-
14
- ## B. Traditional Non-WM Controllers
15
-
16
- | Method | Input | Controller Type | Comparison Purpose |
17
- |---|---|---|---|
18
- | PID/LOS controller | Clean image pose estimate | Line-of-sight waypoint tracking | Simple hand-designed tracking baseline. |
19
- | No-Flow LOS Controller | Clean image pose estimate | Line-of-sight tracking without flow compensation | Measures the cost of ignoring external current. |
20
- | Current-Estimator LOS Controller | Clean image pose estimate and recent drift | Line-of-sight tracking with online drift estimate | Strong classical current-compensation baseline. |
21
- | Oracle-Flow LOS Controller | Clean image pose estimate and simulator local flow | Line-of-sight tracking with true local flow feed-forward | Privileged-information reference for how much true local flow helps a simple geometric controller. |
22
-
23
- ## Architecture Difference Checklist
24
-
25
- | Method | Uses History | Has Long Context | Has Explicit Drift Context | Distinct From FlowMo |
26
- |---|---|---|---|---|
27
- | FlowMo | Yes, short state history | Yes, strided long context | Yes, `c_t` | Proposed factorization. |
28
- | LeWorldModel | No, current image only | No | No | Tests no-history latent prediction. |
29
- | PlaNet RSSM | Yes | No | No | Tests generic recurrent memory. |
30
- | TD-MPC2 Dynamics | Yes, short history | No | No | Tests compact latent dynamics. |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
experiments/README.md DELETED
@@ -1,86 +0,0 @@
1
- # Experiments
2
-
3
- This directory contains the paper-facing experiment code, checkpoints, results, GIFs, tables, and reports.
4
-
5
- This directory contains two formal experiment categories:
6
-
7
- - **A. Learned world models**: trainable image-input WMs evaluated on rollout prediction and WM-based planning.
8
- - **B. Traditional non-WM controllers**: hand-designed control baselines evaluated on the same downstream tasks.
9
-
10
- Main method:
11
-
12
- - **FlowMo**: Flow-Momentum World Model, the proposed drift-aware world model for surface vehicles.
13
-
14
- Category A learned WM comparisons:
15
-
16
- - **LeWorldModel**: JEPA-style latent predictor under the shared clean-image protocol.
17
- - **PlaNet RSSM**: recurrent state-space world-model baseline under the shared clean-image protocol.
18
- - **TD-MPC2 Dynamics**: task-oriented latent dynamics baseline under the shared clean-image protocol.
19
-
20
- Purpose of Category A: compare world-model architectures under identical image data, optimizer budget, rollout target, and evaluation protocol.
21
-
22
- Category B traditional controllers:
23
-
24
- - **PID/LOS controller**
25
- - **No-Flow LOS Controller**
26
- - **Current-Estimator LOS Controller**
27
- - **Oracle-Flow LOS Controller**
28
-
29
- Purpose of Category B: compare downstream task behavior against non-neural controllers that do not train a world model.
30
-
31
- Baseline details are documented in `BASELINES.md`; the full experiment protocol is documented in `docs/EXPERIMENT_PROTOCOL.md`.
32
-
33
- Design principles:
34
-
35
- - Shared simulator, datasets, planning utilities, metrics, and visualization live in `shared/`.
36
- - Each method has its own directory with `src/`, `checkpoint/`, and `result/`.
37
- - Paper artifacts are collected under `reports/`.
38
- - Method names should be explicit and readable. Avoid cryptic suffixes in paper-facing file names.
39
-
40
- Standard method interface:
41
-
42
- ```text
43
- src/model.py # build_model(), load_model()
44
- src/train.py # train(config)
45
- src/predict.py # rollout(model, batch)
46
- src/config.py # default_config()
47
- ```
48
-
49
- Closed-loop planning for learned world models is implemented once in `evaluate_image_planning.py` so every learned method is evaluated through the same CEM interface.
50
-
51
- Traditional controllers use:
52
-
53
- ```text
54
- src/controller.py or src/mpc.py
55
- src/evaluate.py
56
- src/config.py
57
- ```
58
-
59
- Formal clean-image configuration:
60
-
61
- ```text
62
- image_size=160
63
- visual_scale=2.5
64
- train=data/paper/train.npz
65
- test=data/paper/test.npz
66
- flow_families=noflow, uniform, vortex_center, double_gyre, source_sink, source_sink_pair, gradient, shear, turbulent_patch, random_fourier
67
- ```
68
-
69
- Full paper-facing image pipeline:
70
-
71
- ```bash
72
- python -m experiments.run_paper_image_pipeline
73
- ```
74
-
75
- The default command runs the paper configuration end to end: train all learned world models, evaluate long rollout prediction, run FlowMo latent probes, evaluate closed-loop planning against traditional controllers, generate GIFs, and write the final report. Images are rendered online from simulator states, so no separate image-cache preparation step is required.
76
- All flow fields are static. Localized flow structures are sampled near task routes so that boat trajectories encounter non-uniform current in the shared train/test/final protocol.
77
-
78
- Manual image training:
79
-
80
- ```bash
81
- python -m experiments.train_image_world_models
82
- python -m experiments.evaluate_image_world_models
83
- python -m experiments.evaluate_flowmo_latent_probes
84
- python -m experiments.evaluate_image_planning --task reach_target --boat twin
85
- python -m experiments.summarize_paper_image_results
86
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
experiments/TASK_PLAN.md DELETED
@@ -1,131 +0,0 @@
1
- # Paper Task Plan
2
-
3
- This is the execution plan for the public FlowMo experiments. The plan has two parts: A evaluates world models directly, and B evaluates downstream control behavior with traditional non-WM references.
4
-
5
- ## A. Learned World Models
6
-
7
- Purpose: test whether the FlowMo world-model architecture improves image-based prediction under hidden flow, boat momentum, actuator delay, and drag.
8
-
9
- Shared setup:
10
-
11
- ```text
12
- Input: clean top-down boat images plus action history
13
- No image cues: no flow arrows, no velocity vector, no goal marker
14
- Training data: data/paper/train.npz
15
- Evaluation data: data/paper/test.npz
16
- Flow families: noflow, uniform, vortex_center, double_gyre, source_sink, source_sink_pair, gradient, shear, turbulent_patch, random_fourier
17
- All flow fields are static. Localized flow structures are sampled near common
18
- task routes so the boat encounters non-uniform current during rollout.
19
- Training budget: shared optimizer, batch size, rollout horizon, step count, and checkpoint schedule
20
- Training precision: BF16 model autocast, FP32 losses and metrics
21
- Prediction precision: BF16 model autocast, FP32 metrics
22
- ```
23
-
24
- Compared methods:
25
-
26
- | Method | Purpose |
27
- |---|---|
28
- | `flowmo` | Proposed flow-momentum WM. Tests explicit separation of short object-motion state and long ambient-drift context. |
29
- | `leworldmodel` | JEPA-style latent predictor. Tests whether a simple current-image latent transition is sufficient. |
30
- | `planet` | RSSM recurrent state-space WM. Tests whether generic recurrent latent memory can absorb momentum and flow effects without FlowMo's explicit context. |
31
- | `tdmpc2` | Compact latent-dynamics WM. Tests whether a task-oriented latent transition architecture matches FlowMo under the same rollout supervision. |
32
-
33
- Primary A metrics:
34
-
35
- ```text
36
- pos@1, pos@5, pos@10, pos@20, pos@40, pos@60
37
- heading@20, heading@60
38
- zero-action drift prediction error
39
- no-flow momentum decay prediction error
40
- same-action different-flow prediction error
41
- FlowMo inferred-context vs c=0 vs shuffled-context error
42
- ```
43
-
44
- Required A outputs:
45
-
46
- ```text
47
- experiments/<method>/checkpoint/paper.pt
48
- experiments/<method>/checkpoint/paper_step_*.pt
49
- experiments/<method>/result/parameter_count.json
50
- experiments/<method>/result/paper_training.json
51
- experiments/reports/paper_prediction.json
52
- experiments/reports/paper_flowmo_latent_probes.json
53
- ```
54
-
55
- Core A conclusions:
56
-
57
- ```text
58
- 1. Whether FlowMo has lower long-horizon rollout error.
59
- 2. Whether the gain holds across the full paper flow-family set.
60
- 3. Whether explicit drift context helps beyond ordinary recurrent history.
61
- 4. Whether the same architecture works for both twin and triangle boats.
62
- 5. Whether frozen linear probes recover object momentum from `z_t` and ambient drift from `c_t`.
63
- ```
64
-
65
- ## B. Traditional Non-WM Controllers
66
-
67
- Purpose: evaluate downstream control behavior and provide non-neural-control reference points. These methods do not train a world model.
68
-
69
- Shared setup:
70
-
71
- ```text
72
- Input: clean top-down images converted to pose for classical control
73
- Tasks: same simulator, same boats, same goals, same flow settings
74
- Metrics: success, final distance, successful-episode trajectory length, successful-episode thrust energy, successful-episode time-to-goal
75
- Planning precision: FP32
76
- ```
77
-
78
- Compared methods:
79
-
80
- | Method | Purpose |
81
- |---|---|
82
- | `pid_los_controller` | Classical line-of-sight waypoint tracking. Tests a simple hand-designed controller. |
83
- | `no_flow_los_controller` | No-flow LOS controller without external-current compensation. Tests how much hidden flow hurts a nominal dynamics controller. |
84
- | `current_estimator_los_controller` | LOS controller with recent-drift current estimation. Tests a strong classical current-compensation baseline. |
85
- | `oracle_flow_los_controller` | LOS controller with simulator true local flow feed-forward. Tests whether local flow feed-forward helps a simple geometric controller; it is not a full dynamics-MPC upper bound. |
86
-
87
- Planning tasks:
88
-
89
- ```text
90
- reach_target
91
- station_keeping
92
- waypoint_square
93
- waypoint_zigzag
94
- ```
95
-
96
- Boats:
97
-
98
- ```text
99
- twin
100
- triangle
101
- ```
102
-
103
- Flow families:
104
-
105
- ```text
106
- noflow
107
- uniform
108
- vortex_center
109
- double_gyre
110
- source_sink
111
- source_sink_pair
112
- gradient
113
- shear
114
- turbulent_patch
115
- random_fourier
116
- ```
117
-
118
- Required B outputs:
119
-
120
- ```text
121
- experiments/reports/paper_planning/*.json
122
- experiments/reports/paper_planning/gifs/*.gif
123
- ```
124
-
125
- Core B conclusions:
126
-
127
- ```text
128
- 1. Whether WM-based planning is competitive with classical non-WM control.
129
- 2. Whether FlowMo improves success, final distance, energy, and path length versus other learned WMs.
130
- 3. How far FlowMo remains from the oracle-flow classical reference.
131
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
experiments/current_estimator_los_controller/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Current-Estimator LOS Controller Baseline
2
-
3
- Traditional line-of-sight controller with an online image-history estimate of recent drift.
 
 
 
 
experiments/current_estimator_los_controller/result/.gitkeep DELETED
File without changes
experiments/docs/EXPERIMENT_PROTOCOL.md DELETED
@@ -1,231 +0,0 @@
1
- # FlowMo Experiment Protocol
2
-
3
- This document is the single paper-facing record for the public FlowMo experiments. Regenerated artifacts should replace the same paths instead of introducing version suffixes.
4
-
5
- ## Scope
6
-
7
- The project has two formal comparison groups.
8
-
9
- ### A. Learned World Models
10
-
11
- Purpose: compare image-input world-model architectures under the same simulator data, optimizer budget, rollout target, parameter scale, and planning interface.
12
-
13
- | Directory | Report Name | Architecture | Comparison Purpose |
14
- |---|---|---|---|
15
- | `flowmo` | FlowMo | Shared image encoder; short object-motion state encoder; long strided ambient-drift context encoder; base transition plus zero-context residual | Proposed flow-momentum factorization. Tests whether separating endogenous motion from exogenous drift improves prediction and planning. |
16
- | `leworldmodel` | LeWorldModel | JEPA-style image-latent predictor with action-conditioned residual transition | Tests whether simple current-image latent prediction is sufficient. |
17
- | `planet` | RSSM | Recurrent state-space latent model with deterministic memory and stochastic latent state | Tests whether generic recurrent memory can absorb momentum and drift without a separate context factor. |
18
- | `tdmpc2` | TD-MPC2 Dynamics | Compact action-conditioned latent dynamics with shared image encoder and rollout heads | Tests task-oriented latent dynamics under equal supervision. |
19
-
20
- All learned methods receive clean top-down RGB boat images and action history. They do not receive flow labels, flow arrows, velocity vectors, trajectory overlays, or goal markers in the image.
21
-
22
- ### B. Traditional Non-WM Controllers
23
-
24
- Purpose: compare downstream behavior against non-neural controllers that do not train a world model.
25
-
26
- | Directory | Report Name | Input | Comparison Purpose |
27
- |---|---|---|---|
28
- | `pid_los_controller` | PID/LOS | Clean image pose estimate | Simple hand-designed waypoint tracking baseline. |
29
- | `no_flow_los_controller` | No-Flow LOS Controller | Clean image pose estimate | Measures the cost of ignoring ambient current. |
30
- | `current_estimator_los_controller` | Current-Estimator LOS Controller | Clean image pose estimate and recent drift | Strong classical current-compensation baseline. |
31
- | `oracle_flow_los_controller` | Oracle-Flow LOS Controller | Clean image pose estimate and simulator local flow | True-local-flow feed-forward reference for a simple geometric controller, not a full dynamics-MPC upper bound. |
32
-
33
- ## Data
34
-
35
- All methods use the same splits:
36
-
37
- ```text
38
- train: data/paper/train.npz
39
- test: data/paper/test.npz
40
- dataset_card: data/paper/dataset_card.md
41
- generation_config: data/paper/generation_config.json
42
- ```
43
-
44
- The train split, test split, and final planning evaluation use the same paper
45
- flow-family set: `noflow`, `uniform`, `vortex_center`, `double_gyre`,
46
- `source_sink`, `source_sink_pair`, `gradient`, `shear`, `turbulent_patch`, and
47
- `random_fourier`.
48
-
49
- All paper flow fields are static. Localized structures are sampled near common
50
- task routes and waypoint corridors so that non-uniform flow is encountered by
51
- the boat during both training trajectories and final planning tasks.
52
-
53
- Observation protocol:
54
-
55
- ```text
56
- image_size: 160 x 160
57
- visual_scale: 2.5
58
- rendering: online clean top-down RGB images
59
- forbidden cues: flow arrows, velocity vectors, trajectory overlays, goal markers
60
- ```
61
-
62
- Training budget:
63
-
64
- ```text
65
- train_episodes: 2400
66
- test_episodes: 480
67
- train_windows: 393216
68
- test_windows: 24576
69
- batch_size: 256
70
- steps: 20000
71
- checkpoint_interval: 2000
72
- num_workers: 4
73
- render_mode: device
74
- training_parallel_jobs: 2
75
- planning_parallel_jobs: 3
76
- ```
77
-
78
- Precision policy:
79
-
80
- ```text
81
- training: bf16 model autocast, fp32 losses and metrics
82
- prediction_eval: bf16 model autocast, fp32 metrics
83
- planning_eval: fp32
84
- ```
85
-
86
- The precision split is intentional: BF16 speeds up image encoding and latent rollout on the RTX 5090 without measurable short-run loss drift, while CEM planning is dominated by small control tensors and did not improve under BF16.
87
-
88
- ## Prediction Evaluation
89
-
90
- Dataset:
91
-
92
- ```text
93
- test
94
- ```
95
-
96
- Metrics:
97
-
98
- ```text
99
- pos@1, pos@5, pos@10, pos@20, pos@40, pos@60
100
- heading@20, heading@60
101
- zero-action drift prediction error
102
- no-flow momentum decay prediction error
103
- same-action different-flow prediction error
104
- ```
105
-
106
- FlowMo-only context diagnostics:
107
-
108
- | Diagnostic | Operation | Evidence Sought |
109
- |---|---|---|
110
- | Inferred context | Normal rollout with inferred `c_t` | Best prediction under flow. |
111
- | Zero context | Set `c_t=0` | Degraded flow prediction and limited change in no-flow. |
112
- | Shuffled context | Use context from another episode | Worse rollout when hidden flow differs. |
113
- | Same-flow transfer | Use context from another episode with the same hidden flow | Better transfer than wrong-flow context. |
114
- | Context norm | Compare no-flow and flow `||c_t||` | Flow context should be larger than no-flow context. |
115
-
116
- FlowMo latent probes:
117
-
118
- ```text
119
- Train frozen linear probes from z_t, c_t, and [z_t,c_t].
120
- Targets: object momentum (vx, vy, omega), local flow vector, episode drift vector.
121
- Purpose: verify which latent carries object-motion information and which latent carries ambient-drift information.
122
- ```
123
-
124
- ## Planning Evaluation
125
-
126
- Learned WM planners:
127
-
128
- ```text
129
- flowmo
130
- leworldmodel
131
- planet
132
- tdmpc2
133
- ```
134
-
135
- All learned world models use the same route-aware CEM planner over their latent rollouts.
136
-
137
- Traditional non-WM controllers:
138
-
139
- ```text
140
- pid_los_controller
141
- no_flow_los_controller
142
- current_estimator_los_controller
143
- oracle_flow_los_controller
144
- ```
145
-
146
- Tasks:
147
-
148
- ```text
149
- reach_target
150
- station_keeping
151
- waypoint_square
152
- waypoint_zigzag
153
- ```
154
-
155
- Boats:
156
-
157
- ```text
158
- twin
159
- triangle
160
- ```
161
-
162
- Flow families:
163
-
164
- ```text
165
- noflow
166
- uniform
167
- vortex_center
168
- double_gyre
169
- source_sink
170
- source_sink_pair
171
- gradient
172
- shear
173
- turbulent_patch
174
- random_fourier
175
- ```
176
-
177
- Metrics:
178
-
179
- ```text
180
- success rate
181
- final distance
182
- trajectory length over successful episodes
183
- control effort (`sum_t ||a_t||_2^2`) over successful episodes
184
- time to goal over successful episodes
185
- ```
186
-
187
- ## Required Outputs
188
-
189
- Training outputs:
190
-
191
- ```text
192
- experiments/<method>/checkpoint/paper.pt
193
- experiments/<method>/checkpoint/paper_step_*.pt
194
- experiments/<method>/result/parameter_count.json
195
- experiments/<method>/result/paper_training.json
196
- experiments/<method>/result/paper_training_trace.jsonl
197
- ```
198
-
199
- Evaluation outputs:
200
-
201
- ```text
202
- experiments/reports/paper_prediction.json
203
- experiments/reports/paper_flowmo_latent_probes.json
204
- experiments/reports/paper_planning/*.json
205
- experiments/reports/paper_planning/gifs/*.gif
206
- experiments/reports/paper_report.md
207
- ```
208
-
209
- ## Commands
210
-
211
- Run the complete paper pipeline:
212
-
213
- ```bash
214
- python -m experiments.run_paper_image_pipeline
215
- ```
216
-
217
- Run stages separately:
218
-
219
- ```bash
220
- python -m experiments.run_paper_image_pipeline --stages train
221
- python -m experiments.run_paper_image_pipeline --stages prediction
222
- python -m experiments.run_paper_image_pipeline --stages probe
223
- python -m experiments.run_paper_image_pipeline --stages planning
224
- python -m experiments.run_paper_image_pipeline --stages report
225
- ```
226
-
227
- Run tests:
228
-
229
- ```bash
230
- python -m pytest -q
231
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
experiments/evaluate_flowmo_latent_probes.py CHANGED
@@ -10,6 +10,8 @@ from pathlib import Path
10
 
11
  import numpy as np
12
  import torch
 
 
13
  from torch.utils.data import DataLoader, Dataset
14
 
15
  from experiments.shared.src.vision.clean_renderer import render_clean_boat_history_tensor
@@ -23,6 +25,14 @@ class ProbeSet:
23
  momentum: np.ndarray
24
  local_flow: np.ndarray
25
  episode_drift: np.ndarray
 
 
 
 
 
 
 
 
26
 
27
 
28
  class FlowMoProbeDataset(Dataset):
@@ -39,6 +49,15 @@ class FlowMoProbeDataset(Dataset):
39
  self.actions = src["actions"][:episodes].astype(np.float32)
40
  self.true_flow = src["true_flow"][:episodes].astype(np.float32)
41
  self.boat_ids = src["boat_ids"][:episodes].astype(np.int64)
 
 
 
 
 
 
 
 
 
42
  self.history_len = int(history_len)
43
  steps = self.actions.shape[1]
44
  all_indices = [(ep, t) for ep in range(episodes) for t in range(self.history_len - 1, steps)]
@@ -63,12 +82,18 @@ class FlowMoProbeDataset(Dataset):
63
  torch.from_numpy(self.states[ep, t, 3:6].copy()),
64
  torch.from_numpy(self.true_flow[ep, t].copy()),
65
  torch.from_numpy(self.episode_drift[ep].copy()),
 
 
 
 
 
 
66
  )
67
 
68
 
69
- def build_flowmo():
70
- config_module = importlib.import_module("experiments.flowmo.src.config")
71
- model_module = importlib.import_module("experiments.flowmo.src.model")
72
  cfg = config_module.default_config()
73
  return cfg, model_module.build_model(cfg)
74
 
@@ -93,8 +118,23 @@ def collect_probe_set(model, source: str, episodes: int, max_windows: int, args,
93
  device = torch.device(args.device)
94
  history_indices = selected_history_indices(model, args.history_len)
95
  zs, cs, momentum, local_flow, episode_drift = [], [], [], [], []
 
 
96
  model.eval()
97
- for states, actions, boat_ids, batch_momentum, batch_flow, batch_drift in loader:
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  states = states[:, history_indices].to(device, non_blocking=True)
99
  actions = actions[:, history_indices].to(device, non_blocking=True)
100
  boat_ids = boat_ids.to(device, non_blocking=True)
@@ -111,12 +151,27 @@ def collect_probe_set(model, source: str, episodes: int, max_windows: int, args,
111
  momentum.append(batch_momentum.numpy())
112
  local_flow.append(batch_flow.numpy())
113
  episode_drift.append(batch_drift.numpy())
 
 
 
 
 
 
 
114
  return ProbeSet(
115
  z=np.concatenate(zs, axis=0),
116
  c=np.concatenate(cs, axis=0),
117
  momentum=np.concatenate(momentum, axis=0),
118
  local_flow=np.concatenate(local_flow, axis=0),
119
  episode_drift=np.concatenate(episode_drift, axis=0),
 
 
 
 
 
 
 
 
120
  )
121
 
122
 
@@ -151,6 +206,18 @@ def regression_metrics(prediction: np.ndarray, target: np.ndarray, dims: list[st
151
  }
152
 
153
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  def feature_matrix(probe_set: ProbeSet, feature_name: str) -> np.ndarray:
155
  if feature_name == "z":
156
  return probe_set.z
@@ -168,12 +235,29 @@ def target_matrix(probe_set: ProbeSet, target_name: str) -> tuple[np.ndarray, li
168
  return probe_set.local_flow, ["flow_x", "flow_y"]
169
  if target_name == "episode_drift":
170
  return probe_set.episode_drift, ["drift_x", "drift_y"]
 
 
171
  raise ValueError(f"unknown target: {target_name}")
172
 
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  def train_probe_bank(train_set: ProbeSet, alpha: float) -> dict:
175
  bank = {}
176
- for target_name in ["momentum", "local_flow", "episode_drift"]:
177
  targets, _dims = target_matrix(train_set, target_name)
178
  bank[target_name] = {}
179
  for feature_name in ["z", "c", "z_c"]:
@@ -183,7 +267,7 @@ def train_probe_bank(train_set: ProbeSet, alpha: float) -> dict:
183
 
184
  def evaluate_probe_bank(bank: dict, probe_set: ProbeSet) -> dict:
185
  payload = {}
186
- for target_name in ["momentum", "local_flow", "episode_drift"]:
187
  targets, dims = target_matrix(probe_set, target_name)
188
  payload[target_name] = {}
189
  for feature_name in ["z", "c", "z_c"]:
@@ -192,14 +276,222 @@ def evaluate_probe_bank(bank: dict, probe_set: ProbeSet) -> dict:
192
  return payload
193
 
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  def parse_eval_split(text: str) -> tuple[str, str, int]:
196
  name, source, episodes = text.split(":", maxsplit=2)
197
  return name, source, int(episodes)
198
 
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  def main() -> None:
201
  parser = argparse.ArgumentParser()
202
  parser.add_argument("--train-source", default="data/paper/train.npz")
 
203
  parser.add_argument("--train-episodes", type=int, default=2400)
204
  parser.add_argument("--train-windows", type=int, default=32768)
205
  parser.add_argument("--eval-splits", nargs="+", default=[
@@ -209,6 +501,12 @@ def main() -> None:
209
  parser.add_argument("--history-len", type=int, default=32)
210
  parser.add_argument("--batch-size", type=int, default=256)
211
  parser.add_argument("--ridge-alpha", type=float, default=1.0e-3)
 
 
 
 
 
 
212
  parser.add_argument("--checkpoint-name", default="paper.pt")
213
  parser.add_argument("--image-size", type=int, default=160)
214
  parser.add_argument("--visual-scale", type=float, default=2.5)
@@ -218,11 +516,12 @@ def main() -> None:
218
  parser.add_argument("--precision", choices=["fp32", "bf16", "fp16"], default="bf16")
219
  parser.add_argument("--out", default="experiments/reports/paper_flowmo_latent_probes.json")
220
  args = parser.parse_args()
 
221
 
222
  device = torch.device(args.device)
223
  configure_training_runtime(device)
224
- _cfg, model = build_flowmo()
225
- state = torch.load(Path("experiments/flowmo/checkpoint") / args.checkpoint_name, map_location="cpu")
226
  model.load_state_dict(state)
227
  model.to(device)
228
  if device.type == "cuda":
@@ -230,18 +529,39 @@ def main() -> None:
230
 
231
  train_set = collect_probe_set(model, args.train_source, args.train_episodes, args.train_windows, args, args.seed)
232
  bank = train_probe_bank(train_set, args.ridge_alpha)
 
 
 
233
  split_results = {}
 
 
 
 
234
  for index, split in enumerate(args.eval_splits):
235
  name, source, episodes = parse_eval_split(split)
236
  eval_set = collect_probe_set(model, source, episodes, args.eval_windows, args, args.seed + 100 + index)
 
237
  split_results[name] = evaluate_probe_bank(bank, eval_set)
 
 
 
 
 
238
  payload = {
239
- "method": "flowmo",
240
  "checkpoint": args.checkpoint_name,
241
  "train_source": args.train_source,
242
  "train_windows": args.train_windows,
243
  "eval_windows": args.eval_windows,
244
  "ridge_alpha": args.ridge_alpha,
 
 
 
 
 
 
 
 
245
  "feature_sets": {
246
  "z": "short-history object-motion latent",
247
  "c": "long-history ambient-drift context",
@@ -251,8 +571,14 @@ def main() -> None:
251
  "momentum": ["vx", "vy", "omega"],
252
  "local_flow": ["flow_x", "flow_y"],
253
  "episode_drift": ["mean_flow_x", "mean_flow_y"],
 
 
254
  },
255
  "splits": split_results,
 
 
 
 
256
  }
257
  out = Path(args.out)
258
  out.parent.mkdir(parents=True, exist_ok=True)
 
10
 
11
  import numpy as np
12
  import torch
13
+ import torch.nn.functional as F
14
+ from torch import nn
15
  from torch.utils.data import DataLoader, Dataset
16
 
17
  from experiments.shared.src.vision.clean_renderer import render_clean_boat_history_tensor
 
25
  momentum: np.ndarray
26
  local_flow: np.ndarray
27
  episode_drift: np.ndarray
28
+ boat_params: np.ndarray
29
+ boat_id: np.ndarray
30
+ flow_family: np.ndarray
31
+ trajectory: np.ndarray
32
+ episode_id: np.ndarray
33
+ time_index: np.ndarray
34
+ flow_id: np.ndarray
35
+ boat_param_names: tuple[str, ...]
36
 
37
 
38
  class FlowMoProbeDataset(Dataset):
 
49
  self.actions = src["actions"][:episodes].astype(np.float32)
50
  self.true_flow = src["true_flow"][:episodes].astype(np.float32)
51
  self.boat_ids = src["boat_ids"][:episodes].astype(np.int64)
52
+ self.flow_type_ids = src["flow_type_ids"][:episodes].astype(np.int64)
53
+ self.flow_ids = src["flow_ids"][:episodes].astype(np.int64)
54
+ self.traj_type_ids = src["traj_type_ids"][:episodes].astype(np.int64)
55
+ metadata = json.loads(str(src["metadata"]))
56
+ self.boat_param_names = tuple(metadata.get("boat_param_names", []))
57
+ if "boat_params" in src.files:
58
+ self.boat_params = src["boat_params"][:episodes].astype(np.float32)
59
+ else:
60
+ self.boat_params = np.empty((episodes, 0), dtype=np.float32)
61
  self.history_len = int(history_len)
62
  steps = self.actions.shape[1]
63
  all_indices = [(ep, t) for ep in range(episodes) for t in range(self.history_len - 1, steps)]
 
82
  torch.from_numpy(self.states[ep, t, 3:6].copy()),
83
  torch.from_numpy(self.true_flow[ep, t].copy()),
84
  torch.from_numpy(self.episode_drift[ep].copy()),
85
+ torch.from_numpy(self.boat_params[ep].copy()),
86
+ torch.tensor(self.flow_type_ids[ep], dtype=torch.long),
87
+ torch.tensor(self.traj_type_ids[ep], dtype=torch.long),
88
+ torch.tensor(ep, dtype=torch.long),
89
+ torch.tensor(t, dtype=torch.long),
90
+ torch.tensor(self.flow_ids[ep], dtype=torch.long),
91
  )
92
 
93
 
94
+ def build_flowmo(method: str):
95
+ config_module = importlib.import_module(f"experiments.{method}.src.config")
96
+ model_module = importlib.import_module(f"experiments.{method}.src.model")
97
  cfg = config_module.default_config()
98
  return cfg, model_module.build_model(cfg)
99
 
 
118
  device = torch.device(args.device)
119
  history_indices = selected_history_indices(model, args.history_len)
120
  zs, cs, momentum, local_flow, episode_drift = [], [], [], [], []
121
+ boat_params, boat_id, flow_family, trajectory = [], [], [], []
122
+ episode_id, time_index, flow_id = [], [], []
123
  model.eval()
124
+ for (
125
+ states,
126
+ actions,
127
+ boat_ids,
128
+ batch_momentum,
129
+ batch_flow,
130
+ batch_drift,
131
+ batch_boat_params,
132
+ batch_flow_family,
133
+ batch_trajectory,
134
+ batch_episode_id,
135
+ batch_time_index,
136
+ batch_flow_id,
137
+ ) in loader:
138
  states = states[:, history_indices].to(device, non_blocking=True)
139
  actions = actions[:, history_indices].to(device, non_blocking=True)
140
  boat_ids = boat_ids.to(device, non_blocking=True)
 
151
  momentum.append(batch_momentum.numpy())
152
  local_flow.append(batch_flow.numpy())
153
  episode_drift.append(batch_drift.numpy())
154
+ boat_params.append(batch_boat_params.numpy())
155
+ boat_id.append(boat_ids.cpu().numpy())
156
+ flow_family.append(batch_flow_family.numpy())
157
+ trajectory.append(batch_trajectory.numpy())
158
+ episode_id.append(batch_episode_id.numpy())
159
+ time_index.append(batch_time_index.numpy())
160
+ flow_id.append(batch_flow_id.numpy())
161
  return ProbeSet(
162
  z=np.concatenate(zs, axis=0),
163
  c=np.concatenate(cs, axis=0),
164
  momentum=np.concatenate(momentum, axis=0),
165
  local_flow=np.concatenate(local_flow, axis=0),
166
  episode_drift=np.concatenate(episode_drift, axis=0),
167
+ boat_params=np.concatenate(boat_params, axis=0),
168
+ boat_id=np.concatenate(boat_id, axis=0),
169
+ flow_family=np.concatenate(flow_family, axis=0),
170
+ trajectory=np.concatenate(trajectory, axis=0),
171
+ episode_id=np.concatenate(episode_id, axis=0),
172
+ time_index=np.concatenate(time_index, axis=0),
173
+ flow_id=np.concatenate(flow_id, axis=0),
174
+ boat_param_names=dataset.boat_param_names,
175
  )
176
 
177
 
 
206
  }
207
 
208
 
209
+ def classification_metrics(scores: np.ndarray, target: np.ndarray) -> dict[str, float]:
210
+ prediction = np.argmax(scores, axis=1)
211
+ classes = np.unique(target)
212
+ per_class = [np.mean(prediction[target == label] == label) for label in classes]
213
+ return {
214
+ "accuracy": float(np.mean(prediction == target)),
215
+ "balanced_accuracy": float(np.mean(per_class)),
216
+ "num_classes": int(len(classes)),
217
+ "chance_accuracy": float(1.0 / max(len(classes), 1)),
218
+ }
219
+
220
+
221
  def feature_matrix(probe_set: ProbeSet, feature_name: str) -> np.ndarray:
222
  if feature_name == "z":
223
  return probe_set.z
 
235
  return probe_set.local_flow, ["flow_x", "flow_y"]
236
  if target_name == "episode_drift":
237
  return probe_set.episode_drift, ["drift_x", "drift_y"]
238
+ if target_name == "boat_params" and probe_set.boat_params.shape[1]:
239
+ return probe_set.boat_params, list(probe_set.boat_param_names)
240
  raise ValueError(f"unknown target: {target_name}")
241
 
242
 
243
+ def regression_target_names(probe_set: ProbeSet) -> list[str]:
244
+ names = ["momentum", "local_flow", "episode_drift"]
245
+ if probe_set.boat_params.shape[1]:
246
+ names.append("boat_params")
247
+ return names
248
+
249
+
250
+ def classification_targets(probe_set: ProbeSet) -> dict[str, np.ndarray]:
251
+ return {
252
+ "boat_id": probe_set.boat_id,
253
+ "flow_family": probe_set.flow_family,
254
+ "trajectory": probe_set.trajectory,
255
+ }
256
+
257
+
258
  def train_probe_bank(train_set: ProbeSet, alpha: float) -> dict:
259
  bank = {}
260
+ for target_name in regression_target_names(train_set):
261
  targets, _dims = target_matrix(train_set, target_name)
262
  bank[target_name] = {}
263
  for feature_name in ["z", "c", "z_c"]:
 
267
 
268
  def evaluate_probe_bank(bank: dict, probe_set: ProbeSet) -> dict:
269
  payload = {}
270
+ for target_name in bank:
271
  targets, dims = target_matrix(probe_set, target_name)
272
  payload[target_name] = {}
273
  for feature_name in ["z", "c", "z_c"]:
 
276
  return payload
277
 
278
 
279
+ def train_classifier_bank(train_set: ProbeSet, alpha: float) -> dict:
280
+ bank = {}
281
+ for target_name, labels in classification_targets(train_set).items():
282
+ num_classes = int(labels.max()) + 1
283
+ one_hot = np.eye(num_classes, dtype=np.float32)[labels]
284
+ bank[target_name] = {
285
+ feature_name: fit_ridge(feature_matrix(train_set, feature_name), one_hot, alpha)
286
+ for feature_name in ["z", "c", "z_c"]
287
+ }
288
+ return bank
289
+
290
+
291
+ def evaluate_classifier_bank(bank: dict, probe_set: ProbeSet) -> dict:
292
+ payload = {}
293
+ targets = classification_targets(probe_set)
294
+ for target_name, feature_models in bank.items():
295
+ payload[target_name] = {}
296
+ for feature_name, model in feature_models.items():
297
+ scores = predict_ridge(model, feature_matrix(probe_set, feature_name))
298
+ payload[target_name][feature_name] = classification_metrics(scores, targets[target_name])
299
+ return payload
300
+
301
+
302
+ class ProbeMLP(nn.Module):
303
+ def __init__(self, input_dim: int, output_dim: int, hidden_dim: int):
304
+ super().__init__()
305
+ self.net = nn.Sequential(
306
+ nn.Linear(input_dim, hidden_dim),
307
+ nn.SiLU(),
308
+ nn.Linear(hidden_dim, hidden_dim),
309
+ nn.SiLU(),
310
+ nn.Linear(hidden_dim, output_dim),
311
+ )
312
+
313
+ def forward(self, features: torch.Tensor) -> torch.Tensor:
314
+ return self.net(features)
315
+
316
+
317
+ def fit_mlp(
318
+ features: np.ndarray,
319
+ targets: np.ndarray,
320
+ *,
321
+ task: str,
322
+ epochs: int,
323
+ batch_size: int,
324
+ hidden_dim: int,
325
+ learning_rate: float,
326
+ device: torch.device,
327
+ seed: int,
328
+ ) -> dict:
329
+ torch.manual_seed(seed)
330
+ x_mean = features.mean(axis=0, keepdims=True).astype(np.float32)
331
+ x_std = (features.std(axis=0, keepdims=True) + 1.0e-6).astype(np.float32)
332
+ x = torch.from_numpy(((features - x_mean) / x_std).astype(np.float32)).to(device)
333
+ if task == "regression":
334
+ y_mean = targets.mean(axis=0, keepdims=True).astype(np.float32)
335
+ y_std = (targets.std(axis=0, keepdims=True) + 1.0e-6).astype(np.float32)
336
+ y = torch.from_numpy(((targets - y_mean) / y_std).astype(np.float32)).to(device)
337
+ output_dim = int(targets.shape[1])
338
+ else:
339
+ y_mean = np.empty((1, 0), dtype=np.float32)
340
+ y_std = np.empty((1, 0), dtype=np.float32)
341
+ y = torch.from_numpy(targets.astype(np.int64)).to(device)
342
+ output_dim = int(targets.max()) + 1
343
+ model = ProbeMLP(x.shape[1], output_dim, hidden_dim).to(device)
344
+ optimizer = torch.optim.AdamW(model.parameters(), lr=learning_rate, weight_decay=1.0e-4)
345
+ generator = torch.Generator(device=device).manual_seed(seed)
346
+ for _ in range(epochs):
347
+ permutation = torch.randperm(len(x), generator=generator, device=device)
348
+ for start in range(0, len(x), batch_size):
349
+ index = permutation[start : start + batch_size]
350
+ prediction = model(x[index])
351
+ loss = F.mse_loss(prediction, y[index]) if task == "regression" else F.cross_entropy(prediction, y[index])
352
+ optimizer.zero_grad(set_to_none=True)
353
+ loss.backward()
354
+ optimizer.step()
355
+ return {
356
+ "model": model.cpu().eval(),
357
+ "x_mean": x_mean,
358
+ "x_std": x_std,
359
+ "y_mean": y_mean,
360
+ "y_std": y_std,
361
+ "task": task,
362
+ }
363
+
364
+
365
+ @torch.no_grad()
366
+ def predict_mlp(model: dict, features: np.ndarray) -> np.ndarray:
367
+ x = ((features - model["x_mean"]) / model["x_std"]).astype(np.float32)
368
+ prediction = model["model"](torch.from_numpy(x)).numpy()
369
+ if model["task"] == "regression":
370
+ prediction = prediction * model["y_std"] + model["y_mean"]
371
+ return prediction
372
+
373
+
374
+ def train_mlp_banks(train_set: ProbeSet, args, seed: int) -> tuple[dict, dict]:
375
+ regression_bank = {}
376
+ classification_bank = {}
377
+ device = torch.device(args.probe_device)
378
+ fit_index = 0
379
+ for target_name in regression_target_names(train_set):
380
+ targets, _ = target_matrix(train_set, target_name)
381
+ regression_bank[target_name] = {}
382
+ for feature_name in ["z", "c", "z_c"]:
383
+ regression_bank[target_name][feature_name] = fit_mlp(
384
+ feature_matrix(train_set, feature_name),
385
+ targets,
386
+ task="regression",
387
+ epochs=args.mlp_epochs,
388
+ batch_size=args.mlp_batch_size,
389
+ hidden_dim=args.mlp_hidden_dim,
390
+ learning_rate=args.mlp_learning_rate,
391
+ device=device,
392
+ seed=seed + fit_index,
393
+ )
394
+ fit_index += 1
395
+ for target_name, targets in classification_targets(train_set).items():
396
+ classification_bank[target_name] = {}
397
+ for feature_name in ["z", "c", "z_c"]:
398
+ classification_bank[target_name][feature_name] = fit_mlp(
399
+ feature_matrix(train_set, feature_name),
400
+ targets,
401
+ task="classification",
402
+ epochs=args.mlp_epochs,
403
+ batch_size=args.mlp_batch_size,
404
+ hidden_dim=args.mlp_hidden_dim,
405
+ learning_rate=args.mlp_learning_rate,
406
+ device=device,
407
+ seed=seed + fit_index,
408
+ )
409
+ fit_index += 1
410
+ return regression_bank, classification_bank
411
+
412
+
413
+ def evaluate_mlp_banks(regression_bank: dict, classification_bank: dict, probe_set: ProbeSet) -> dict:
414
+ regression = {}
415
+ for target_name, feature_models in regression_bank.items():
416
+ targets, dims = target_matrix(probe_set, target_name)
417
+ regression[target_name] = {
418
+ feature_name: regression_metrics(predict_mlp(model, feature_matrix(probe_set, feature_name)), targets, dims)
419
+ for feature_name, model in feature_models.items()
420
+ }
421
+ categorical = classification_targets(probe_set)
422
+ classification = {}
423
+ for target_name, feature_models in classification_bank.items():
424
+ classification[target_name] = {
425
+ feature_name: classification_metrics(
426
+ predict_mlp(model, feature_matrix(probe_set, feature_name)),
427
+ categorical[target_name],
428
+ )
429
+ for feature_name, model in feature_models.items()
430
+ }
431
+ return {"regression": regression, "classification": classification}
432
+
433
+
434
  def parse_eval_split(text: str) -> tuple[str, str, int]:
435
  name, source, episodes = text.split(":", maxsplit=2)
436
  return name, source, int(episodes)
437
 
438
 
439
+ def context_consistency(probe_set: ProbeSet) -> dict:
440
+ episodes = np.unique(probe_set.episode_id)
441
+ centroids = []
442
+ families = []
443
+ flow_ids = []
444
+ within = []
445
+ for episode in episodes:
446
+ mask = probe_set.episode_id == episode
447
+ center = probe_set.c[mask].mean(axis=0)
448
+ centroids.append(center)
449
+ within.extend(np.linalg.norm(probe_set.c[mask] - center, axis=1).tolist())
450
+ families.append(int(probe_set.flow_family[mask][0]))
451
+ flow_ids.append(int(probe_set.flow_id[mask][0]))
452
+ centroids_array = np.asarray(centroids, dtype=np.float64)
453
+ families_array = np.asarray(families, dtype=np.int64)
454
+ flow_ids_array = np.asarray(flow_ids, dtype=np.int64)
455
+ groups = {"same_condition": [], "same_family_different_condition": [], "different_family": []}
456
+ for left in range(len(episodes)):
457
+ distance = np.linalg.norm(centroids_array[left + 1 :] - centroids_array[left], axis=1)
458
+ for offset, value in enumerate(distance, start=left + 1):
459
+ if families_array[left] == families_array[offset] and flow_ids_array[left] == flow_ids_array[offset]:
460
+ key = "same_condition"
461
+ elif families_array[left] == families_array[offset]:
462
+ key = "same_family_different_condition"
463
+ else:
464
+ key = "different_family"
465
+ groups[key].append(float(value))
466
+
467
+ def describe(values: list[float]) -> dict:
468
+ array = np.asarray(values, dtype=np.float64)
469
+ return {
470
+ "n": int(len(array)),
471
+ "mean": float(array.mean()) if len(array) else float("nan"),
472
+ "median": float(np.median(array)) if len(array) else float("nan"),
473
+ "std": float(array.std(ddof=1)) if len(array) > 1 else 0.0,
474
+ }
475
+
476
+ return {
477
+ "within_episode_distance": describe(within),
478
+ "episode_centroid_distance": {key: describe(values) for key, values in groups.items()},
479
+ }
480
+
481
+
482
+ def average_nested(values: list[object]) -> object:
483
+ first = values[0]
484
+ if isinstance(first, dict):
485
+ return {key: average_nested([value[key] for value in values]) for key in first}
486
+ if isinstance(first, (int, float)) and not isinstance(first, bool):
487
+ return float(np.mean(np.asarray(values, dtype=np.float64)))
488
+ return first
489
+
490
+
491
  def main() -> None:
492
  parser = argparse.ArgumentParser()
493
  parser.add_argument("--train-source", default="data/paper/train.npz")
494
+ parser.add_argument("--method", default="flowmo")
495
  parser.add_argument("--train-episodes", type=int, default=2400)
496
  parser.add_argument("--train-windows", type=int, default=32768)
497
  parser.add_argument("--eval-splits", nargs="+", default=[
 
501
  parser.add_argument("--history-len", type=int, default=32)
502
  parser.add_argument("--batch-size", type=int, default=256)
503
  parser.add_argument("--ridge-alpha", type=float, default=1.0e-3)
504
+ parser.add_argument("--mlp-epochs", type=int, default=0)
505
+ parser.add_argument("--mlp-batch-size", type=int, default=1024)
506
+ parser.add_argument("--mlp-hidden-dim", type=int, default=128)
507
+ parser.add_argument("--mlp-learning-rate", type=float, default=1.0e-3)
508
+ parser.add_argument("--mlp-seeds", nargs="+", type=int, default=None)
509
+ parser.add_argument("--probe-device", default=None)
510
  parser.add_argument("--checkpoint-name", default="paper.pt")
511
  parser.add_argument("--image-size", type=int, default=160)
512
  parser.add_argument("--visual-scale", type=float, default=2.5)
 
516
  parser.add_argument("--precision", choices=["fp32", "bf16", "fp16"], default="bf16")
517
  parser.add_argument("--out", default="experiments/reports/paper_flowmo_latent_probes.json")
518
  args = parser.parse_args()
519
+ args.probe_device = args.probe_device or args.device
520
 
521
  device = torch.device(args.device)
522
  configure_training_runtime(device)
523
+ _cfg, model = build_flowmo(args.method)
524
+ state = torch.load(Path("experiments") / args.method / "checkpoint" / args.checkpoint_name, map_location="cpu")
525
  model.load_state_dict(state)
526
  model.to(device)
527
  if device.type == "cuda":
 
529
 
530
  train_set = collect_probe_set(model, args.train_source, args.train_episodes, args.train_windows, args, args.seed)
531
  bank = train_probe_bank(train_set, args.ridge_alpha)
532
+ classifier_bank = train_classifier_bank(train_set, args.ridge_alpha)
533
+ mlp_seeds = args.mlp_seeds or [args.seed]
534
+ mlp_banks = [train_mlp_banks(train_set, args, seed) for seed in mlp_seeds] if args.mlp_epochs > 0 else []
535
  split_results = {}
536
+ classification_results = {}
537
+ nonlinear_results = {}
538
+ nonlinear_repeats = {}
539
+ consistency_results = {}
540
  for index, split in enumerate(args.eval_splits):
541
  name, source, episodes = parse_eval_split(split)
542
  eval_set = collect_probe_set(model, source, episodes, args.eval_windows, args, args.seed + 100 + index)
543
+ consistency_results[name] = context_consistency(eval_set)
544
  split_results[name] = evaluate_probe_bank(bank, eval_set)
545
+ classification_results[name] = evaluate_classifier_bank(classifier_bank, eval_set)
546
+ if mlp_banks:
547
+ repeats = [evaluate_mlp_banks(*banks, eval_set) for banks in mlp_banks]
548
+ nonlinear_repeats[name] = {str(seed): result for seed, result in zip(mlp_seeds, repeats)}
549
+ nonlinear_results[name] = average_nested(repeats)
550
  payload = {
551
+ "method": args.method,
552
  "checkpoint": args.checkpoint_name,
553
  "train_source": args.train_source,
554
  "train_windows": args.train_windows,
555
  "eval_windows": args.eval_windows,
556
  "ridge_alpha": args.ridge_alpha,
557
+ "mlp": {
558
+ "enabled": args.mlp_epochs > 0,
559
+ "epochs": args.mlp_epochs,
560
+ "batch_size": args.mlp_batch_size,
561
+ "hidden_dim": args.mlp_hidden_dim,
562
+ "learning_rate": args.mlp_learning_rate,
563
+ "seeds": mlp_seeds,
564
+ },
565
  "feature_sets": {
566
  "z": "short-history object-motion latent",
567
  "c": "long-history ambient-drift context",
 
571
  "momentum": ["vx", "vy", "omega"],
572
  "local_flow": ["flow_x", "flow_y"],
573
  "episode_drift": ["mean_flow_x", "mean_flow_y"],
574
+ "boat_params": list(train_set.boat_param_names),
575
+ "classification": ["boat_id", "flow_family", "trajectory"],
576
  },
577
  "splits": split_results,
578
+ "classification_splits": classification_results,
579
+ "nonlinear_splits": nonlinear_results,
580
+ "nonlinear_repeats": nonlinear_repeats,
581
+ "context_consistency_splits": consistency_results,
582
  }
583
  out = Path(args.out)
584
  out.parent.mkdir(parents=True, exist_ok=True)
experiments/evaluate_image_planning.py CHANGED
@@ -13,14 +13,15 @@ import torch
13
  import torch.nn.functional as F
14
 
15
  from driftwm.sim.env import SurfaceBoatEnv
16
- from driftwm.sim.flow import sample_flow
17
  from driftwm.sim.render import render_frame, save_gif
18
- from experiments.shared.src.methods import PAPER_LEARNED_METHODS, TRADITIONAL_METHODS
 
19
  from experiments.shared.src.vision.clean_renderer import render_clean_boat_array
20
  from experiments.train_image_world_models import autocast_context
21
 
22
 
23
- LEARNED_METHODS = PAPER_LEARNED_METHODS
24
 
25
  POSITION_SCALE = 5.0
26
 
@@ -49,6 +50,10 @@ def pad_action(action: np.ndarray, action_dim: int) -> np.ndarray:
49
  return out
50
 
51
 
 
 
 
 
52
  def task_goals(task: str, rng: np.random.Generator) -> np.ndarray:
53
  if task == "waypoint_square":
54
  return np.array([[2.5, 2.5], [7.5, 2.5], [7.5, 7.5], [2.5, 7.5]], dtype=np.float32)
@@ -383,10 +388,13 @@ def evaluate_one_method(method: str, args) -> dict:
383
  results = []
384
  gif_dir = Path(args.out) / "gifs"
385
  gif_dir.mkdir(parents=True, exist_ok=True)
386
- context_modes = args.context_modes if method == "flowmo" else ["inferred"]
387
  for context_mode in context_modes:
388
  for ep in range(args.episodes):
389
  episode_seed = int(args.seed + ep)
 
 
 
390
  rng = np.random.default_rng(episode_seed)
391
  env = SurfaceBoatEnv(
392
  boat=args.boat,
@@ -396,6 +404,15 @@ def evaluate_one_method(method: str, args) -> dict:
396
  seed=episode_seed,
397
  )
398
  reset_task(env, args.task, args.flow_type, rng)
 
 
 
 
 
 
 
 
 
399
  goals = task_goals(args.task, rng)
400
  goal_idx = 0
401
  image_history = deque(maxlen=args.history_len)
@@ -410,6 +427,7 @@ def evaluate_one_method(method: str, args) -> dict:
410
  frames = []
411
  prev_action = np.zeros((env.action_dim,), dtype=np.float32)
412
  energy = 0.0
 
413
  reached_times: list[int] = []
414
  min_goal_dists = np.full((len(goals),), np.inf, dtype=np.float32)
415
  planned = None
@@ -435,6 +453,7 @@ def evaluate_one_method(method: str, args) -> dict:
435
  planned = None
436
  prev_action = action.copy()
437
  _obs, _reward, done, _info = env.step(action)
 
438
  energy += float(np.sum(action * action))
439
  trajectory.append(env.full_state()[:6].copy())
440
  image_history.append(clean_observation(env, args.image_size, args.visual_scale))
@@ -468,6 +487,8 @@ def evaluate_one_method(method: str, args) -> dict:
468
  break
469
  path = np.asarray(trajectory)[:, :2]
470
  final_goal = goals[min(goal_idx, len(goals) - 1)]
 
 
471
  record = {
472
  "method": method,
473
  "context_mode": context_mode,
@@ -479,6 +500,10 @@ def evaluate_one_method(method: str, args) -> dict:
479
  "energy": energy,
480
  "steps": len(trajectory) - 1,
481
  "reached_times": reached_times,
 
 
 
 
482
  }
483
  results.append(record)
484
  if ep < args.make_gifs and frames:
@@ -508,9 +533,23 @@ def summarize(method: str, args, results: list[dict]) -> dict:
508
  }
509
  return {
510
  "method": method,
 
 
 
 
511
  "task": args.task,
512
  "boat": args.boat,
513
  "flow_type": args.flow_type,
 
 
 
 
 
 
 
 
 
 
514
  "by_context": by_context,
515
  "results": results,
516
  }
@@ -522,6 +561,10 @@ def main() -> None:
522
  parser.add_argument("--task", choices=["reach_target", "station_keeping", "waypoint_square", "waypoint_zigzag"], default="reach_target")
523
  parser.add_argument("--boat", choices=["twin", "triangle"], default="twin")
524
  parser.add_argument("--flow-type", choices=["noflow", "uniform", "vortex_center", "double_gyre", "source_sink", "source_sink_pair", "gradient", "shear", "turbulent_patch", "random_fourier"], default="uniform")
 
 
 
 
525
  parser.add_argument("--episodes", type=int, default=50)
526
  parser.add_argument("--max-steps", type=int, default=420)
527
  parser.add_argument("--history-len", type=int, default=32)
 
13
  import torch.nn.functional as F
14
 
15
  from driftwm.sim.env import SurfaceBoatEnv
16
+ from driftwm.sim.flow import sample_flow, transform_flow
17
  from driftwm.sim.render import render_frame, save_gif
18
+ from experiments.shared.src.methods import PAPER_LEARNED_METHODS, REVIEWER_LEARNED_METHODS, TRADITIONAL_METHODS
19
+ from experiments.shared.src.analysis.control_authority import numerical_max_still_water_speed
20
  from experiments.shared.src.vision.clean_renderer import render_clean_boat_array
21
  from experiments.train_image_world_models import autocast_context
22
 
23
 
24
+ LEARNED_METHODS = PAPER_LEARNED_METHODS + REVIEWER_LEARNED_METHODS
25
 
26
  POSITION_SCALE = 5.0
27
 
 
50
  return out
51
 
52
 
53
+ def max_still_water_speed(env: SurfaceBoatEnv) -> float:
54
+ return numerical_max_still_water_speed(env.spec.name, env.params, dt=env.config.dt)
55
+
56
+
57
  def task_goals(task: str, rng: np.random.Generator) -> np.ndarray:
58
  if task == "waypoint_square":
59
  return np.array([[2.5, 2.5], [7.5, 2.5], [7.5, 7.5], [2.5, 7.5]], dtype=np.float32)
 
388
  results = []
389
  gif_dir = Path(args.out) / "gifs"
390
  gif_dir.mkdir(parents=True, exist_ok=True)
391
+ context_modes = args.context_modes if method == "flowmo" or method.startswith("flowmo_") else ["inferred"]
392
  for context_mode in context_modes:
393
  for ep in range(args.episodes):
394
  episode_seed = int(args.seed + ep)
395
+ torch.manual_seed(episode_seed)
396
+ if torch.cuda.is_available():
397
+ torch.cuda.manual_seed_all(episode_seed)
398
  rng = np.random.default_rng(episode_seed)
399
  env = SurfaceBoatEnv(
400
  boat=args.boat,
 
404
  seed=episode_seed,
405
  )
406
  reset_task(env, args.task, args.flow_type, rng)
407
+ env.flow = transform_flow(
408
+ env.flow,
409
+ magnitude_scale=args.flow_magnitude_scale,
410
+ temporal_amplitude=args.flow_temporal_amplitude,
411
+ temporal_frequency=args.flow_temporal_frequency,
412
+ temporal_phase=float(np.mod((episode_seed + 1) * 2.399963229728653, 2.0 * np.pi)),
413
+ rotation_amplitude=args.flow_rotation_amplitude,
414
+ )
415
+ env.last_flow_velocity = env.flow_at(env.state[:2])
416
  goals = task_goals(args.task, rng)
417
  goal_idx = 0
418
  image_history = deque(maxlen=args.history_len)
 
427
  frames = []
428
  prev_action = np.zeros((env.action_dim,), dtype=np.float32)
429
  energy = 0.0
430
+ flow_speeds: list[float] = []
431
  reached_times: list[int] = []
432
  min_goal_dists = np.full((len(goals),), np.inf, dtype=np.float32)
433
  planned = None
 
453
  planned = None
454
  prev_action = action.copy()
455
  _obs, _reward, done, _info = env.step(action)
456
+ flow_speeds.append(float(np.linalg.norm(env.last_flow_velocity)))
457
  energy += float(np.sum(action * action))
458
  trajectory.append(env.full_state()[:6].copy())
459
  image_history.append(clean_observation(env, args.image_size, args.visual_scale))
 
487
  break
488
  path = np.asarray(trajectory)[:, :2]
489
  final_goal = goals[min(goal_idx, len(goals) - 1)]
490
+ authority_speed = max_still_water_speed(env)
491
+ q95_flow = float(np.percentile(flow_speeds, 95)) if flow_speeds else 0.0
492
  record = {
493
  "method": method,
494
  "context_mode": context_mode,
 
500
  "energy": energy,
501
  "steps": len(trajectory) - 1,
502
  "reached_times": reached_times,
503
+ "flow_speed_mean": float(np.mean(flow_speeds)) if flow_speeds else 0.0,
504
+ "flow_speed_q95": q95_flow,
505
+ "max_still_water_speed": authority_speed,
506
+ "flow_to_control_ratio": q95_flow / authority_speed if authority_speed > 0.0 else None,
507
  }
508
  results.append(record)
509
  if ep < args.make_gifs and frames:
 
533
  }
534
  return {
535
  "method": method,
536
+ "checkpoint": args.checkpoint_name,
537
+ "seed": int(args.seed),
538
+ "episodes_requested": int(args.episodes),
539
+ "precision": args.precision,
540
  "task": args.task,
541
  "boat": args.boat,
542
  "flow_type": args.flow_type,
543
+ "flow_transform": {
544
+ "magnitude_scale": args.flow_magnitude_scale,
545
+ "temporal_amplitude": args.flow_temporal_amplitude,
546
+ "temporal_frequency": args.flow_temporal_frequency,
547
+ "rotation_amplitude": args.flow_rotation_amplitude,
548
+ },
549
+ "context_update": "recomputed_from_latest_history_at_each_environment_step",
550
+ "candidate_rollout_context": "fixed_within_each_open_loop_CEM_candidate_rollout",
551
+ "planner_rng": "reseeded_from_the_common_environment_seed_at_each_episode",
552
+ "control_authority_definition": "numerically simulated maximum still-water steady speed under zero-yaw, maximum-amplitude sustained actuation",
553
  "by_context": by_context,
554
  "results": results,
555
  }
 
561
  parser.add_argument("--task", choices=["reach_target", "station_keeping", "waypoint_square", "waypoint_zigzag"], default="reach_target")
562
  parser.add_argument("--boat", choices=["twin", "triangle"], default="twin")
563
  parser.add_argument("--flow-type", choices=["noflow", "uniform", "vortex_center", "double_gyre", "source_sink", "source_sink_pair", "gradient", "shear", "turbulent_patch", "random_fourier"], default="uniform")
564
+ parser.add_argument("--flow-magnitude-scale", type=float, default=1.0)
565
+ parser.add_argument("--flow-temporal-amplitude", type=float, default=0.0)
566
+ parser.add_argument("--flow-temporal-frequency", type=float, default=0.0)
567
+ parser.add_argument("--flow-rotation-amplitude", type=float, default=0.0)
568
  parser.add_argument("--episodes", type=int, default=50)
569
  parser.add_argument("--max-steps", type=int, default=420)
570
  parser.add_argument("--history-len", type=int, default=32)
experiments/evaluate_image_world_models.py CHANGED
@@ -10,9 +10,11 @@ from pathlib import Path
10
  import numpy as np
11
  import torch
12
  from torch.utils.data import DataLoader
 
13
 
14
  from experiments.shared.src.data.image_dataset import ImageTrajectoryDataset
15
  from experiments.shared.src.methods import PAPER_LEARNED_METHODS
 
16
  from experiments.shared.src.vision.clean_renderer import render_clean_boat_history_tensor
17
  from experiments.train_image_world_models import configure_training_runtime
18
  from experiments.train_image_world_models import autocast_context
@@ -24,6 +26,21 @@ from experiments.train_image_world_models import selected_history_indices
24
  METHODS = PAPER_LEARNED_METHODS
25
 
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  def loader_kwargs(num_workers: int) -> dict:
28
  if num_workers <= 0:
29
  return {}
@@ -81,13 +98,67 @@ def load_group_names(source_npz: str, key: str) -> dict[int, str]:
81
  return {int(v): str(k) for k, v in metadata[key].items()}
82
 
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  @torch.no_grad()
85
- def rollout_with_context(model, images: torch.Tensor, actions: torch.Tensor, future_actions: torch.Tensor, mode: str) -> torch.Tensor:
 
 
 
 
 
 
 
 
86
  z, c = model.encode(images, actions)
87
  if mode == "zero":
88
  c = torch.zeros_like(c)
89
- elif mode == "shuffled":
90
- c = c.roll(shifts=1, dims=0)
 
 
91
  if hasattr(model, "rollout_with_context"):
92
  return model.rollout_with_context(z, c, future_actions)
93
  preds = []
@@ -112,7 +183,7 @@ def evaluate_model(
112
  args,
113
  ) -> dict:
114
  model.eval()
115
- steps = [s for s in [1, 3, 6, 8, 10, 20, 30, 40, 60] if s <= horizon]
116
  pos_sum = np.zeros(horizon, dtype=np.float64)
117
  heading_sum = np.zeros(horizon, dtype=np.float64)
118
  flow_pos: dict[int, np.ndarray] = {}
@@ -125,14 +196,47 @@ def evaluate_model(
125
  boat_heading: dict[int, np.ndarray] = {}
126
  boat_count: dict[int, int] = {}
127
  count = 0
 
128
  cursor = 0
 
 
 
 
 
 
 
129
  for batch in loader:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  images, actions, future_actions, targets, origin, _prev_origin, flow_type_id, _boat_id = prepare_batch(batch, args, device)
131
  with autocast_context(device, args.precision):
132
- if context_mode == "inferred":
133
  encoded = model.rollout(images, actions, future_actions)
134
  else:
135
- encoded = rollout_with_context(model, images, actions, future_actions, context_mode)
 
 
 
 
 
 
 
 
136
  pred = decode_predictions(encoded.float(), origin, target_mode)
137
  pos = torch.linalg.norm(pred[..., :2] - targets[..., :2], dim=-1)
138
  pred_angle = torch.atan2(pred[..., 3], pred[..., 2])
@@ -143,11 +247,55 @@ def evaluate_model(
143
  pos_sum += pos_np.sum(axis=0)
144
  heading_sum += heading_np.sum(axis=0)
145
  count += int(pos_np.shape[0])
 
146
  flow_np = flow_type_id.numpy()
147
- batch_indices = loader.dataset.indices[cursor : cursor + int(pos_np.shape[0])]
148
- cursor += int(pos_np.shape[0])
149
  traj_np = np.array([loader.dataset.traj_type_ids[ep] for ep, _t in batch_indices], dtype=np.int64)
150
  boat_np = np.array([loader.dataset.boat_ids[ep] for ep, _t in batch_indices], dtype=np.int64)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  for flow_id in np.unique(flow_np):
152
  mask = flow_np == flow_id
153
  fid = int(flow_id)
@@ -173,6 +321,14 @@ def evaluate_model(
173
  boat_pos[bid] += pos_np[mask].sum(axis=0)
174
  boat_heading[bid] += heading_np[mask].sum(axis=0)
175
  result = summarize(pos_sum / count, heading_sum / count, steps)
 
 
 
 
 
 
 
 
176
  by_flow = {}
177
  for fid, n in sorted(flow_count.items()):
178
  by_flow[flow_names.get(fid, str(fid))] = summarize(flow_pos[fid] / n, flow_heading[fid] / n, steps)
@@ -188,22 +344,104 @@ def evaluate_model(
188
  return result
189
 
190
 
191
- def summarize(pos_mean: np.ndarray, heading_mean: np.ndarray, steps: list[int]) -> dict[str, float]:
192
- result: dict[str, float] = {}
 
 
 
 
 
 
193
  for step in steps:
194
  result[f"pos{step}"] = float(pos_mean[step - 1])
195
  result[f"heading{step}"] = float(heading_mean[step - 1])
196
  return result
197
 
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  def main() -> None:
200
  parser = argparse.ArgumentParser()
201
  parser.add_argument("--methods", nargs="+", default=METHODS)
202
  parser.add_argument("--test-source", default="data/paper/test.npz")
 
203
  parser.add_argument("--test-episodes", type=int, default=256)
204
  parser.add_argument("--history-len", type=int, default=32)
205
  parser.add_argument("--horizon", type=int, default=60)
206
  parser.add_argument("--test-windows", type=int, default=4096)
 
 
 
 
 
207
  parser.add_argument("--batch-size", type=int, default=64)
208
  parser.add_argument("--seed", type=int, default=20)
209
  parser.add_argument("--device", default="cuda")
@@ -215,7 +453,15 @@ def main() -> None:
215
  parser.add_argument("--visual-scale", type=float, default=2.5)
216
  parser.add_argument("--render-mode", choices=["device", "dataset"], default="device")
217
  parser.add_argument("--precision", choices=["fp32", "bf16", "fp16"], default="fp32")
 
 
 
 
 
 
 
218
  args = parser.parse_args()
 
219
  device = torch.device(args.device)
220
  configure_training_runtime(device)
221
  flow_names = load_flow_names(args.test_source)
@@ -232,6 +478,8 @@ def main() -> None:
232
  visual_scale=args.visual_scale,
233
  return_aux=True,
234
  render_images=args.render_mode == "dataset",
 
 
235
  )
236
  loader = DataLoader(
237
  ds,
@@ -251,13 +499,38 @@ def main() -> None:
251
  model.to(memory_format=torch.channels_last)
252
  args.model_history_len = required_model_history(model, args.history_len)
253
  args.history_indices = selected_history_indices(model, args.history_len)
254
- item = {
255
- "method": method,
256
- "inferred": evaluate_model(model, loader, device, args.horizon, args.target_mode, flow_names, traj_names, boat_names, "inferred", args),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
- if method == "flowmo":
259
- item["context_zero"] = evaluate_model(model, loader, device, args.horizon, args.target_mode, flow_names, traj_names, boat_names, "zero", args)
260
- item["context_shuffled"] = evaluate_model(model, loader, device, args.horizon, args.target_mode, flow_names, traj_names, boat_names, "shuffled", args)
261
  payload.append(item)
262
  out = Path(args.out)
263
  out.parent.mkdir(parents=True, exist_ok=True)
 
10
  import numpy as np
11
  import torch
12
  from torch.utils.data import DataLoader
13
+ from torch.utils.data._utils.collate import default_collate
14
 
15
  from experiments.shared.src.data.image_dataset import ImageTrajectoryDataset
16
  from experiments.shared.src.methods import PAPER_LEARNED_METHODS
17
+ from experiments.shared.src.analysis.control_authority import numerical_max_still_water_speed
18
  from experiments.shared.src.vision.clean_renderer import render_clean_boat_history_tensor
19
  from experiments.train_image_world_models import configure_training_runtime
20
  from experiments.train_image_world_models import autocast_context
 
26
  METHODS = PAPER_LEARNED_METHODS
27
 
28
 
29
+ def parse_window_time_ranges(value: str | None) -> list[tuple[int, int]] | None:
30
+ if value is None:
31
+ return None
32
+ ranges: list[tuple[int, int]] = []
33
+ for item in value.split(","):
34
+ bounds = item.strip().split("-")
35
+ if len(bounds) != 2:
36
+ raise ValueError(f"invalid window time range: {item!r}")
37
+ start, end = (int(bound) for bound in bounds)
38
+ if start < 0 or end < start:
39
+ raise ValueError(f"invalid window time range: {item!r}")
40
+ ranges.append((start, end))
41
+ return ranges
42
+
43
+
44
  def loader_kwargs(num_workers: int) -> dict:
45
  if num_workers <= 0:
46
  return {}
 
98
  return {int(v): str(k) for k, v in metadata[key].items()}
99
 
100
 
101
+ def context_partner_indices(dataset: ImageTrajectoryDataset, mode: str) -> np.ndarray:
102
+ """Map each sampled window to a deterministic donor window for a context intervention."""
103
+ if mode not in {"shuffled", "same_flow", "same_flow_reference"}:
104
+ raise ValueError(f"unsupported partner mode: {mode}")
105
+ episodes = np.asarray([episode for episode, _time in dataset.indices], dtype=np.int64)
106
+ flow_ids = dataset.flow_ids[episodes]
107
+ partners = np.full(len(episodes), -1, dtype=np.int64)
108
+ by_flow: dict[int, list[int]] = {}
109
+ for position, flow_id in enumerate(flow_ids):
110
+ by_flow.setdefault(int(flow_id), []).append(position)
111
+
112
+ flow_keys = sorted(by_flow)
113
+ if mode == "shuffled":
114
+ if len(flow_keys) < 2:
115
+ raise ValueError("shuffled-context evaluation requires at least two hidden-flow conditions")
116
+ for flow_index, flow_id in enumerate(flow_keys):
117
+ targets = by_flow[flow_id]
118
+ donors = by_flow[flow_keys[(flow_index + 1) % len(flow_keys)]]
119
+ for offset, target in enumerate(targets):
120
+ partners[target] = donors[offset % len(donors)]
121
+ if np.any(flow_ids[partners] == flow_ids):
122
+ raise AssertionError("shuffled-context donor shares the target hidden-flow condition")
123
+ return partners
124
+
125
+ for flow_id, positions in by_flow.items():
126
+ by_episode: dict[int, list[int]] = {}
127
+ for position in positions:
128
+ by_episode.setdefault(int(episodes[position]), []).append(position)
129
+ episode_keys = sorted(by_episode)
130
+ if len(episode_keys) < 2:
131
+ continue
132
+ for episode_index, episode in enumerate(episode_keys):
133
+ targets = by_episode[episode]
134
+ donors = by_episode[episode_keys[(episode_index + 1) % len(episode_keys)]]
135
+ for offset, target in enumerate(targets):
136
+ partners[target] = donors[offset % len(donors)]
137
+ eligible = partners >= 0
138
+ if np.any(flow_ids[partners[eligible]] != flow_ids[eligible]):
139
+ raise AssertionError("same-flow donor does not share the target hidden-flow condition")
140
+ if np.any(episodes[partners[eligible]] == episodes[eligible]):
141
+ raise AssertionError("same-flow donor must come from a different episode")
142
+ return partners
143
+
144
+
145
  @torch.no_grad()
146
+ def rollout_with_context(
147
+ model,
148
+ images: torch.Tensor,
149
+ actions: torch.Tensor,
150
+ future_actions: torch.Tensor,
151
+ mode: str,
152
+ donor_images: torch.Tensor | None = None,
153
+ donor_actions: torch.Tensor | None = None,
154
+ ) -> torch.Tensor:
155
  z, c = model.encode(images, actions)
156
  if mode == "zero":
157
  c = torch.zeros_like(c)
158
+ elif mode in {"shuffled", "same_flow"}:
159
+ if donor_images is None or donor_actions is None:
160
+ raise ValueError(f"{mode} context intervention requires donor observations")
161
+ _donor_z, c = model.encode(donor_images, donor_actions)
162
  if hasattr(model, "rollout_with_context"):
163
  return model.rollout_with_context(z, c, future_actions)
164
  preds = []
 
183
  args,
184
  ) -> dict:
185
  model.eval()
186
+ steps = [s for s in [1, 3, 6, 8, 10, 20, 30, 40, 60, 120] if s <= horizon]
187
  pos_sum = np.zeros(horizon, dtype=np.float64)
188
  heading_sum = np.zeros(horizon, dtype=np.float64)
189
  flow_pos: dict[int, np.ndarray] = {}
 
196
  boat_heading: dict[int, np.ndarray] = {}
197
  boat_count: dict[int, int] = {}
198
  count = 0
199
+ large_error_count = 0
200
  cursor = 0
201
+ rho_samples: list[dict] = []
202
+ authority_cache: dict[int, float] = {}
203
+ partner_indices = (
204
+ context_partner_indices(loader.dataset, context_mode)
205
+ if context_mode in {"shuffled", "same_flow", "same_flow_reference"}
206
+ else None
207
+ )
208
  for batch in loader:
209
+ raw_batch_size = int(batch[0].shape[0])
210
+ sample_positions = np.arange(cursor, cursor + raw_batch_size, dtype=np.int64)
211
+ cursor += raw_batch_size
212
+ donor_images = None
213
+ donor_actions = None
214
+ if partner_indices is not None:
215
+ donor_positions = partner_indices[sample_positions]
216
+ if context_mode in {"same_flow", "same_flow_reference"}:
217
+ eligible = donor_positions >= 0
218
+ if not np.any(eligible):
219
+ continue
220
+ batch = tuple(value[torch.from_numpy(eligible)] for value in batch)
221
+ sample_positions = sample_positions[eligible]
222
+ donor_positions = donor_positions[eligible]
223
+ if context_mode in {"shuffled", "same_flow"}:
224
+ donor_batch = default_collate([loader.dataset[int(position)] for position in donor_positions])
225
+ donor_images, donor_actions, *_rest = prepare_batch(donor_batch, args, device)
226
  images, actions, future_actions, targets, origin, _prev_origin, flow_type_id, _boat_id = prepare_batch(batch, args, device)
227
  with autocast_context(device, args.precision):
228
+ if context_mode in {"inferred", "same_flow_reference"}:
229
  encoded = model.rollout(images, actions, future_actions)
230
  else:
231
+ encoded = rollout_with_context(
232
+ model,
233
+ images,
234
+ actions,
235
+ future_actions,
236
+ context_mode,
237
+ donor_images=donor_images,
238
+ donor_actions=donor_actions,
239
+ )
240
  pred = decode_predictions(encoded.float(), origin, target_mode)
241
  pos = torch.linalg.norm(pred[..., :2] - targets[..., :2], dim=-1)
242
  pred_angle = torch.atan2(pred[..., 3], pred[..., 2])
 
247
  pos_sum += pos_np.sum(axis=0)
248
  heading_sum += heading_np.sum(axis=0)
249
  count += int(pos_np.shape[0])
250
+ large_error_count += int((pos_np[:, -1] > args.large_error_threshold).sum())
251
  flow_np = flow_type_id.numpy()
252
+ batch_indices = [loader.dataset.indices[int(position)] for position in sample_positions]
 
253
  traj_np = np.array([loader.dataset.traj_type_ids[ep] for ep, _t in batch_indices], dtype=np.int64)
254
  boat_np = np.array([loader.dataset.boat_ids[ep] for ep, _t in batch_indices], dtype=np.int64)
255
+ if loader.dataset.boat_params is not None:
256
+ for row_index, (episode, time_index) in enumerate(batch_indices):
257
+ if episode not in authority_cache:
258
+ boat_name = boat_names.get(int(loader.dataset.boat_ids[episode]), str(int(loader.dataset.boat_ids[episode])))
259
+ authority_cache[episode] = numerical_max_still_water_speed(
260
+ boat_name,
261
+ loader.dataset.boat_params[episode],
262
+ )
263
+ flow_slice = loader.dataset.true_flow[episode, time_index + 1 : time_index + 1 + horizon]
264
+ flow_speed = np.linalg.norm(flow_slice, axis=-1)
265
+ q95 = float(np.percentile(flow_speed, 95))
266
+ authority = authority_cache[episode]
267
+ rho_samples.append(
268
+ {
269
+ "episode": int(loader.dataset.episode_indices[episode]),
270
+ "local_episode": int(episode),
271
+ "flow_id": int(
272
+ loader.dataset.flow_ids[episode]
273
+ if loader.dataset.flow_ids_step is None
274
+ else loader.dataset.flow_ids_step[episode, time_index]
275
+ ),
276
+ "flow_family": flow_names.get(
277
+ int(
278
+ loader.dataset.flow_type_ids[episode]
279
+ if loader.dataset.flow_type_ids_step is None
280
+ else loader.dataset.flow_type_ids_step[episode, time_index]
281
+ ),
282
+ str(
283
+ int(
284
+ loader.dataset.flow_type_ids[episode]
285
+ if loader.dataset.flow_type_ids_step is None
286
+ else loader.dataset.flow_type_ids_step[episode, time_index]
287
+ )
288
+ ),
289
+ ),
290
+ "boat": boat_names.get(int(loader.dataset.boat_ids[episode]), str(int(loader.dataset.boat_ids[episode]))),
291
+ "rho": q95 / authority,
292
+ "flow_speed_mean": float(flow_speed.mean()),
293
+ "flow_speed_q95": q95,
294
+ "max_still_water_speed": authority,
295
+ "errors": {str(step): float(pos_np[row_index, step - 1]) for step in steps},
296
+ "diverged": bool(pos_np[row_index, -1] > args.large_error_threshold),
297
+ }
298
+ )
299
  for flow_id in np.unique(flow_np):
300
  mask = flow_np == flow_id
301
  fid = int(flow_id)
 
321
  boat_pos[bid] += pos_np[mask].sum(axis=0)
322
  boat_heading[bid] += heading_np[mask].sum(axis=0)
323
  result = summarize(pos_sum / count, heading_sum / count, steps)
324
+ result["evaluated_windows"] = int(count)
325
+ if context_mode in {"same_flow", "same_flow_reference"}:
326
+ result["eligible_fraction"] = float(count / len(loader.dataset))
327
+ result["large_error_threshold_m"] = float(args.large_error_threshold)
328
+ result["large_error_rate"] = float(large_error_count / count)
329
+ result["divergence_rate"] = result["large_error_rate"]
330
+ if rho_samples:
331
+ result["rho_diagnostics"] = summarize_rho(rho_samples, steps)
332
  by_flow = {}
333
  for fid, n in sorted(flow_count.items()):
334
  by_flow[flow_names.get(fid, str(fid))] = summarize(flow_pos[fid] / n, flow_heading[fid] / n, steps)
 
344
  return result
345
 
346
 
347
+ def summarize(pos_mean: np.ndarray, heading_mean: np.ndarray, steps: list[int]) -> dict:
348
+ result: dict = {
349
+ "position_curve": [float(value) for value in pos_mean],
350
+ "heading_curve": [float(value) for value in heading_mean],
351
+ "position_auc": float(np.mean(pos_mean)),
352
+ "heading_auc": float(np.mean(heading_mean)),
353
+ "error_growth_slope": float(np.polyfit(np.arange(1, len(pos_mean) + 1), pos_mean, 1)[0]),
354
+ }
355
  for step in steps:
356
  result[f"pos{step}"] = float(pos_mean[step - 1])
357
  result[f"heading{step}"] = float(heading_mean[step - 1])
358
  return result
359
 
360
 
361
+ def summarize_rho(samples: list[dict], steps: list[int]) -> dict:
362
+ rho = np.asarray([sample["rho"] for sample in samples], dtype=np.float64)
363
+ edges = np.asarray([0.0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.75, 1.0, 1.5, np.inf], dtype=np.float64)
364
+ bins = []
365
+ for index in range(len(edges) - 1):
366
+ low = edges[index]
367
+ high = edges[index + 1]
368
+ mask = (rho >= low) & (rho < high)
369
+ if not np.any(mask):
370
+ continue
371
+ selected = [sample for sample, keep in zip(samples, mask) if keep]
372
+ bins.append(
373
+ {
374
+ "rho_low": float(low),
375
+ "rho_high": None if np.isinf(high) else float(high),
376
+ "windows": len(selected),
377
+ "rho_mean": float(np.mean([sample["rho"] for sample in selected])),
378
+ "divergence_rate": float(np.mean([sample["diverged"] for sample in selected])),
379
+ **{
380
+ f"pos{step}": float(np.mean([sample["errors"][str(step)] for sample in selected]))
381
+ for step in steps
382
+ },
383
+ }
384
+ )
385
+
386
+ continuous = {}
387
+ for step in steps:
388
+ error = np.asarray([sample["errors"][str(step)] for sample in samples], dtype=np.float64)
389
+ slope = float(np.polyfit(rho, error, 1)[0]) if np.ptp(rho) > 0.0 else 0.0
390
+ correlation = float(np.corrcoef(rho, error)[0, 1]) if np.std(rho) > 0.0 and np.std(error) > 0.0 else 0.0
391
+ continuous[f"pos{step}"] = {
392
+ "linear_slope_per_rho": slope,
393
+ "pearson_r": correlation,
394
+ }
395
+
396
+ episode_rows = []
397
+ for episode in sorted({sample["episode"] for sample in samples}):
398
+ selected = [sample for sample in samples if sample["episode"] == episode]
399
+ first = selected[0]
400
+ episode_rows.append(
401
+ {
402
+ "episode": episode,
403
+ "windows": len(selected),
404
+ "flow_id": first["flow_id"],
405
+ "flow_family": first["flow_family"],
406
+ "boat": first["boat"],
407
+ "rho_mean": float(np.mean([sample["rho"] for sample in selected])),
408
+ "flow_speed_mean": float(np.mean([sample["flow_speed_mean"] for sample in selected])),
409
+ "flow_speed_q95_mean": float(np.mean([sample["flow_speed_q95"] for sample in selected])),
410
+ "max_still_water_speed": first["max_still_water_speed"],
411
+ "divergence_rate": float(np.mean([sample["diverged"] for sample in selected])),
412
+ **{
413
+ f"pos{step}": float(np.mean([sample["errors"][str(step)] for sample in selected]))
414
+ for step in steps
415
+ },
416
+ }
417
+ )
418
+ return {
419
+ "definition": "q95 local flow speed along the reference future route divided by numerically simulated maximum still-water steady speed",
420
+ "windows": len(samples),
421
+ "episodes": len(episode_rows),
422
+ "rho_mean": float(rho.mean()),
423
+ "rho_q95": float(np.percentile(rho, 95)),
424
+ "rho_max": float(rho.max()),
425
+ "bins": bins,
426
+ "continuous": continuous,
427
+ "by_episode": episode_rows,
428
+ }
429
+
430
+
431
  def main() -> None:
432
  parser = argparse.ArgumentParser()
433
  parser.add_argument("--methods", nargs="+", default=METHODS)
434
  parser.add_argument("--test-source", default="data/paper/test.npz")
435
+ parser.add_argument("--test-flow-families", nargs="+", default=None)
436
  parser.add_argument("--test-episodes", type=int, default=256)
437
  parser.add_argument("--history-len", type=int, default=32)
438
  parser.add_argument("--horizon", type=int, default=60)
439
  parser.add_argument("--test-windows", type=int, default=4096)
440
+ parser.add_argument(
441
+ "--window-time-ranges",
442
+ default=None,
443
+ help="Comma-separated inclusive origin-time ranges, e.g. 101-108,201-208.",
444
+ )
445
  parser.add_argument("--batch-size", type=int, default=64)
446
  parser.add_argument("--seed", type=int, default=20)
447
  parser.add_argument("--device", default="cuda")
 
453
  parser.add_argument("--visual-scale", type=float, default=2.5)
454
  parser.add_argument("--render-mode", choices=["device", "dataset"], default="device")
455
  parser.add_argument("--precision", choices=["fp32", "bf16", "fp16"], default="fp32")
456
+ parser.add_argument(
457
+ "--context-modes",
458
+ nargs="+",
459
+ choices=["inferred", "zero", "shuffled", "same_flow_reference", "same_flow"],
460
+ default=["inferred", "zero", "shuffled"],
461
+ )
462
+ parser.add_argument("--large-error-threshold", type=float, default=2.0)
463
  args = parser.parse_args()
464
+ window_time_ranges = parse_window_time_ranges(args.window_time_ranges)
465
  device = torch.device(args.device)
466
  configure_training_runtime(device)
467
  flow_names = load_flow_names(args.test_source)
 
478
  visual_scale=args.visual_scale,
479
  return_aux=True,
480
  render_images=args.render_mode == "dataset",
481
+ flow_families=args.test_flow_families,
482
+ window_time_ranges=window_time_ranges,
483
  )
484
  loader = DataLoader(
485
  ds,
 
499
  model.to(memory_format=torch.channels_last)
500
  args.model_history_len = required_model_history(model, args.history_len)
501
  args.history_indices = selected_history_indices(model, args.history_len)
502
+ item = {"method": method}
503
+ modes = args.context_modes if method == "flowmo" or method.startswith("flowmo_") else ["inferred"]
504
+ output_names = {
505
+ "inferred": "inferred",
506
+ "zero": "context_zero",
507
+ "shuffled": "context_shuffled",
508
+ "same_flow_reference": "context_same_flow_reference",
509
+ "same_flow": "context_same_flow",
510
+ }
511
+ for mode in modes:
512
+ item[output_names[mode]] = evaluate_model(
513
+ model,
514
+ loader,
515
+ device,
516
+ args.horizon,
517
+ args.target_mode,
518
+ flow_names,
519
+ traj_names,
520
+ boat_names,
521
+ mode,
522
+ args,
523
+ )
524
+ item["provenance"] = {
525
+ "checkpoint": args.checkpoint_name,
526
+ "test_source": args.test_source,
527
+ "test_flow_families": args.test_flow_families,
528
+ "test_episodes_requested": int(args.test_episodes),
529
+ "test_episodes_used": int(len(ds.episode_indices)),
530
+ "test_windows_used": int(len(ds)),
531
+ "window_time_ranges": window_time_ranges,
532
+ "seed": int(args.seed),
533
  }
 
 
 
534
  payload.append(item)
535
  out = Path(args.out)
536
  out.parent.mkdir(parents=True, exist_ok=True)
experiments/evaluate_temporal_flow_probes.py ADDED
@@ -0,0 +1,565 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """History-aligned flow probes for frozen FlowMo representations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ from dataclasses import dataclass
8
+ from pathlib import Path
9
+
10
+ import numpy as np
11
+ import torch
12
+ from torch.utils.data import DataLoader, Dataset
13
+
14
+ from experiments.evaluate_flowmo_latent_probes import (
15
+ average_nested,
16
+ build_flowmo,
17
+ fit_mlp,
18
+ fit_ridge,
19
+ loader_kwargs,
20
+ predict_mlp,
21
+ predict_ridge,
22
+ )
23
+ from experiments.shared.src.vision.clean_renderer import render_clean_boat_history_tensor
24
+ from experiments.train_image_world_models import autocast_context, configure_training_runtime, selected_history_indices
25
+
26
+
27
+ TARGET_NAMES = (
28
+ "flow_oldest",
29
+ "flow_context_mean",
30
+ "flow_history_mean",
31
+ "flow_latest_context",
32
+ "flow_current",
33
+ )
34
+ BASE_FEATURE_NAMES = ("z", "c", "z_c")
35
+ CURRENT_QUERY_FEATURE_NAMES = ("position", "c_position")
36
+
37
+
38
+ @dataclass
39
+ class TemporalFlowProbeSet:
40
+ z: np.ndarray
41
+ c: np.ndarray
42
+ position: np.ndarray
43
+ targets: dict[str, np.ndarray]
44
+ flow_family: np.ndarray
45
+ episode_id: np.ndarray
46
+ time_index: np.ndarray
47
+ flow_names: dict[int, str]
48
+
49
+
50
+ def contiguous_indices(
51
+ episodes: int,
52
+ first_time: int,
53
+ last_time: int,
54
+ max_windows: int,
55
+ seed: int,
56
+ ) -> list[tuple[int, int]]:
57
+ """Select balanced contiguous blocks so update metrics have paired windows."""
58
+ available_per_episode = last_time - first_time + 1
59
+ total = episodes * available_per_episode
60
+ requested = min(int(max_windows), total)
61
+ if requested == total:
62
+ return [(episode, time) for episode in range(episodes) for time in range(first_time, last_time + 1)]
63
+
64
+ base, remainder = divmod(requested, episodes)
65
+ if base > available_per_episode or (base == available_per_episode and remainder):
66
+ raise ValueError("requested contiguous windows exceed available windows")
67
+ rng = np.random.default_rng(seed)
68
+ extra_episodes = set(rng.permutation(episodes)[:remainder].tolist())
69
+ indices: list[tuple[int, int]] = []
70
+ for episode in range(episodes):
71
+ count = base + int(episode in extra_episodes)
72
+ if count == 0:
73
+ continue
74
+ max_start = last_time - count + 1
75
+ start = int(rng.integers(first_time, max_start + 1))
76
+ indices.extend((episode, time) for time in range(start, start + count))
77
+ return indices
78
+
79
+
80
+ class TemporalFlowProbeDataset(Dataset):
81
+ def __init__(
82
+ self,
83
+ source_npz: str,
84
+ history_len: int,
85
+ context_stride: int,
86
+ episodes: int,
87
+ max_windows: int,
88
+ seed: int,
89
+ selection: str,
90
+ ):
91
+ src = np.load(source_npz, allow_pickle=False)
92
+ self.states = src["states"][:episodes].astype(np.float32)
93
+ self.actions = src["actions"][:episodes].astype(np.float32)
94
+ self.true_flow = src["true_flow"][:episodes].astype(np.float32)
95
+ self.boat_ids = src["boat_ids"][:episodes].astype(np.int64)
96
+ self.flow_family = src["flow_type_ids"][:episodes].astype(np.int64)
97
+ metadata = json.loads(str(src["metadata"]))
98
+ self.flow_names = {int(value): name for name, value in metadata["flows"].items()}
99
+ self.history_len = int(history_len)
100
+ self.context_stride = int(context_stride)
101
+ if self.history_len < 2 or self.context_stride < 1:
102
+ raise ValueError("history_len and context_stride must be positive")
103
+ self.context_offsets = np.arange(0, self.history_len, self.context_stride, dtype=np.int64)
104
+ steps = self.actions.shape[1]
105
+ first_time = self.history_len - 1
106
+ last_time = steps - 1
107
+ if selection == "random":
108
+ all_indices = [
109
+ (episode, time)
110
+ for episode in range(episodes)
111
+ for time in range(first_time, last_time + 1)
112
+ ]
113
+ rng = np.random.default_rng(seed)
114
+ selected = rng.choice(len(all_indices), size=min(max_windows, len(all_indices)), replace=False)
115
+ self.indices = [all_indices[int(index)] for index in selected]
116
+ elif selection == "contiguous":
117
+ self.indices = contiguous_indices(episodes, first_time, last_time, max_windows, seed)
118
+ else:
119
+ raise ValueError(f"unknown selection mode: {selection}")
120
+
121
+ def __len__(self) -> int:
122
+ return len(self.indices)
123
+
124
+ def __getitem__(self, index: int) -> dict[str, torch.Tensor]:
125
+ episode, time = self.indices[index]
126
+ start = time - self.history_len + 1
127
+ state_history = self.states[episode, start : time + 1, :6].copy()
128
+ padded_actions = np.zeros((self.actions.shape[1] + 1, self.actions.shape[2]), dtype=np.float32)
129
+ padded_actions[1:] = self.actions[episode]
130
+ action_history = padded_actions[start : time + 1].copy()
131
+ flow_history = self.true_flow[episode, start : time + 1]
132
+ context_flow = flow_history[self.context_offsets]
133
+ targets = np.stack(
134
+ [
135
+ flow_history[0],
136
+ context_flow.mean(axis=0),
137
+ flow_history.mean(axis=0),
138
+ context_flow[-1],
139
+ flow_history[-1],
140
+ ],
141
+ axis=0,
142
+ ).astype(np.float32)
143
+ return {
144
+ "states": torch.from_numpy(state_history),
145
+ "actions": torch.from_numpy(action_history),
146
+ "boat_id": torch.tensor(self.boat_ids[episode], dtype=torch.long),
147
+ "position": torch.from_numpy(state_history[-1, :2].copy()),
148
+ "targets": torch.from_numpy(targets),
149
+ "flow_family": torch.tensor(self.flow_family[episode], dtype=torch.long),
150
+ "episode_id": torch.tensor(episode, dtype=torch.long),
151
+ "time_index": torch.tensor(time, dtype=torch.long),
152
+ }
153
+
154
+
155
+ @torch.no_grad()
156
+ def collect_probe_set(
157
+ model,
158
+ source: str,
159
+ episodes: int,
160
+ max_windows: int,
161
+ selection: str,
162
+ args,
163
+ seed: int,
164
+ ) -> TemporalFlowProbeSet:
165
+ dataset = TemporalFlowProbeDataset(
166
+ source,
167
+ args.history_len,
168
+ model.config.context_stride,
169
+ episodes,
170
+ max_windows,
171
+ seed,
172
+ selection,
173
+ )
174
+ loader = DataLoader(
175
+ dataset,
176
+ batch_size=args.batch_size,
177
+ shuffle=False,
178
+ num_workers=args.num_workers,
179
+ pin_memory=torch.device(args.device).type == "cuda",
180
+ **loader_kwargs(args.num_workers),
181
+ )
182
+ device = torch.device(args.device)
183
+ history_indices = selected_history_indices(model, args.history_len)
184
+ zs, contexts, positions, target_batches = [], [], [], []
185
+ flow_families, episode_ids, time_indices = [], [], []
186
+ model.eval()
187
+ for batch in loader:
188
+ states = batch["states"][:, history_indices].to(device, non_blocking=True)
189
+ actions = batch["actions"][:, history_indices].to(device, non_blocking=True)
190
+ boat_ids = batch["boat_id"].to(device, non_blocking=True)
191
+ images = render_clean_boat_history_tensor(
192
+ states,
193
+ boat_ids,
194
+ image_size=args.image_size,
195
+ visual_scale=args.visual_scale,
196
+ )
197
+ with autocast_context(device, args.precision):
198
+ z, context = model.encode(images, actions)
199
+ zs.append(z.float().cpu().numpy())
200
+ contexts.append(context.float().cpu().numpy())
201
+ positions.append(batch["position"].numpy())
202
+ target_batches.append(batch["targets"].numpy())
203
+ flow_families.append(batch["flow_family"].numpy())
204
+ episode_ids.append(batch["episode_id"].numpy())
205
+ time_indices.append(batch["time_index"].numpy())
206
+ target_array = np.concatenate(target_batches, axis=0)
207
+ return TemporalFlowProbeSet(
208
+ z=np.concatenate(zs, axis=0),
209
+ c=np.concatenate(contexts, axis=0),
210
+ position=np.concatenate(positions, axis=0),
211
+ targets={name: target_array[:, index] for index, name in enumerate(TARGET_NAMES)},
212
+ flow_family=np.concatenate(flow_families, axis=0),
213
+ episode_id=np.concatenate(episode_ids, axis=0),
214
+ time_index=np.concatenate(time_indices, axis=0),
215
+ flow_names=dataset.flow_names,
216
+ )
217
+
218
+
219
+ def feature_matrix(probe_set: TemporalFlowProbeSet, name: str) -> np.ndarray:
220
+ if name == "z":
221
+ return probe_set.z
222
+ if name == "c":
223
+ return probe_set.c
224
+ if name == "z_c":
225
+ return np.concatenate([probe_set.z, probe_set.c], axis=1)
226
+ if name == "position":
227
+ return probe_set.position
228
+ if name == "c_position":
229
+ return np.concatenate([probe_set.c, probe_set.position], axis=1)
230
+ raise ValueError(f"unknown feature set: {name}")
231
+
232
+
233
+ def target_features(target: str) -> tuple[str, ...]:
234
+ if target == "flow_current":
235
+ return (*BASE_FEATURE_NAMES, *CURRENT_QUERY_FEATURE_NAMES)
236
+ return BASE_FEATURE_NAMES
237
+
238
+
239
+ def safe_pearson(left: np.ndarray, right: np.ndarray) -> float | None:
240
+ left = np.asarray(left, dtype=np.float64)
241
+ right = np.asarray(right, dtype=np.float64)
242
+ if len(left) < 2 or np.std(left) < 1.0e-12 or np.std(right) < 1.0e-12:
243
+ return None
244
+ return float(np.corrcoef(left, right)[0, 1])
245
+
246
+
247
+ def flow_metrics(prediction: np.ndarray, target: np.ndarray) -> dict:
248
+ prediction = np.asarray(prediction, dtype=np.float64)
249
+ target = np.asarray(target, dtype=np.float64)
250
+ error = prediction - target
251
+ mse_by_dim = np.mean(error * error, axis=0)
252
+ variance_by_dim = np.mean((target - target.mean(axis=0, keepdims=True)) ** 2, axis=0)
253
+ r2_by_dim: list[float | None] = [
254
+ None if variance < 1.0e-12 else float(1.0 - mse / variance)
255
+ for mse, variance in zip(mse_by_dim, variance_by_dim)
256
+ ]
257
+ pearson_by_dim = [safe_pearson(prediction[:, dim], target[:, dim]) for dim in range(2)]
258
+ finite_r2 = [value for value in r2_by_dim if value is not None]
259
+ finite_pearson = [value for value in pearson_by_dim if value is not None]
260
+ target_magnitude = np.linalg.norm(target, axis=1)
261
+ prediction_magnitude = np.linalg.norm(prediction, axis=1)
262
+ nonzero = target_magnitude > 1.0e-6
263
+ if np.any(nonzero):
264
+ cosine = np.sum(prediction[nonzero] * target[nonzero], axis=1) / np.maximum(
265
+ prediction_magnitude[nonzero] * target_magnitude[nonzero],
266
+ 1.0e-12,
267
+ )
268
+ direction_error = float(np.degrees(np.arccos(np.clip(cosine, -1.0, 1.0))).mean())
269
+ else:
270
+ direction_error = None
271
+ return {
272
+ "n": int(len(target)),
273
+ "rmse": float(np.sqrt(np.mean(error * error))),
274
+ "rmse_by_dim": {"flow_x": float(np.sqrt(mse_by_dim[0])), "flow_y": float(np.sqrt(mse_by_dim[1]))},
275
+ "r2_mean": float(np.mean(finite_r2)) if finite_r2 else None,
276
+ "r2_by_dim": {"flow_x": r2_by_dim[0], "flow_y": r2_by_dim[1]},
277
+ "pearson_mean": float(np.mean(finite_pearson)) if finite_pearson else None,
278
+ "pearson_by_dim": {"flow_x": pearson_by_dim[0], "flow_y": pearson_by_dim[1]},
279
+ "endpoint_error_mean": float(np.linalg.norm(error, axis=1).mean()),
280
+ "magnitude_mae": float(np.abs(prediction_magnitude - target_magnitude).mean()),
281
+ "direction_error_deg": direction_error,
282
+ }
283
+
284
+
285
+ def subset_metrics(
286
+ prediction: np.ndarray,
287
+ target: np.ndarray,
288
+ probe_set: TemporalFlowProbeSet,
289
+ ) -> dict:
290
+ family = probe_set.flow_family
291
+ payload = {
292
+ "all": flow_metrics(prediction, target),
293
+ "nonzero_family": flow_metrics(prediction[family != 0], target[family != 0]),
294
+ "spatial_family": flow_metrics(prediction[(family != 0) & (family != 1)], target[(family != 0) & (family != 1)]),
295
+ "by_flow_family": {},
296
+ }
297
+ for family_id, name in sorted(probe_set.flow_names.items()):
298
+ mask = family == family_id
299
+ if np.any(mask):
300
+ payload["by_flow_family"][name] = flow_metrics(prediction[mask], target[mask])
301
+ return payload
302
+
303
+
304
+ def consecutive_pairs(probe_set: TemporalFlowProbeSet) -> tuple[np.ndarray, np.ndarray]:
305
+ lookup = {
306
+ (int(episode), int(time)): index
307
+ for index, (episode, time) in enumerate(zip(probe_set.episode_id, probe_set.time_index))
308
+ }
309
+ left, right = [], []
310
+ for (episode, time), index in lookup.items():
311
+ next_index = lookup.get((episode, time + 1))
312
+ if next_index is not None:
313
+ left.append(index)
314
+ right.append(next_index)
315
+ return np.asarray(left, dtype=np.int64), np.asarray(right, dtype=np.int64)
316
+
317
+
318
+ def within_episode_lag_correlation(
319
+ prediction: np.ndarray,
320
+ target: np.ndarray,
321
+ probe_set: TemporalFlowProbeSet,
322
+ max_lag: int,
323
+ ) -> dict[str, dict]:
324
+ lookup = {
325
+ (int(episode), int(time)): index
326
+ for index, (episode, time) in enumerate(zip(probe_set.episode_id, probe_set.time_index))
327
+ }
328
+ payload = {}
329
+ for lag in range(max_lag + 1):
330
+ predicted_parts, target_parts = [], []
331
+ for episode in np.unique(probe_set.episode_id):
332
+ predicted_indices, target_indices = [], []
333
+ episode_times = probe_set.time_index[probe_set.episode_id == episode]
334
+ for time in episode_times:
335
+ pred_index = lookup[(int(episode), int(time))]
336
+ target_index = lookup.get((int(episode), int(time) - lag))
337
+ if target_index is not None:
338
+ predicted_indices.append(pred_index)
339
+ target_indices.append(target_index)
340
+ if len(predicted_indices) < 2:
341
+ continue
342
+ predicted_episode = prediction[predicted_indices]
343
+ target_episode = target[target_indices]
344
+ predicted_parts.append(predicted_episode - predicted_episode.mean(axis=0, keepdims=True))
345
+ target_parts.append(target_episode - target_episode.mean(axis=0, keepdims=True))
346
+ if predicted_parts:
347
+ centered_prediction = np.concatenate(predicted_parts, axis=0)
348
+ centered_target = np.concatenate(target_parts, axis=0)
349
+ correlations = [
350
+ safe_pearson(centered_prediction[:, dim], centered_target[:, dim])
351
+ for dim in range(2)
352
+ ]
353
+ finite = [value for value in correlations if value is not None]
354
+ payload[str(lag)] = {
355
+ "n": int(len(centered_target)),
356
+ "pearson_mean": float(np.mean(finite)) if finite else None,
357
+ "pearson_by_dim": {"flow_x": correlations[0], "flow_y": correlations[1]},
358
+ }
359
+ return payload
360
+
361
+
362
+ def tracking_metrics(
363
+ prediction: np.ndarray,
364
+ target: np.ndarray,
365
+ probe_set: TemporalFlowProbeSet,
366
+ max_lag: int,
367
+ ) -> dict:
368
+ left, right = consecutive_pairs(probe_set)
369
+ prediction_delta = prediction[right] - prediction[left]
370
+ target_delta = target[right] - target[left]
371
+ return {
372
+ "consecutive_pairs": int(len(left)),
373
+ "delta": flow_metrics(prediction_delta, target_delta),
374
+ "within_episode_lag": within_episode_lag_correlation(
375
+ prediction,
376
+ target,
377
+ probe_set,
378
+ max_lag,
379
+ ),
380
+ }
381
+
382
+
383
+ def fit_ridge_bank(probe_set: TemporalFlowProbeSet, alpha: float) -> dict:
384
+ return {
385
+ target: {
386
+ feature: fit_ridge(feature_matrix(probe_set, feature), probe_set.targets[target], alpha)
387
+ for feature in target_features(target)
388
+ }
389
+ for target in TARGET_NAMES
390
+ }
391
+
392
+
393
+ def fit_mlp_bank(probe_set: TemporalFlowProbeSet, args, seed: int) -> dict:
394
+ bank = {}
395
+ fit_index = 0
396
+ for target in TARGET_NAMES:
397
+ bank[target] = {}
398
+ for feature in target_features(target):
399
+ bank[target][feature] = fit_mlp(
400
+ feature_matrix(probe_set, feature),
401
+ probe_set.targets[target],
402
+ task="regression",
403
+ epochs=args.mlp_epochs,
404
+ batch_size=args.mlp_batch_size,
405
+ hidden_dim=args.mlp_hidden_dim,
406
+ learning_rate=args.mlp_learning_rate,
407
+ device=torch.device(args.probe_device),
408
+ seed=seed + fit_index,
409
+ )
410
+ fit_index += 1
411
+ return bank
412
+
413
+
414
+ def evaluate_bank(bank: dict, probe_set: TemporalFlowProbeSet, predictor, max_lag: int) -> dict:
415
+ level, tracking = {}, {}
416
+ for target, feature_models in bank.items():
417
+ level[target] = {}
418
+ tracking[target] = {}
419
+ for feature, model in feature_models.items():
420
+ prediction = predictor(model, feature_matrix(probe_set, feature))
421
+ level[target][feature] = subset_metrics(prediction, probe_set.targets[target], probe_set)
422
+ tracking[target][feature] = tracking_metrics(
423
+ prediction,
424
+ probe_set.targets[target],
425
+ probe_set,
426
+ max_lag,
427
+ )
428
+ return {"level": level, "tracking": tracking}
429
+
430
+
431
+ def run_regime(model, regime: dict, args, window_seed: int) -> dict:
432
+ train_set = collect_probe_set(
433
+ model,
434
+ regime["train_source"],
435
+ int(regime["train_episodes"]),
436
+ args.train_windows,
437
+ "random",
438
+ args,
439
+ window_seed,
440
+ )
441
+ eval_set = collect_probe_set(
442
+ model,
443
+ regime["eval_source"],
444
+ int(regime["eval_episodes"]),
445
+ args.eval_windows,
446
+ "contiguous",
447
+ args,
448
+ window_seed + 100,
449
+ )
450
+ ridge_bank = fit_ridge_bank(train_set, args.ridge_alpha)
451
+ ridge = evaluate_bank(ridge_bank, eval_set, predict_ridge, args.max_lag)
452
+ mlp_banks = [fit_mlp_bank(train_set, args, seed) for seed in args.mlp_seeds]
453
+ mlp_repeats = [evaluate_bank(bank, eval_set, predict_mlp, args.max_lag) for bank in mlp_banks]
454
+ return {
455
+ "train_source": regime["train_source"],
456
+ "eval_source": regime["eval_source"],
457
+ "train_windows": int(len(train_set.c)),
458
+ "eval_windows": int(len(eval_set.c)),
459
+ "ridge": ridge,
460
+ "mlp_average": average_nested(mlp_repeats),
461
+ "mlp_repeats": {
462
+ str(seed): result for seed, result in zip(args.mlp_seeds, mlp_repeats)
463
+ },
464
+ }
465
+
466
+
467
+ def main() -> None:
468
+ parser = argparse.ArgumentParser()
469
+ parser.add_argument("--config", default="experiments/shared/config/temporal_flow_probe_v1.json")
470
+ parser.add_argument("--seed", type=int, required=True)
471
+ parser.add_argument("--out", required=True)
472
+ parser.add_argument("--device", default="cuda")
473
+ parser.add_argument("--probe-device", default=None)
474
+ parser.add_argument("--train-windows", type=int, default=None)
475
+ parser.add_argument("--eval-windows", type=int, default=None)
476
+ parser.add_argument("--mlp-epochs", type=int, default=None)
477
+ parser.add_argument("--num-workers", type=int, default=None)
478
+ parser.add_argument("--regimes", nargs="+", default=None)
479
+ args = parser.parse_args()
480
+
481
+ config = json.loads(Path(args.config).read_text())
482
+ probe = config["probe"]
483
+ args.history_len = int(probe["history_len"])
484
+ args.train_windows = int(args.train_windows or probe["train_windows"])
485
+ args.eval_windows = int(args.eval_windows or probe["eval_windows"])
486
+ args.batch_size = int(probe["batch_size"])
487
+ args.ridge_alpha = float(probe["ridge_alpha"])
488
+ args.mlp_epochs = int(args.mlp_epochs if args.mlp_epochs is not None else probe["mlp_epochs"])
489
+ args.mlp_batch_size = int(probe["mlp_batch_size"])
490
+ args.mlp_hidden_dim = int(probe["mlp_hidden_dim"])
491
+ args.mlp_learning_rate = float(probe["mlp_learning_rate"])
492
+ args.mlp_seeds = [int(value) for value in probe["mlp_seeds"]]
493
+ args.max_lag = int(probe["max_lag"])
494
+ args.image_size = int(probe["image_size"])
495
+ args.visual_scale = float(probe["visual_scale"])
496
+ args.num_workers = int(args.num_workers if args.num_workers is not None else probe["num_workers"])
497
+ args.precision = probe["precision"]
498
+ args.probe_device = args.probe_device or args.device
499
+
500
+ device = torch.device(args.device)
501
+ configure_training_runtime(device)
502
+ _model_config, model = build_flowmo(config["method"])
503
+ checkpoint_name = config["checkpoint_pattern"].format(seed=args.seed)
504
+ checkpoint = Path("experiments") / config["method"] / "checkpoint" / checkpoint_name
505
+ model.load_state_dict(torch.load(checkpoint, map_location="cpu"))
506
+ model.to(device)
507
+ if device.type == "cuda":
508
+ model.to(memory_format=torch.channels_last)
509
+
510
+ allowed_regimes = set(args.regimes or [regime["name"] for regime in config["regimes"]])
511
+ regimes = {}
512
+ for regime_index, regime in enumerate(config["regimes"]):
513
+ if regime["name"] not in allowed_regimes:
514
+ continue
515
+ regimes[regime["name"]] = run_regime(
516
+ model,
517
+ regime,
518
+ args,
519
+ int(probe["window_seed"]) + 1000 * regime_index,
520
+ )
521
+ if set(regimes) != allowed_regimes:
522
+ missing = sorted(allowed_regimes - set(regimes))
523
+ raise ValueError(f"unknown regimes requested: {missing}")
524
+
525
+ payload = {
526
+ "protocol_version": config["protocol_version"],
527
+ "method": config["method"],
528
+ "world_model_seed": args.seed,
529
+ "checkpoint": checkpoint_name,
530
+ "target_definitions": {
531
+ "flow_oldest": "flow at t-31",
532
+ "flow_context_mean": "mean flow at t-31,t-27,...,t-3",
533
+ "flow_history_mean": "mean flow over all 32 history states",
534
+ "flow_latest_context": "flow at t-3, the newest long-context token",
535
+ "flow_current": "flow at t",
536
+ },
537
+ "feature_sets": {
538
+ "z": "short-history latent",
539
+ "c": "long-history context",
540
+ "z_c": "concatenated learned state and context",
541
+ "position": "analysis-only current ground-truth position query",
542
+ "c_position": "context plus analysis-only current position query",
543
+ },
544
+ "probe": {
545
+ "train_windows": args.train_windows,
546
+ "eval_windows": args.eval_windows,
547
+ "eval_selection": "balanced contiguous episode blocks",
548
+ "ridge_alpha": args.ridge_alpha,
549
+ "mlp_epochs": args.mlp_epochs,
550
+ "mlp_batch_size": args.mlp_batch_size,
551
+ "mlp_hidden_dim": args.mlp_hidden_dim,
552
+ "mlp_learning_rate": args.mlp_learning_rate,
553
+ "mlp_seeds": args.mlp_seeds,
554
+ "max_lag": args.max_lag,
555
+ },
556
+ "regimes": regimes,
557
+ }
558
+ out = Path(args.out)
559
+ out.parent.mkdir(parents=True, exist_ok=True)
560
+ out.write_text(json.dumps(payload, indent=2, allow_nan=False))
561
+ print(json.dumps({"out": str(out), "regimes": list(regimes), "seed": args.seed}, indent=2))
562
+
563
+
564
+ if __name__ == "__main__":
565
+ main()
experiments/export_paper_artifacts.py CHANGED
@@ -175,8 +175,8 @@ def ensure_dir(path: Path) -> None:
175
  path.mkdir(parents=True, exist_ok=True)
176
 
177
 
178
- def trim_whitespace(img: Image.Image, pad_x: int = 8, pad_y: int = 0, threshold: int = 250) -> Image.Image:
179
- """Crop near-white border while preserving a small horizontal margin."""
180
  rgb = img.convert("RGB")
181
  pix = rgb.load()
182
  w, h = rgb.size
@@ -488,7 +488,7 @@ def extract_fig3() -> None:
488
  draw.rectangle([x, y, x + thumb_w, y + thumb_h], outline=(220, 220, 220), width=1)
489
 
490
  contact = fig_dir / "figure3_rollout_contact_sheet.png"
491
- trim_whitespace(canvas, pad_x=8, pad_y=0).save(contact)
492
 
493
  md_lines = [
494
  "# Figure 3 Provenance",
@@ -947,7 +947,7 @@ def make_fig4(summaries: list[SummaryRecord]) -> None:
947
  draw.line([xx, legend_y + 8, xx + 34, legend_y + 8], fill=METHOD_COLORS[method], width=5)
948
  draw.text((xx + 44, legend_y - 4), METHOD_LABEL[method], fill=(40, 40, 40), font=legend_font)
949
  out = fig_dir / "figure4_prediction_and_planning.png"
950
- trim_whitespace(canvas, pad_x=8, pad_y=0).save(out)
951
 
952
  md = [
953
  "# Paper Figure 4 Provenance",
@@ -1220,7 +1220,7 @@ def make_fig5(summaries: list[SummaryRecord]) -> None:
1220
  draw_failure_heatmap_panel(draw, (1162, 26, 2264, 540), rows, "triangle", "(B) Triangle")
1221
  draw_failure_colorbar_vertical(draw, (2310, 84, 2336, 518))
1222
  out = fig_dir / "figure5_failure_by_flow.png"
1223
- trim_whitespace(canvas, pad_x=8, pad_y=0).save(out)
1224
 
1225
  md = [
1226
  "# Paper Figure 5 Provenance",
 
175
  path.mkdir(parents=True, exist_ok=True)
176
 
177
 
178
+ def trim_whitespace(img: Image.Image, pad_x: int = 8, pad_y: int = 4, threshold: int = 250) -> Image.Image:
179
+ """Crop near-white border while preserving a small safety margin."""
180
  rgb = img.convert("RGB")
181
  pix = rgb.load()
182
  w, h = rgb.size
 
488
  draw.rectangle([x, y, x + thumb_w, y + thumb_h], outline=(220, 220, 220), width=1)
489
 
490
  contact = fig_dir / "figure3_rollout_contact_sheet.png"
491
+ trim_whitespace(canvas, pad_x=8, pad_y=4).save(contact)
492
 
493
  md_lines = [
494
  "# Figure 3 Provenance",
 
947
  draw.line([xx, legend_y + 8, xx + 34, legend_y + 8], fill=METHOD_COLORS[method], width=5)
948
  draw.text((xx + 44, legend_y - 4), METHOD_LABEL[method], fill=(40, 40, 40), font=legend_font)
949
  out = fig_dir / "figure4_prediction_and_planning.png"
950
+ trim_whitespace(canvas, pad_x=8, pad_y=4).save(out)
951
 
952
  md = [
953
  "# Paper Figure 4 Provenance",
 
1220
  draw_failure_heatmap_panel(draw, (1162, 26, 2264, 540), rows, "triangle", "(B) Triangle")
1221
  draw_failure_colorbar_vertical(draw, (2310, 84, 2336, 518))
1222
  out = fig_dir / "figure5_failure_by_flow.png"
1223
+ trim_whitespace(canvas, pad_x=8, pad_y=4).save(out)
1224
 
1225
  md = [
1226
  "# Paper Figure 5 Provenance",
experiments/flowmo/README.md DELETED
@@ -1,9 +0,0 @@
1
- # FlowMo: Flow-Momentum World Model
2
-
3
- FlowMo is the proposed Flow-Momentum World Model for surface vehicles under hidden external drift.
4
-
5
- Core idea:
6
-
7
- - Short-history latent state for endogenous state, momentum, and actuator response.
8
- - Long-history drift context for exogenous flow effects.
9
- - Context-conditioned residual transition for drift-aware rollout and planning.
 
 
 
 
 
 
 
 
 
 
experiments/flowmo/checkpoint/.gitkeep DELETED
File without changes
experiments/flowmo/checkpoint/paper_step_002000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:38463cec8d7f74e4a9a86d89c5fce27d90b43fda61ebd8638152576f88b58d39
3
- size 2671607
 
 
 
 
experiments/flowmo/checkpoint/paper_step_004000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ba39f4c57a5657efe598dbdc313f9b735828a7142e2d10dc6dc45405202b535c
3
- size 2671607
 
 
 
 
experiments/flowmo/checkpoint/paper_step_006000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:29cac4afc2bdf631dc7c55299cc4b2c9d1272ca0a38a11b9e1fb24164ca6913f
3
- size 2671607
 
 
 
 
experiments/flowmo/checkpoint/paper_step_008000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d2b5160539706e37fa5922b403397bbaa5f35604d0371fd131c20f5ca46fa5ff
3
- size 2671607
 
 
 
 
experiments/flowmo/checkpoint/paper_step_010000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:c492d5b94cecc770786d001e5337f158e2224efd9b492e3d4fb12b629b3426fd
3
- size 2671607
 
 
 
 
experiments/flowmo/checkpoint/paper_step_012000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3a808435660f116f9cb4e5770e359d39cf73f1b9988027f63856b90cae5307b8
3
- size 2671607
 
 
 
 
experiments/flowmo/checkpoint/paper_step_014000.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3e601ffaa390e20a517facf16806cb0132c99ac27e94b9f6582eff8dc7c5cc01
3
- size 2671607