Calibration & SysIDFEATURED STUDYProbe-Free B = Mab A + Mdb DAR(4) W(z) Pred: 0.703 vs selfRM 0.706 (0.4% err)Freq-Domain Integrator: 3.5% err (6× vs W(z))Blind DM2→DM1 Offload: cos 0.933 (80% 1-shot / 93% CL red.)ZPO Wind-Up Diagnosed< 0.5 s C Runtime

Closed-loop telemetry calibration of inter-WFS (Mab), inter-stage DM (Mdb), and virtual upstream DM2→DM1 offload (Mda_virt) matrices on Subaru AO3k + SCExAO + LLOWFS: live results, AR(p) whitening W(z) analysis, exact-window frequency-domain AO-dynamics solver, multi-rate Kalman-EM roadmap, and operational AO benefits.

Referenced Simulation Reports

Archived study runs (individual simulation pages retired; all plots, tables, and numerical findings preserved below):

ao3k_scexao_calib2wfs1dm ao3k_scexao_lowfs_closed ao3k_scexao_lowfs_open

Two-WFS + Inter-Stage DM Closed-Loop Telemetry Calibration Study

Key Takeaway: Passive closed-loop sky telemetry alone recovers probe-free Stage-2 optical gain diag(Mdb) within 0.4%–0.7% of active on-sky selfRM (under predictive control) and reconstructs the blind DM2 → DM1 offloading matrix Mda_virt to 0.933 median geometric cosine (80.4% single-shot / 93.2% 5-step closed-loop OPD RMS reduction, provably unconditionally stable across all 40 modes). Diagnosing why the AR(4) whitening filter W(z) still exhibits 21–23% bias under pure Modal Integrators led directly to a cleaner Exact-Window Frequency-Domain AO-Dynamics estimator that cuts pure-integrator error 6× (21–23% → 3.5–3.9%) and eliminates low-order LLOWFS/ZPO bias completely.

1. Two-Stage Optical Geometry & Closed-Loop Identification Problem

In a cascaded dual-stage adaptive optics instrument (such as Subaru AO3k + SCExAO), two wavefront sensors bracket an intermediate deformable mirror DM2 (D = aol2_modevalDM). Upstream WFS A (aol1_modevalWFS) measures the post-DM1 residual wavefront before DM2, while downstream WFS B (aol2_modevalWFS) measures the wavefront after DM2:

flowchart LR
    ATM["Atmosphere + DM1<br/>Post-Stage-1 Residual φ1"] --> A["WFS A (AO3k)<br/>1 kHz J-band PyWFS<br/>A = aol1_modevalWFS"]
    ATM --> SUM(("+"))
    DM2["Inter-Stage DM2 (SCExAO)<br/>D = aol2_modevalDM + aol3_dmC<br/>H2(z): 2.5 fr lag + 60 us servo"] --> SUM
    SUM --> B["WFS B (SCExAO)<br/>2 kHz Vis PyWFS<br/>B = aol2_modevalWFS"]
    B --> C2["Stage-2 Controller C2(z)<br/>Integrator or PSOL AR(p)"]
    C2 --> DM2
    A -. "Mab, Mdb, b0<br/>Mba, Mda_virt" .-> CAL["Telemetry System ID<br/>mlt.calib2wfs1dm / mlt.sysid"]
    B -.-> CAL
    DM2 -.-> CAL
    CAL -. "Mda_virt (DM2→DM1 Offload)<br/>diag(Mdb) (Optical Gain & ZPO)" .-> DM1["Stage-1 DM1 / Stage-2 ZPO"]

Over synchronized realizations (A, B, D), the optical measurements obey two coupled linear relations:

  1. Forward Optical Model: B[k] = Mab A[k] + Mdb D_eff[k] + b0 + v[k]
  1. Virtual Upstream Model (obtained by solving for A from (B, D)): A[k] = Mba B[k] - Mda_virt D_eff[k] + a0 + u[k]

Why Naive Closed-Loop Regression Fails by 50–67%

Even with zero regularization (reg = 1e-6), unwhitened ordinary least squares collapses diag(Mdb) from the true 0.69–0.71 down to 0.22–0.35 (50–67% attenuation bias). Direct inspection of the true residual e_col[k] = B[k] - Mab A[k] - Mdb_true D[k] on our telemetry reveals the exact closed-loop mechanism:

Telemetry Regime selfRM Truth Unwhitened OLS (reg=1e-6) Bias Residual e_col Lag-1 Autocorr corr(e_col, D) (Feedback Cancellation)
Integrator, LLOWFS OPEN (5 s) 0.684 0.233 -65.9% +0.505 -0.186
Integrator, LLOWFS CLOSED (5 s) 0.687 0.225 -67.3% +0.834 -0.393
PSOL AR(8) Predictive, clean 0-4 s 0.692 0.346 -50.0% +0.252 -0.197
PSOL AR(8) Predictive, full 5 s (+ZPO) 0.692 0.329 -52.5% +0.335 -0.245

Two physical effects compound at low frequencies (f < 20 Hz):


2. Implemented Approach (milk-mltools): Shared Causal AR(p) Whitening W(z) + Block Schur Solver

The baseline pipeline shipped in milk-mltools (mlt.calib2wfs1dm / mlt.sysid) implements a two-step regularized Schur-complement solver:

  1. Multi-rate synchronization: Chooses the slower WFS (1 kHz A) as reference, boxcar-averages B (window), and integrates DAC-held DM2 commands exactly over each exposure window via mlt.tlmsync .mode=expint while scanning causal plant lags lag_DB ∈ [1.0..3.5] fr to maximize held-out whitened R²_w.
  2. Step 1 — Shared scalar causal AR(p) whitening W(z): Fits a pooled causal AR(p) filter W(z) = 1 - sum_{k=1}^p a_k z^-k on unit-variance-normalized A and applies the identical scalar FIR filter to (A, B, D). Because scalar LTI filtering commutes with static matrices (Mab, Mdb), W(z)[B] = Mab W(z)[A] + Mdb W(z)[D] preserves the exact optical matrices while suppressing low-frequency collinearity (-18 dB at DC, +4.7 dB near Nyquist). Block-regularized diagonal-scaled Schur normal equations with 20-point contiguous temporal CV over (reg_A, reg_D) yield unbiased Mdb.
  3. Step 2 — Full-SNR pseudo-open-loop & virtual upstream refinement: Subtracts the calibrated DM contribution (B_OL = B - Mdb D) to refit Mab at full unwhitened SNR (avoiding high-frequency WFS-A noise attenuation), and solves the virtual upstream relation A = Mba B - Mda_virt D + a0 for DM2 → DM1 offloading.
Live Online Report 2x2 Calibration Summary
Live Online Report 2x2 Calibration Summary

Quantitative Sweeps: Whitening Order, Lag Landscape, Control Regimes & Convergence

AR(p) Whitening Sweep, Lag Surface, Control Regimes, and Sample-Size Convergence
AR(p) Whitening Sweep, Lag Surface, Control Regimes, and Sample-Size Convergence

(a) AR(p) Whitening Order Sweep (ao3k_scexao_calib2wfs1dm, lag_DB = 2.50 fr)

AR Order p Conditional Excitation eta_D diag(Mdb) (med) Rel. Err vs. selfRM (0.706) Held-Out R²_OL Algebraic Cross-Err
0 0.276 0.321 54.55% 0.576 0.299
1 0.928 0.641 9.18% 0.713 0.239
2 0.916 0.678 3.99% 0.715 0.251
4 0.911 0.703 0.37% 0.721 0.252
6 0.911 0.700 0.83% 0.721 0.257
8 0.910 0.700 0.88% 0.721 0.258

(b) Sample-Size Convergence (Stationary 0–4 s Window, < 0.5 s C Runtime per Fit)

Integration Time [s] Aligned Frames (1 kHz) diag(Mdb) (med) selfRM Err Held-Out R²_OL Held-Out R²_A DM2→DM1 Geom Cosine Cross-Err
0.5 s 496 0.699 0.93% 0.502 0.699 0.761 0.525
1.0 s 996 0.716 1.47% 0.719 0.785 0.824 0.360
1.5 s 1496 0.724 2.49% 0.756 0.832 0.868 0.314
2.0 s 1996 0.723 2.39% 0.790 0.828 0.887 0.293
3.0 s 2996 0.711 0.64% 0.811 0.851 0.912 0.273
4.0 s 3996 0.711 0.72% 0.817 0.856 0.933 0.236

