Learning low-order wavefront correction
Three reinforcement-learning policies learned to correct six modes of pupil-phase distortion using noisy focused and defocused images. This study follows their training and compares their final corrections with an image-driven phase-diversity fit on unfamiliar phase screens.
What the trained policies achieved
Under nominal conditions, the mean on-axis intensity ratio increased from 0.8519 without correction to 0.9936 across the three trained policies. Downstream of an ideal coronagraph, the geometric-mean stellar leakage in a 2–4 lambda/D annulus fell by 29.0×. Mean off-axis aperture throughput was 99.25%.
The conventional phase-diversity fit reached an on-axis ratio of 0.99995 under the same nominal exposure budget. Its mean final ratio was higher in 5 of five test conditions. The learned policies demonstrate correction within this simulator, with a remaining performance gap to the nominal-model fit.
Training optimizes measured, non-coronagraphic on-axis intensity. The coronagraphic residuals, true phase errors, and throughput below are noise-free simulator diagnostics reserved for evaluation. The optical model is a monochromatic unobstructed pupil with static distortions and an ideal six-mode corrector.
| Condition | No correction | Untrained SAC | Trained SAC 95% case interval | Phase-diversity fit | SAC median OPD [nm] | SAC leakage reduction |
|---|---|---|---|---|---|---|
| Nominal | 0.8519 | 0.8363 | 0.99360.9933–0.9939 | 0.99995 | 5.10 | 29.0× |
| 1,000 photons | 0.8519 | 0.8363 | 0.98730.9866–0.9881 | 0.99388 | 8.62 | 13.1× |
| Larger aberrations | 0.5259 | 0.5179 | 0.99310.9925–0.9936 | 0.99995 | 6.09 | 105.7× |
| Uncontrolled modes | 0.8194 | 0.8046 | 0.95250.9520–0.9530 | 0.95862 | 17.40 | 1.9× |
| 15% gain error | 0.8519 | 0.8314 | 0.99140.9909–0.9918 | 0.99993 | 5.80 | 22.6× |
Intensity columns are mean final on-axis intensity divided by the ideal peak. Intervals resample 100 paired test screens and condition on the three trained policies. Leakage reduction is a ratio of geometric means relative to the corresponding uncorrected cases. OPD is optical-path difference at 500 nm.
Inspect a recorded correction
These sequences use the first held-out screen, seed 900000, chosen before inspecting its appearance. The slider replays measured controller actions and their optical consequences. Each controller receives two sensing exposures initially and two after each command.
Loading recorded measurements…
Before correction
SAC seed 11
Phase-diversity fit
Training behavior
Each policy received exactly 50,000 environment steps. Development evaluations used separate phase screens every 10,000 steps. The final checkpoint from each run was retained, including the weaker final development result of seed 22.

Individual training-seed outcomes
| Condition | SAC seed 11 | SAC seed 22 | SAC seed 33 |
|---|---|---|---|
| Nominal | 0.9971 | 0.9875 | 0.9964 |
| 1,000 photons | 0.9901 | 0.9865 | 0.9854 |
| Larger aberrations | 0.9945 | 0.9895 | 0.9952 |
| Uncontrolled modes | 0.9540 | 0.9477 | 0.9557 |
| 15% gain error | 0.9966 | 0.9824 | 0.9950 |
Entries are mean final on-axis ratios over 100 held-out screens. The aggregate result above retains all three policies.
Held-out optical performance


Model and evaluation choices
Optics, units, and observations
HCIPy defines a 32×32 unit-diameter circular pupil and Zernike modes 4–9 in Noll ordering. The six sampled modes have unit pupil RMS individually, with the measured Gram matrix retained in validation.json. Commands are radians of pupil phase. Optical-path difference at 500 nm is phase × 500 / (2 pi) nanometres. A reflective mirror surface displacement would be half that OPD.
The policy observes 16×16 focused and defocused intensity frames spanning 8×8 lambda/D, its current command, remaining horizon, and photon calibration. Diversity is 0.8 rad RMS of defocus. Each exposure uses Poisson photon noise and one-electron Gaussian read noise. Images share a fixed unaberrated PSF reference. The policy’s inputs exclude the true phase and test-condition label.
Training, reward, and conventional controller
Stable-Baselines3 Soft Actor-Critic uses a two-layer 128-unit MLP, discount 0.9, learning rate 0.0003, batch 128, and a 50,000-transition replay buffer. Independent training seeds are 11, 22, and 33. Initial phase RMS is sampled from 0.15–0.45 rad and photons per exposure from 30,000–300,000 on a logarithmic scale.
Each action adds at most 0.15 rad per mode, with a total coefficient bound of ±1 rad. Reward is five times the clipped measured on-axis intensity ratio, minus a small squared-action penalty. The conventional controller fits its nominal phase-diversity forward model to its measured intensity pair and applies its bounded negative phase estimate. Its internal model evaluations are separate from physical exposure accounting.
Held-out cases and paired uncertainty
Each condition uses 100 deterministic test seeds beginning at 900000. Development seeds begin at 700000, and subsequent random training episodes use seeds above 10 million. Nominal tests use 0.4 rad initial phase RMS and 100,000 photons per exposure. Stress tests use 1,000 photons, 0.8 rad RMS, 0.2 rad RMS of additional modes 11–16, or actuator gain 1.15.
All compared controllers start on the same physical phase screen and initial noisy measurements. Noise streams are indexed by episode, step, and exposure. Bootstrap intervals resample whole paired test cases 2,000 times. They condition on these three trained policies, whose individual results remain available.
Downstream coronagraph and throughput
The ideal coronagraph removes the coherent projection onto the reference pupil field. Its implementation is numerically cross-checked against HCIPy’s order-two PerfectCoronagraph. Mean stellar residual is integrated over a 2–4 lambda/D annulus relative to the ideal non-coronagraphic PSF peak.
A unit-flux off-axis point source at 3 lambda/D supplies the throughput diagnostic. Flux inside a 0.75 lambda/D aperture is compared with the same source without aberration or coronagraph. These simulated diagnostics accompany correction performance. Detector sensitivity and planet detectability would require a further observing model.
Scope relative to the published experiment
This pilot adapts the phase-diversity principle and non-coronagraphic correction stage of Gutierrez et al. (2024). The reference uses PPO, many more training steps, and larger control spaces. Here SAC, six modes, bounded incremental commands, and a laptop-sized training budget define a smaller experiment.
The optical model is monochromatic and static during each episode. A physical deformable mirror, realistic pupil geometry, evolving atmosphere, broad-band light, and measured observatory data would add further constraints. The gain-error case specifically tests actuator-gain robustness.
Training cost and reproducibility
The three runs used 150,000 training commands and 350,004 simulated sensing exposures, plus 12,096 development exposures. Training and checkpoint work took about 5.8 minutes on a single-threaded CPU configuration. Every held-out correction used 14 sensing exposures.
For nominal episodes, measured controller wall latency averaged 0.53 ms for six SAC actions and 9.54 ms for six phase-diversity fits on this machine, excluding image acquisition and diagnostic calculation. These timings describe this implementation and hardware.
The source bundle includes three final policies, three corresponding untrained policies, locked dependencies, code, training curves, complete test measurements, and file hashes. The recorded protocol specifies the experiment before training.