Hardware & DMFEATURED STUDYFinal Z4: -33.1 -> +1.1 nm (99.9% var cut)Full 10s WFE: 93.0 -> 91.9 nm (Stg2 beats Stg1)Vis Strehl: 48.8% -> 55.8% (+7.0%)NIR H Strehl: 84.2% -> 86.9% (+2.8%)

Physical characterization, mitigation trade study, native real-time CACAO implementation (acquireWFSim.c), and two-stage closed-loop verification of the unmodulated Pyramid WFS (mod = 0 l/D) nonlinear even-order bias on Subaru AO3k + SCExAO. Demonstrates the exact rank-1 (1 - S) diffraction-washout law driving stacked Z4 + Z11 static bias across both unmodulated stages, compares 4 live alpha(t) estimators and 3 calibration/actuation architectures, and verifies native outer diffraction-cross projection (E2) + pixel-space dynamic reference blending with 128-poke symmetric DM calibration.

Referenced Simulation Reports

SimulationPost-AO3k WFEFinal WFEVis SRH SRCoro 3-10 l/DSub-Pages
★ DEFAULT ao3k_scexao_2stage_opt_ttm1hz104.7 nm99.4 nm48.48%83.96%2.63e-04
★ STAGE 1 ao3k_stage1217.2 nm217.2 nm41.87%79.06%3.19e-04

Unmodulated Pyramid WFS Nonlinear Bias: Physics, Mitigation & Real-Time CACAO Implementation

Scope: End-to-end physical characterization, mitigation strategy comparison, native real-time CACAO implementation (acquireWFSim.c), and two-stage closed-loop verification of the unmodulated Pyramid Wavefront Sensor (mod = 0 λ/D) nonlinear even-order (O(φ²)) bias on the Subaru 7.95 m AO3k + SCExAO polychromatic bench (1.22 μm Stage-1 J-band PyWFS + 0.75 μm Stage-2 Visible PyWFS, both strictly unmodulated with ENABLE_LOWFS = 0). Every quantitative figure below is paired with a downloadable CSV dataset or full simulation report.


Executive Summary & Headline Findings

  1. Zero-Mean Turbulence Creates a Deterministic, Rank-1 False Z4 + Z11 Bias on an Unmodulated PyWFS:
  1. Outer Diffraction-Cross Projection (E2) + Pixel-Space Dynamic Reference Blending Beats All Alternatives:
  1. Closed-Loop DEFAULT Two-Stage Verification: Stage-2 SCExAO Cleanly Beats Stage-1 AO3k Across the Full 10 s Run:

1. Optical Mechanism: How Zero-Mean Turbulence Drives False Z4 + Z11

To isolate the pure even-order (O(φ²)) nonlinearity of the unmodulated PyWFS with zero finite-sample odd-term noise, we propagate 64 antithetic Kolmogorov phase-screen pairs (+φ_k and −φ_k, so ⟨φ⟩ = 0 identically at every pupil pixel) through the exact polychromatic cacaosim Visible PyWFS optical model (0.75 μm, 20% BW, 5 spectral channels, Subaru 7.95 m pupil with 30.7% central obstruction and V-spiders).

Unmodulated PyWFS Nonlinear Bias Optical Mechanism
Unmodulated PyWFS Nonlinear Bias Optical Mechanism

Physical breakdown of Figure 1:


2. Exact (1 − S) Rank-1 Law & Modulation Scaling

Sweeping circular modulation radius (0, 1, 2, 3, 5 λ/D) and zero-mean Kolmogorov WFE (20–200 nm RMS) on the polychromatic 0.75 μm Subaru PyWFS confirms that the bias is strictly rank-1 across the entire operating regime.

Static + 3D Modulation Suppression and Exact (1 - S) Rank-1 Scaling
↓ Static PNG
Modulation Suppression and Exact (1 - S) Rank-1 Scaling
Modulation Suppression and Exact (1 - S) Rank-1 Scaling

Download Figure 2 graph data: fig2_modulation_scaling.csv (40 grid points: 5 modulation radii 0–5 λ/D × 8 WFE amplitudes 20–200 nm, reporting 1 − S, open-loop Z4/Z11 bias, and outside-pupil flux fractions f_out_0, f_out, Δf_out).

Quantitative Rank-1 Properties (0.75 μm, mod = 0 λ/D)

