2-Stage Passive 2WFS1DM Online Calibration
Probe-free Differenced Lagged-A 2SLS calibrating Stage-2 OG, ZPO, and DM2->DM1 offload.
Overview & Role
Uses natural Stage-1 turbulence leakage as a zero-contrast-hit instrumental variable in native C (milk-fpsexec-mlt-sysid, .method=ivdiff): exposure-overlap alignment, jitter-immune nearest_idx counter pairing, NA=160 plate DM1 projection, optional Stage-2 H_eff DM2 kernel ingestion, circular block bootstrap SEs, and < 5% usable_ok health gating.
Pure-MILK mlt.apply2wfs1dm applies outlier-clamped per-mode aol2_mWFSfact (with .psol_safety=0.90 and scalar comp.WFSfact=1.0 reset) and updates Stage-2 acquWFS-2.WFSzpogain = 0.95 * g_med, plus solves level-IV Mda_virt for blind offload.
Compute Units / Entry Points: milk-fpsexec-mlt-sysidmlt.apply2wfs1dm
Verified Highlights:
- 4.66e-8 C-vs-Py parity; 0.8-3.3% live unmodulated Stage-2 OG err; 6.6x less ZPO fightback
Option Variants (CODE/OPT)
| Option Code | Behavior & Usage | Main Flags |
|---|---|---|
2WFS/IV | Default Differenced Lagged-A 2SLS (`ivdiff`) with overlap alignment & health gate. | --live-2wfs1dm-sec --sysid-modes --clock-skew-us |
2WFS/W | Legacy AR(p) temporal whitening estimator (`whiten`) retained for comparison. | --sysid-whiten-order |
Dependencies & Calibration Chain
CLI Flags, Environment Variables & FPS Parameters
| Layer | Option (Links to Reference) | Default | Description |
|---|---|---|---|
| CLI Flag | --live-2wfs1dm-sec | 0 | Capture live Stage-2 2WFS1DM ivdiff burst [s] and apply via mlt.apply2wfs1dm |
| CLI Flag | --sysid-modes | 40 | Leading Stage-2 modes solved in --calib-2wfs1dm system identification |
| CLI Flag | --sysid-whiten-order | 4 | Causal AR(p) temporal whitening filter order W(z) for --calib-2wfs1dm |
| CLI Flag | --clock-skew-us | — | Stage-2 WFS clock trigger offset [us] relative to Stage 1 |
| CACAO_* Env | CACAO_WFSZPO_GAIN | 1.0 | Optical-gain scaling factor applied to WFS zero-point offset (wfszpo) |
Implementation, Tests & Related Reports
Source Files
- milk-mltools:
mltools/sysid_iv.c - milk-mltools:
mltools/sysid_unit.c - milk-mltools:
mltools/commands.d/mltools.bash
Verification Tests
test_14_calib2wfs1dm_live.pytest_07_calib_2wfs1dm.pytest_mltools_e2e.py