Within just 1.0–2.0 seconds of sky telemetry, diag(Mdb) converges within 1.5–2.5% of active selfRM and Mda_virt exceeds 0.88 geometric cosine; by 4.0 seconds, R²_OL = 0.817 (minimum across all 40 modes = +0.676), R²_A = 0.856, and Mda_virt reaches 0.933 median column cosine.


3. Blind DM2 → DM1 Offload Performance & Stage-2/Stage-3 ZPO Wind-Up Diagnosis

Virtual DM2 to DM1 Offload Fidelity and Stage-2/Stage-3 ZPO Wind-Up Diagnosis
Virtual DM2 to DM1 Offload Fidelity and Stage-2/Stage-3 ZPO Wind-Up Diagnosis

Blind 2D DM2 → DM1 Wavefront Offloading (Zero Actuator Geometry Input)

Evaluating Mda_virt (trained purely from telemetry with zero knowledge of the 64×64 vs. 50×50 actuator grids, 60/46 pupil magnification, clocking, or registration) against the exact geometric projection M_geom over 2,400 held-out closed-loop frames (t = 2.8..4.0 s, 40 modes):

Offload Validation Metric (t = 2.8..4.0 s, 40 Modes) Measured Result Interpretation
Mda_virt vs. exact actuator geometry M_geom column cosine 0.933 (mean 0.928) All 40 modes in 0.86–1.00 (clean 0–4 s)
Amplitude scale ratio Mda_virt / M_geom 0.927 (IQR 0.031) Uniform WFS A / WFS B optical-gain ratio
Mean held-out 40-mode DM2 OPD RMS 25.2 nm Live closed-loop Stage-2 stroke
1-shot blind offload (Delta a_DM1 = Mda_virt · d) residual 4.9 nm 80.4% RMS / 96.2% variance reduction (geom floor 0.4 nm)
Peak snapshot (59.2 nm) → 1-shot / 5-iter closed-loop (g=0.5) 10.6 nm / 4.0 nm 82.1% / 93.2% RMS reduction
Closed-loop offload transfer eigenvalues Re(λ(M_loop)) [+0.778, +1.011] Strictly positive real across all 40 modes
Spectral radius ρ(I - g_off M_loop) at g_off = 0.5 / 0.2 0.585 / 0.834 Provably unconditionally stable leaky offloading

Root-Cause Diagnosis of the Low-Order Dips (Panel b)

The full-5s calibration (calib_2wfs1dm) showed anomalous negative test-split R²_A on modes 1, 4, and 17 and depressed diag(Mdb) on modes 0..3. Panel (b) exposes the exact physical cause — a real closed-loop control pathology detected by the calibration:


4. Critique of W(z) & Cleaner AO-Loop-Dynamics Calibration

While AR(4) whitening W(z) achieves < 0.7% error under PSOL predictive control, it is fundamentally a heuristic kludge with three measurable defects:

  1. Artificial noise coloring: WFS B photon/readout noise n_B[k] is natively white (E[D[k-τ] n_B[k]] = 0). Passing B through a causal AR(4) FIR (p = 4 ≥ τ = 2.5) colors n_B across lags 0..4, injecting feedback correlation between W(z)[D] and W(z)[n_B] while boosting WFS A high-frequency noise n_A by +4.7 dB (3× variance).
  2. 21–23% bias under pure Modal Integrators: Without predictive control injecting broadband DM2 motion (eta_D_raw = 0.06 vs. 0.21), a generic scalar W(z) still underestimates high-mode diag(Mdb) by 21–23% (0.54 vs. 0.69).
  3. Multi-rate timing & low-frequency ZPO leakage: Downsampling 2 kHz B onto 1 kHz A centered at t_A ignores the -0.25 ms exposure-midpoint offset between 1.0 ms (A) and 0.5 ms (B) integrations (Panel 4a), and W(z) does not fully reject < 15 Hz Stage-3 LLOWFS/ZPO wind-up (collapsing Tip/Tilt diag(Mdb) to 0.10–0.17).