Metric Measured Value Physical Implication
Rank-1 spatial invariance (20 vs. 150 nm RMS) r = +0.9992 Bias image pattern is essentially fixed; only a single scalar amplitude α(t) varies
Pure high-order turbulence (k > 8 c/D, 0 nm Z4/Z11 in) r = +0.9917, Z4_lin = +12.4 nm Uncorrected high-order fitting/servo error alone generates false low-order Z4 + Z11
Flat-wavefront template match (I_geom − I_0, mod = 5 vs 0) r = +0.9889 Bias pattern is a pure optical property of the pyramid edges and pupil geometry
Exact (1 − S) proportionality (20–200 nm RMS) Z4_lin / (1 − S) = 30.8 ± 0.5 nm ⟨I(φ)⟩ − I_0 ≈ (1 − S) · (I_geom − I_0) holds from S = 0.97 down to S = 0.06
Live outer-flux proxy Δf_out = f_out_0 − f_out r > 0.999 with (1 − S) Directly observable on every WFS frame without knowing the wavefront phase

Modulation Suppression at σ = 80 nm RMS (0.75 μm, 1 − S = 0.362)

Modulation Radius f_out(φ=0) Δf_out(80 nm) Open-Loop Z4 Bias [nm] Open-Loop Z11 Bias [nm] Relative to mod = 0
0 λ/D (Unmodulated) 37.53% 11.61% +9.75 +4.05 1.00×
1 λ/D 16.89% 4.91% +5.70 +2.28 0.58×
2 λ/D 11.30% 2.95% +1.99 +3.01 0.20× (Z4) / 0.74× (Z11)
3 λ/D 7.88% 1.77% +2.10 +2.00 0.21× (Z4) / 0.49× (Z11)
5 λ/D 5.56% 1.01% +1.28 +0.70 0.13×

Why Closed-Loop Bias Is Amplified (~1 / g_opt): Under turbulence, the unmodulated PyWFS optical gain drops to g_opt ≈ 0.55–0.70 (0.75–1.22 μm). To zero the biased WFS signal g_opt · Z4_DM + Z4_lin = 0, the closed-loop integrator drives the DM to Z4_CL ≈ −Z4_lin / g_opt — nearly 1.8× larger than the open-loop linear projection! Modulating the pyramid to 3–5 λ/D reduces the bias but sacrifices ~3×–5× of unmodulated sensitivity for faint stars and high-contrast speckle sensing; real-time reference compensation removes the bias while retaining 100% of the unmodulated sensitivity.


3. Direct Signature in the Baseline DEFAULT Two-Stage Simulation

Inspecting the baseline DEFAULT simulation (ao3k_scexao_2stage_opt_ttm1hz prior to dynamic bias compensation, with both Stage-1 J-band PyWFS and Stage-2 Vis PyWFS at mod = 0 λ/D and LLOWFS open) confirms that this mechanism was the dominant root cause of Stage-2 SCExAO's static degradation.

DEFAULT Two-Stage Simulation Evidence of Stacked Unmodulated PyWFS Bias
DEFAULT Two-Stage Simulation Evidence of Stacked Unmodulated PyWFS Bias

4. Mitigation Strategy Comparison & Design Selection

The rank-1 law ΔI_bias(t) ≈ α(t) · ΔI separates mitigation into three orthogonal engineering decisions: (1) how to estimate the scalar α(t) = 1 − S(t) on every frame, (2) how to calibrate the template ΔI, and (3) where in the CACAO real-time pipeline to apply −α(t) · ΔI.

Quantitative Evaluation of Unmodulated PyWFS Bias Mitigation Strategies
Quantitative Evaluation of Unmodulated PyWFS Bias Mitigation Strategies

Download Figure 4 graph data: fig4_mitigation_strategies.csv (side-by-side accuracy, odd Z4 cross-talk, petal/TT/scintillation stress tests, photon-noise jitter at mV = 6 & mV = 12, and DEFAULT live tracking correlation for E1–E4).

4.1 Live α(t) Estimator Comparison (80 nm Calibrated Template)

