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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
{
  "schema_version": 1,
  "model": "FUSE-EFIT",
  "protocol": "in era (random split of shots 125500-205774; DECISIONS D50, D55)",
  "form": "single",
  "form_meaning": "single: replicate 0 of the in-era finals, the frozen delivered network",
  "members": [
    {
      "run": "runs/FULLextfinal_era_r0",
      "replicate": 0,
      "seed": 100,
      "checkpoint_sha256": "28390d5950ec18477394a85dc73498afa0f847502514251b7c96c97569632d96",
      "config_sha256": "ddec260834c0f5fdaa5303382140e9c0bca1e3028ccd478c2c2a65f62d6f2398",
      "trained_code_sha256": "1095cd5859ce819840f3e35ead3243d28aae832dbd3f54b04b90d98330493290"
    }
  ],
  "cadence": {
    "period_ms": 50.0,
    "hz": 20,
    "rule": "one step-graph call per 50 ms of simulated time; each tick describes the trailing interval (t - 50 ms, t]; reset the state to zeros at the start of every shot"
  },
  "inputs": {
    "inputs": {
      "shape": [
        "batch",
        25
      ],
      "dtype": "float32",
      "names": [
        "pinj",
        "tinj",
        "ech_mw",
        "gasa_cal",
        "gasb_cal",
        "gasc_cal",
        "gasd_cal",
        "gase_cal",
        "bt",
        "ip",
        "aminor",
        "rsurf",
        "zsurf",
        "kappa",
        "tritop",
        "tribot",
        "drsep",
        "rvsout",
        "gapin",
        "rvsou",
        "rvsiu",
        "shafranov",
        "zeta_ou",
        "zeta_ol",
        "vloop"
      ],
      "units": {
        "pinj": "MW",
        "tinj": "N m",
        "ech_mw": "MW",
        "gasa_cal": "Torr L/s",
        "gasb_cal": "Torr L/s",
        "gasc_cal": "Torr L/s",
        "gasd_cal": "Torr L/s",
        "gase_cal": "Torr L/s",
        "bt": "T",
        "ip": "MA",
        "aminor": "m",
        "rsurf": "m",
        "zsurf": "m",
        "kappa": "dimensionless",
        "tritop": "dimensionless",
        "tribot": "dimensionless",
        "drsep": "m",
        "rvsout": "m",
        "gapin": "m",
        "rvsou": "m",
        "rvsiu": "m",
        "shafranov": "m",
        "zeta_ou": "dimensionless",
        "zeta_ol": "dimensionless",
        "vloop": "V"
      },
      "sources": {
        "pinj": "PtData bmspinj: neutral-beam injected power, all sources",
        "tinj": "PtData bmstinj: neutral-beam injected torque",
        "ech_mw": "MDSplus \\RF::ECHPWRC: calibrated total ECH power injected",
        "gasa_cal": "MDSplus NEUTRALS GASFLOW.GASA:FLOW: calibrated gas flow, valve A",
        "gasb_cal": "MDSplus NEUTRALS GASFLOW.GASB:FLOW: calibrated gas flow, valve B",
        "gasc_cal": "MDSplus NEUTRALS GASFLOW.GASC:FLOW: calibrated gas flow, valve C",
        "gasd_cal": "MDSplus NEUTRALS GASFLOW.GASD:FLOW: calibrated gas flow, valve D",
        "gase_cal": "MDSplus NEUTRALS GASFLOW.GASE:FLOW: calibrated gas flow, valve E",
        "bt": "PtData bt: vacuum toroidal field, signed",
        "ip": "PtData ip: measured plasma current (amperes / 1e6)",
        "aminor": "EFIT01 AMINOR: minor radius",
        "rsurf": "EFIT01 RSURF: major radius of the boundary's geometric centre",
        "zsurf": "EFIT01 ZSURF: height of the boundary's geometric centre",
        "kappa": "EFIT01 KAPPA: elongation",
        "tritop": "EFIT01 TRITOP: upper triangularity",
        "tribot": "EFIT01 TRIBOT: lower triangularity",
        "drsep": "EFIT01 DRSEP: separatrix separation at the outer midplane, clipped to +-0.1 m per slice",
        "rvsout": "EFIT01 RVSOUT: major radius of the outer (lower) strike point",
        "gapin": "EFIT01 GAPIN: inner gap",
        "rvsou": "EFIT01 RVSOU: major radius of the upper outer strike point",
        "rvsiu": "EFIT01 RVSIU: major radius of the upper inner strike point",
        "shafranov": "EFIT01 R0 - RSURF: Shafranov shift",
        "zeta_ou": "Luce squareness, outer-upper quadrant, from the EFIT01 boundary vertices",
        "zeta_ol": "Luce squareness, outer-lower quadrant, from the EFIT01 boundary vertices",
        "vloop": "PtData VLOOP: loop voltage"
      },
      "grid_rule": {
        "pinj": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "tinj": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "ech_mw": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "gasa_cal": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "gasb_cal": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "gasc_cal": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "gasd_cal": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "gase_cal": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "bt": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "ip": "plain mean of the three newest 20 ms samples at or before the tick, after a causal low-pass and hold onto 20 ms (INPUT_CONTRACT 3.1)",
        "aminor": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "rsurf": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "zsurf": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "kappa": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "tritop": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "tribot": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "drsep": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "rvsout": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "gapin": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "rvsou": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "rvsiu": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "shafranov": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "zeta_ou": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "zeta_ol": "mean of the per-slice values of the EFIT01 slices in (t - 50 ms, t] (INPUT_CONTRACT 3.2)",
        "vloop": "mean of the native samples in (t - 50 ms, t] (INPUT_CONTRACT 3.3)"
      },
      "zeroed_when_indicator_is_0": {
        "pinj": [],
        "tinj": [],
        "ech_mw": [],
        "gasa_cal": [],
        "gasb_cal": [],
        "gasc_cal": [],
        "gasd_cal": [],
        "gase_cal": [],
        "bt": [],
        "ip": [],
        "aminor": [
          "efit_valid"
        ],
        "rsurf": [
          "efit_valid"
        ],
        "zsurf": [
          "efit_valid"
        ],
        "kappa": [
          "efit_valid"
        ],
        "tritop": [
          "efit_valid"
        ],
        "tribot": [
          "efit_valid"
        ],
        "drsep": [
          "efit_valid"
        ],
        "rvsout": [
          "efit_valid",
          "rvsout_present"
        ],
        "gapin": [
          "efit_valid"
        ],
        "rvsou": [
          "efit_valid",
          "rvsou_present"
        ],
        "rvsiu": [
          "efit_valid",
          "rvsiu_present"
        ],
        "shafranov": [
          "efit_valid"
        ],
        "zeta_ou": [
          "efit_valid"
        ],
        "zeta_ol": [
          "efit_valid"
        ],
        "vloop": [
          "vloop_valid"
        ]
      },
      "note": "Physical units, contract order (docs/INPUT_CONTRACT.md \u00a72). Where a governing indicator is 0 the value is ignored (any number, or NaN). NaN anywhere is read as the training mean, so never pass NaN for a value you have."
    },
    "indicators": {
      "shape": [
        "batch",
        5
      ],
      "dtype": "float32",
      "values": "0 or 1, per tick",
      "names": [
        "efit_valid",
        "vloop_valid",
        "rvsout_present",
        "rvsou_present",
        "rvsiu_present"
      ],
      "meaning": {
        "efit_valid": "1 when at least one usable EFIT slice lies in (t - 50 ms, t]; 0 otherwise",
        "vloop_valid": "1 when at least one loop-voltage sample lies in (t - 50 ms, t]; 0 otherwise",
        "rvsout_present": "1 when at least one slice in the window has a real outer strike point; 0 otherwise",
        "rvsou_present": "1 when at least one slice in the window has a real upper outer strike point; 0 otherwise",
        "rvsiu_present": "1 when at least one slice in the window has a real upper inner strike point; 0 otherwise"
      }
    },
    "available": {
      "shape": [
        "batch",
        25
      ],
      "dtype": "float32",
      "values": "0 or 1, per shot",
      "names": [
        "pinj",
        "tinj",
        "ech_mw",
        "gasa_cal",
        "gasb_cal",
        "gasc_cal",
        "gasd_cal",
        "gase_cal",
        "bt",
        "ip",
        "aminor",
        "rsurf",
        "zsurf",
        "kappa",
        "tritop",
        "tribot",
        "drsep",
        "rvsout",
        "gapin",
        "rvsou",
        "rvsiu",
        "shafranov",
        "zeta_ou",
        "zeta_ol",
        "vloop"
      ],
      "default": 1,
      "note": "1 = a usable record of this channel exists for the shot (the normal case). 0 = no record for the whole shot: the value is ignored and the model receives the flag, as it did in training for missing records. Keep it constant within a shot."
    }
  },
  "outputs": {
    "predictions": {
      "shape": [
        "batch",
        9
      ],
      "dtype": "float32",
      "names": [
        "ne",
        "te_ped",
        "ti_ped",
        "t_rot_ped",
        "ne_knee",
        "te_knee",
        "rho_sym",
        "ne_top_loc",
        "hmode"
      ],
      "units": {
        "ne": "1e19 m^-3",
        "te_ped": "keV",
        "ti_ped": "keV",
        "t_rot_ped": "krad/s",
        "ne_knee": "1e19 m^-3",
        "te_knee": "keV",
        "rho_sym": "rho (normalised radius)",
        "ne_top_loc": "rho (normalised radius)",
        "hmode": "probability in [0, 1]"
      },
      "meaning": {
        "ne": "electron density at rho = 0.85",
        "te_ped": "electron temperature at rho = 0.85",
        "ti_ped": "ion temperature at rho = 0.85",
        "t_rot_ped": "toroidal rotation at rho = 0.85",
        "ne_knee": "electron density on the pedestal fit at its knee (H-mode only)",
        "te_knee": "electron temperature on its pedestal fit at its knee (H-mode only)",
        "rho_sym": "symmetry point of the density pedestal fit (H-mode only)",
        "ne_top_loc": "knee (pedestal top) of the density pedestal fit (H-mode only)",
        "hmode": "the plasma is in H-mode (sigmoid of the averaged or single logit)"
      }
    },
    "hmode_gated_heads": [
      "ne_knee",
      "te_knee",
      "rho_sym",
      "ne_top_loc"
    ],
    "hmode_gated_note": "Trained on H-mode ticks only and undefined in L-mode; the graph emits a number anyway. Report them only where predictions[hmode] >= threshold; otherwise treat them as undefined, never as 0.",
    "hmode_thresholds": {
      "frozen": {
        "balanced": 0.54,
        "conservative": 0.5
      },
      "definitions": {
        "balanced": "maximum Youden's J on validation (the best trade between missed H-mode and admitted L-mode ticks)",
        "conservative": "the lowest threshold keeping L-mode ticks at or below 5 % of admitted validation ticks"
      },
      "set_on": "replicate 0, in-era validation split",
      "source": "receipts/G5_freeze.md section 3; receipts/G5_freeze.json gate_thresholds.era",
      "freeze_record_sha256": "1fbd776750736a6995a5de48b74b16bc13e0a2a1539972e46be23e8dbb49316e",
      "note": "Gate the four H-mode-only heads on predictions[hmode] >= threshold; MODEL_CARD.md \u00a76."
    }
  },
  "graphs": {
    "step": {
      "file": "fuse_efit_single_step.onnx",
      "purpose": "one 50 ms tick per call; unbounded shot length",
      "inputs": {
        "inputs": [
          "batch",
          25
        ],
        "indicators": [
          "batch",
          5
        ],
        "available": [
          "batch",
          25
        ],
        "conv_state": [
          6,
          "batch",
          1792,
          3
        ],
        "ssm_state": [
          6,
          "batch",
          12,
          128,
          64
        ]
      },
      "outputs": {
        "predictions": [
          "batch",
          9
        ],
        "conv_state_out": [
          6,
          "batch",
          1792,
          3
        ],
        "ssm_state_out": [
          6,
          "batch",
          12,
          128,
          64
        ]
      }
    },
    "sequence": {
      "file": "fuse_efit_single_sequence.onnx",
      "seq_len": 256,
      "purpose": "a whole window of exactly seq_len ticks; right-pad a shorter shot (any finite values, indicators 1) and keep the first K outputs, which is exact because the model is causal; use the step graph for longer shots",
      "inputs": {
        "inputs": [
          "batch",
          256,
          25
        ],
        "indicators": [
          "batch",
          256,
          5
        ],
        "available": [
          "batch",
          25
        ]
      },
      "outputs": {
        "predictions": [
          "batch",
          256,
          9
        ]
      }
    }
  },
  "state": {
    "conv_state": [
      "n_members x n_layers",
      "batch",
      1792,
      3
    ],
    "ssm_state": [
      "n_members x n_layers",
      "batch",
      12,
      128,
      64
    ],
    "leading_axis": 6,
    "n_members": 1,
    "n_layers": 6,
    "initial": "all zeros at the start of every shot",
    "bytes_per_shot": 2488320,
    "note": "Opaque: store what the step graph returns and pass it back on the next call. The two forms differ only in the leading axis of these two tensors."
  },
  "architecture": {
    "family": "Mamba-2 state-space sequence model",
    "d_model": 768,
    "n_layers": 6,
    "d_state": 64,
    "d_conv": 4,
    "expand": 2,
    "headdim": 128,
    "nheads": 12,
    "ngroups": 2,
    "d_inner": 1536,
    "conv_dim": 1792,
    "chunk_size": 100,
    "n_inputs_trunk": 30,
    "n_params_per_member": 22882785,
    "n_members": 1
  },
  "input_transform": {
    "clip_sigma": 20.0,
    "std_floor": 1e-06,
    "file": "norms.json",
    "applied": "inside the graphs"
  },
  "dtype": "float32",
  "onnx_opset": 17,
  "documentation": "docs/EXPORT.md, docs/INPUT_CONTRACT.md, MODEL_CARD.md"
}