Cleaner Drop-In Alternative: Exact-Window Frequency-Domain AO-Dynamics ID (No W(z))

Modeling the actual AO loop timing and frequency-domain dynamics replaces W(z) cleanly:

  1. Exact physical exposure-window alignment: WFS A integrates [t_A - 1.0 ms, t_A] (midpoint t_A - 0.50 ms), while WFS B integrates [t_B - 0.5 ms, t_B] (midpoint t_B - 0.25 ms). Averaging B centered at t_A - 0.5 dt_B (-0.25 ms) matches A's exact integration interval, with DM2 aligned at lag_DB = (0.5 + 2.5) dt_B = 3.0 dt_B.
  2. Frequency-domain cross-spectral regression across the loop crossover/waterbed band (20–480 Hz): Accumulate Welch cross-spectra S_AA(f), S_AD(f), S_DD(f), S_BA(f), S_BD(f) normalized per frequency bin by 1 / tr(S_AA(f)). Because Stage-2's closed-loop sensitivity S_2(f) = [I - Mdb H_2(f) C_2(f)]^-1 sweeps naturally in amplitude and phase from 20 Hz through the 60–200 Hz waterbed peak to 480 Hz, the loop dynamics themselves break collinearity — with zero time-domain FIR filter, zero noise coloring, and complete immunity to < 20 Hz ZPO/LLOWFS drift!
Beyond W(z): Multi-Rate Timing Signatures and Exact-Window Frequency-Domain AO-Dynamics Benchmark
Beyond W(z): Multi-Rate Timing Signatures and Exact-Window Frequency-Domain AO-Dynamics Benchmark

Live Head-to-Head Benchmark Across All 4 AO Control Regimes

Telemetry Regime selfRM Truth Unwhitened OLS AR(4) W(z) (Current) Exact-Window Freq-Domain [20-480 Hz] Tip/Tilt MAE (W(z) → Freq-Domain)
Integrator, LLOWFS OPEN (5 s) 0.684 0.233 (65.9%) 0.547 (20.1%) 0.708 (3.5%) 0.22 → 0.13
Integrator, LLOWFS CLOSED (5 s) 0.687 0.225 (67.3%) 0.535 (22.2%) 0.660 (3.9%) 0.36 → 0.03
PSOL AR(8) Predictive, clean 0-4 s 0.692 0.346 (50.0%) 0.711 (2.8%) 0.710 (2.7%) 0.14 → 0.10
PSOL AR(8) Predictive, full 5 s (+ZPO) 0.692 0.329 (52.5%) 0.703 (1.7%) 0.704 (1.7%) 0.24 → 0.09

Result: Switching from heuristic AR(4) W(z) to Exact-Window Frequency-Domain AO-Dynamics cuts pure-integrator optical-gain error 6× (21.1% → 3.5% open, 23.3% → 3.9% closed) and slashes Tip/Tilt MAE by 3–5× even with LLOWFS closed and during the t = 4.85 s ZPO wind-up.


5. Comprehensive Roadmap of Calibration Approaches

Panel (a) of Figure 4 also reveals a second dynamical signature at +1.50 ms: Stage-1 DM1 applying 1 kHz closed-loop steps (1.75 ms Stage-1 latency) directly into the optical beam seen by both WFS A and WFS B. Exploiting all known AO loop dynamics leads to a clear hierarchy of approaches:

Approach Core Principle Integrator Bias Predictive Bias Tip/Tilt & ZPO Immunity Faint-Star EIV (n_A) Handling Native Multi-Rate (1/2/0.5 kHz) Compute Cost Best Use Case
1. Causal AR(p) Whitening W(z) (shipped in mlt.sysid) Pooled scalar FIR W(z) on (A,B,D) + Schur CV 21–23% 0.4–0.7% Poor (TT ~ 0.10–0.47) Degraded (+4.7 dB noise boost) Downsampled to 1 kHz < 0.5 s Fast baseline under predictive control
2. Exact-Window Freq-Domain Cross-Spectral ID (benchmarked above) Exact [t_A-T_A, t_A] sync + Welch S(f) over [20–480 Hz] loop crossover 3.5–3.9% 1.7–2.7% Excellent (f < 20 Hz cut) Good (add Nyquist noise-floor EIV subtraction) Exact analytic H_AB(f), H_2(f) < 0.3 s (FFTW3) Recommended immediate C upgrade to mlt.sysid
3. Native Multi-Rate State-Space + Kalman-EM (Gold Standard) Fast 2 kHz latent φ_1[k] driven by exact noiseless DM1, DM2, DM3 DACs + async white-noise WFS A/B < 1–2% < 1% Exact (DM3 + zpo-2 modeled!) Exact (M-step uses posterior cov P[k|T]) Exact (zero interpolation!) 2–5 s Faint guide stars & unified LQG predictive control
4. Known-Controller Output-Error / Parametric ETF Fit S_2(f; Mdb) = [I - Mdb H_2(f) C_2(f)]^-1 Mab directly using known mfilt gains Low (when H_AB & R_A modeled) Low High Sensitive unless R_A modeled Native 2 kHz 1–2 s Single-stage gain verification & latency audit
5. Recursive Online EWLS / Sliding-Window Freq-ID Exponentially-weighted update of S(f) or Schur Gramians every 1–2 s Same as #2 Same as #2 Excellent (with MAD gating) Good Same as #2 < 5 ms/update Continuous all-night optical-gain & NCPA tracking
6. Zero-Contrast Excitation Levers (Ljung Thm. 13.1) Brief ±20% gain2 switch (2 s) or 1–2 nm RMS broadband DM2 micro-dither (< 10^-7 contrast) < 1% (exact IV) < 1% (exact IV) Exact Immune (dither is uncorrelated with n_A, n_B) Exact < 0.2 s Faint stars / pure integrators needing absolute zero-bias truth

Why Multi-Rate State-Space Kalman-EM (Approach 3) Is the Ultimate Architecture

Formulated natively on the fast 2 kHz (0.5 ms) clock:

In this model, n_A and n_B stay strictly white (never distorted by an FIR filter), the Kalman smoother posterior covariance P[k|T] provably eliminates Errors-in-Variables attenuation from WFS A photon noise on faint guide stars, Stage-1 DM1 steps provide free noiseless broadband excitation seen by both sensors, and the converged parameters (Φ, Mab, Mdb, R_A, R_B) immediately serve as the LQG predictive state-space controller.


6. Operational Benefits & Advanced Two-Stage AO Capabilities Enabled

Having continuous, probe-free estimates of (Mab, Mdb, Mba, Mda_virt, b0) unlocks five high-value capabilities directly inside CACAO / SCExAO:

  1. Blind, Drift-Immune DM2 → DM1 Stroke Offloading (Mda_virt):
  1. Probe-Free On-Sky PyWFS Optical Gain Tracking & ZPO Wind-Up Prevention (diag(Mdb)):
  1. Inter-Stage Feedforward & Joint Two-Stage Predictive Control (Mab, Mda_virt):
  1. Real-Time Inter-Stage NCPA & Chromatic/Petal Monitoring (b0, R²_A):
  1. Automated Registration Drift & Closed-Loop Health Diagnostics (Mab, Mda_virt, Mdb):

Reproducibility & GitHub Provenance

All results, figures, CSV summaries, and JSON diagnostics on this page are generated directly from real closed-loop CACAO + cacaosim + milk-mltools telemetry:

cd ~/src/cacao-work && source env.sh

# 1. Run closed-loop AO3k + SCExAO simulation with --calib-2wfs1dm enabled
./scripts/run-ao3k-scexao.sh --seeing 0.60 --phys-time 5.0 --load-rm _work/ao3k_scexao_rm \
    --predictive --calib-2wfs1dm --save-telemetry speckle --outdir _work/ao3k_scexao_calib2wfs1dm

# 2. Compile this comparative 2-WFS + 1-DM Calibration Technical Study (figures + CSV + JSON)
${PYTHON_BIN} ./scripts/build-calib-2wfs1dm-report.py

# 3. Stage static website locally (or omit --build-only to deploy to Firebase Hosting)
./scripts/publish-ao-report.sh --build-only _work/calib_2wfs1dm_report

Machine-Readable Artifacts

Interactive Report Dataset Explorer

Dataset Explorer Interactive Report Dataset Explorer

Telemetry & Data Files