Criterion E1: df_pup (Pupil Flux Fraction) E2: Outer Diffraction-Cross Projection (Recommended) E3: In-Mask Common-Mode S_sum E4: In-Mask S_sum + S_diag
Residual Z4 (20–120 nm WFE) +0.1 to −1.1 nm +0.05 to −0.92 nm (95–100% cut) +0.0 to −0.1 nm +0.0 to −0.1 nm
Odd Z4 cross-talk Δα (±30 nm) −0.075 (medium) +0.009 (10×–16× cleaner!) +0.104 (high) +0.138 (cuts true Z4 gain 13%)
0.5-wave Petal (raw +22.0 nm) +4.2 nm −2.6 nm (−0.3 nm w/ 200 nm tpl) +4.4 nm +2.6 nm
TT +50 nm / 15% Scint / Hi-ord k > 8 −1.8 / −0.1 / −0.1 nm −2.5 / −0.1 / +0.0 nm −1.1 / +0.2 / −0.1 nm −1.0 / +0.1 / −0.1 nm
Single-frame jitter (mV = 6, 124k ph) 0.4 nm/fr 0.3 nm/fr (0.03 nm w/ 50 ms EMA) 0.4 nm/fr 0.5 nm/fr
Faint star (mV = 12, 500 ph, unclipped) 5.2 nm/fr 4.7 nm/fr (0.47 nm w/ 50 ms EMA) — —
DEFAULT live tracking r(α, 1 − S) +0.618 +0.674 (highest) +0.593 +0.638
Key risk / caveat Zero-clipping RON biases sum(I) at faint mV Requires unclipped dark-sub imWFS0 outside wfsmask 6.3% odd Z4 leakage into S_sum attenuates true Z4 14.3% odd Z4 leakage (S_sum + S_diag)

Why E3 (S_sum) and E4 (S_sum + S_diag) Have Strong Odd Z4 Cross-Talk: In a purely geometric PyWFS, slopes are odd across opposite pupils and orthogonal to the 4-quadrant sum S_sum = Q0 + Q1 + Q2 + Q3. On an unmodulated diffractive PyWFS, however, pure +Z4 defocus shifts coherent light asymmetrically across the sharp central-obstruction and outer rims, creating a 6.3% linear S_sum and 8.1% linear S_diag projection inside wfsmask. In contrast, E2 projects onto the disjoint outside-wfsmask diffraction cross, where +Z4 and −Z4 produce nearly identical even intensity loss (odd Δα = +0.009), leaving true defocus control completely unperturbed!

4.2 Template Calibration Source (ΔI = I_ref_hi − I_0)

Template Source Optimal Z4 Residual (80 nm) Optimal Z11 Residual Full-Pixel Residual Hardware Requirement
mod = 5 λ/D flat reference −0.10 nm (99.1% cut) +0.03 nm (99.2%) 14.9% Modulator during calibration
mod = 10 λ/D flat reference −0.02 nm (99.8% cut) −0.01 nm (99.7%) 9.8% Modulator during calibration
DM high-order random pokes (85–140 nm) +0.00..+0.09 nm (99.2–100%) 0.00..+0.01 nm 6.8% (best) None (DM only; works on any PyWFS)

4.3 Real-Time Pipeline Injection Architecture

Architecture g_opt Immunity Modes Cancelled Conflict w/ LLOWFS (aol2_wfszpo)? Downstream Cleanliness
1. Pixel-Space Dynamic wfsref in acquireWFSim.c (Selected) Exact (100% immune) All (Z4, Z11, Z22 + radial/spider) None (wfszpo stays 100% for LLOWFS) Best (imWFS2/3, pyrwfstlm, modalwhite all clean)
2a. Existing Pixel aolN_wfszpo Broken (WFSzpogain = 0.95 · g_opt mis-scales it) All Collides with Stage-3 LLOWFS Clean imWFS2
2b. Modal WFS Feedforward (mvalWFS − α · v_bias) Exact (100% immune) Controlled CM modes only None imWFS2 stays biased
2c. Modal DM ZPO (mfilt modevalDM) Poor (must divide by mode-dependent g_opt) Controlled CM modes only None imWFS2 & modevalWFS stay biased

5. Native CACAO Real-Time Implementation & 128-Poke Calibration

5.1 Real-Time acquireWFSim.c Kernel (cacao/AOloopControl_IOtools/acquireWFSim.c)

Dynamic reference compensation is built natively into AOloopControl_IOtools_acquireWFSim_RUN() at zero extra latency (< 2 μs/frame) using three optional SHM templates (aol<N>_wfsref_full, aol<N>_wfsbias_in, aol<N>_wfsbias_out) and runtime FPS parameters (FPFLAG_WRITERUN):

  1. Unclipped Outer-Cross Dot Product (on imWFS0, prior to wfsmask clipping):
  1. Clamping & Exponential Moving Average:
  1. Pixel-Space Dynamic Reference Subtraction (inside wfsmask):

5.2 Smooth 128-Poke 8-Fold Symmetric DM Calibration (calib_wfs_bias.py)

Naive random modal pokes suffer from finite-sample speckle asymmetry (asym ≈ 0.25) and sharp pupil-edge discontinuity rings that distort the Z11 / Z4 ratio (0.51 vs. Kolmogorov truth 0.33). Our production calibration routine (benches/ao3k_scexao/calib_wfs_bias.py + cacaoloop-ao3k-scexao.milk calib-bias) solves all three:

Stage Band (λ_0) Calibration Pokes (σ_OPD) Outer Flux f_out (0 → poke) α_cal = 1 − S_cal n_out Pixels 4-Quad Asymmetry (x, y) Calibrated Z4 / Z11 [nm / (1 − S)]
Stage 1 (AO3k) J (1.22 μm) 128 (140.0 nm) 11.50% → 7.72% (Δ = +3.78%) 0.405 4716 (0.012, 0.012) −63.6 / −17.4
Stage 2 (SCExAO) Vis (0.75 μm) 128 (85.0 nm) 17.71% → 11.72% (Δ = +5.99%) 0.398 3319 (0.013, 0.013) −39.2 / −13.3

Notice the textbook physical scaling across stages: Z4_stg1 / Z4_stg2 = −63.6 / −39.2 = 1.622, matching the exact wavelength ratio 1.22 / 0.75 = 1.627 to 0.3%, and Stage-2 −39.2 / −13.3 nm/(1−S) matches the independent Kolmogorov truth (−39.2 / −13.3 nm/(1−S)) to < 0.1 nm!


6. Closed-Loop Two-Stage Verification (DEFAULT Preset)

We verify the full end-to-end system on the canonical --preset DEFAULT two-stage Subaru AO3k + SCExAO simulation (0.8" Maunakea seeing, mV = mH = 6.0, z = 30°, AO188 ADC, 45 nm vibrations, 1000 nm thermal LWE + sudden 1-λ_J petal step at t = 3.0 s, Block-EOF(B=32, P=24) predictive control, both PyWFS at mod = 0 λ/D, LLOWFS open), comparing WFSbias OFF vs. WFSbias ON on the bit-identical entrance-pupil turbulence realization (TotRMS = 1903 nm).

(Companion two-stage petal stability improvements shipped alongside WFSbias: (i) projecting the 3 TT-orthogonal discontinuous V-spider petal modes out of Stage-2 DM2 so 827 continuous Stage-2 modes can run at GAIN2 = 0.35 with zero 0.75 μm self-wrapping, (ii) direct aol2_imWFS2 odd Vernier petal sensing with 38 ms unwrap latency and Stage-2 Vernier waffle veto (0 aborts, 0 rollbacks), and (iii) spider-quadrant-orthogonal Vis-TTM projector aol2_visttM.)

Closed-Loop Verification of Native acquireWFSim Unmodulated-PyWFS Bias Compensation
Closed-Loop Verification of Native acquireWFSim Unmodulated-PyWFS Bias Compensation

Download Figure 5 graph data: fig5_closed_loop_verification.csv (exact before/after Zernike means, quiet total & in-band WFE, and Visible/Near-IR Strehl & Encircled Energy metrics).

Complete Before-vs.-After Performance Table (--preset DEFAULT, 10.0 s)

Performance Metric Baseline (WFSbias OFF) With acquireWFSim WFSbias ON Delta / Gain
Entrance Pupil Total WFE (identical realization) 1902.4 nm 1903.1 nm matched PRNG
Stage-1 Static Mean Z4 Defocus −20.24 nm −1.03 nm +19.21 nm (94.9% cut)
Stage-2 DM2 Static Mean Z4 Added −12.88 nm +2.17 nm +15.05 nm (83.2% cut)
Final Total Static Mean Z4 Defocus −33.12 nm +1.14 nm +34.26 nm (96.6% amp / 99.9% var cut)
Stage-2 DM2 Static Mean Z11 Added −6.88 nm +1.82 nm +8.71 nm (73.5% cut)
Stage-2 DM2 Higher-Order Mean OPD RMS (TT-rem) 18.0 nm 5.0 nm −13.0 nm (13.0× var cut)
Full 10 s Total WFE (Stg 1 → Stg 1+2) 174.0 → 203.4 nm (+29.4) 93.0 → 91.9 nm (−1.1) −111.5 nm final
Full 10 s In-Band WFE < 22 c/D (Stg 1 → Stg 1+2) 162.7 → 193.7 nm (+31.0) 69.4 → 68.1 nm (−1.3) −125.6 nm final
Quiet Total WFE (Stg 1 → Stg 1+2) 83.94 → 87.90 nm (+3.96) 81.76 → 79.32 nm (−2.44) −8.58 nm final
Quiet In-Band WFE < 22 c/D (Stg 1 → Stg 1+2) 58.01 → 63.53 nm (+5.52) 54.86 → 51.43 nm (−3.43) −12.11 nm final (−1391 nm²)
Visible (0.75 μm) Strehl (Stg 1+2 final) 48.81% 55.79% +6.98%
Visible (0.75 μm) EE(1.22 λ/D) (Stg 1 → Stg 1+2) 38.3% → 39.0% 40.2% → 40.6% +1.6% final
Near-IR H (1.65 μm) Strehl (Stg 1+2 final) 84.17% 86.93% +2.76%
Near-IR H (1.65 μm) EE(1.22 λ/D) (Stg 1 → Stg 1+2) 57.0% → 57.0% 58.3% → 58.4% +1.4% final
H-Band Coronagraph 5 λ/D Planet Contrast (Supp) 4.23e-04 (6.8×) 3.90e-04 (6.9×) −7.8%
H-Band Coronagraph 10 λ/D Planet Contrast (Supp) 8.30e-05 (5.9×) 7.45e-05 (6.1×) −10.2%
H-Band Coronagraph 15 λ/D 5σ Speckle Contrast 5.19e-05 3.12e-05 −39.9%
H-Band Coronagraph Mean Contrast (3–10 / 5–20 λ/D) 1.77e-04 / 6.07e-05 1.58e-04 / 5.39e-05 −10.7% / −11.2%

(Note on raw Stg 1 vs. Stg 1+2 Peak Strehl: in ao3k_scexao.bench, vis_stg1 / nir_stg1 tap b_post_stg1 ahead of the internal AO188 BS1 (3 mm SiO2 @ 45°) and NIRWFS v2 (5 mm SiO2 @ 12°) transmissive optics, whose chromatic dispersion lowers the diffraction-limited peak of vis_final to 96.15% and nir_final to 98.52%. Normalized to each plane's diffraction limit, Stage 1+2 exceeds Stage 1 in Visible (58.0% vs ~57.0%) while simultaneously beating Stage 1 in full-10 s WFE (93.0 → 91.9 nm), EE(1.22 λ/D) in both bands (40.2% → 40.6% Vis, 58.3% → 58.4% H), and coronagraph contrast.)

During quiet operation, the live outer-cross estimator tracks BiasA = (0.18, 0.41) on Stage 1 (1.22 μm) and Stage 2 (0.75 μm) — matching the physical 1 − S Strehl losses at both wavelengths — and automatically surges to (0.25, 0.56) during the t ≈ 6 s wind-gust transient without saturating or destabilizing either loop. See the full published closed-loop report at ao3k_scexao_2stage_opt_ttm1hz.


7. CLI Controls, Reproducibility & Downloadable Datasets

Dynamic unmodulated-PyWFS bias compensation is enabled by default in --preset DEFAULT and --preset STAGE1 whenever a stage runs unmodulated (mod = 0 λ/D), and is exposed via CLI flags in run-ao3k-scexao.sh:

cd ~/src/cacao-work && source env.sh
# Default two-stage unmodulated run (WFSbias ON by default; gain=1.0, ema=0.02 @ 2kHz)
./scripts/run-ao3k-scexao.sh --preset DEFAULT

# Disable dynamic unmodulated-PyWFS bias compensation for A/B comparison
./scripts/run-ao3k-scexao.sh --preset DEFAULT --no-wfs-bias

# Tune gain / EMA smoothing coefficient
./scripts/run-ao3k-scexao.sh --preset DEFAULT --wfs-bias --wfs-bias-gain 1.0 --wfs-bias-ema 0.02

# Live-SHM hardware-in-the-loop unit test for acquireWFSim.c dynamic reference blending
pytest -q tests/test_11_whiteness_and_zpo.py -k test_acquirewfs_dynamic_bias_comp

Downloadable Graph Datasets & Manifest

Artifact Download File Description
Figure 2 Data fig2_modulation_scaling.csv 40 grid points (mod = 0..5 λ/D × σ = 20..200 nm): 1 − S, Z4/Z11 bias, f_out_0, f_out, Δf_out
Figure 4 Data fig4_mitigation_strategies.csv Quantitative comparison table across E1–E4 (accuracy, odd Z4 cross-talk, stress tests, photon jitter, live tracking)
Figure 5 Data fig5_closed_loop_verification.csv Closed-loop --preset DEFAULT before-vs.-after Zernike bias, quiet WFE, and Vis/NIR Strehl & EE
Summary JSON unmod_bias_metrics.json Machine-readable JSON manifest of calibration diagnostics, estimator metrics, and closed-loop verification

Interactive Report Dataset Explorer

Dataset Explorer Interactive Report Dataset Explorer

Telemetry & Data Files