---
title: "Adaptive Optics Observatory Interactive Lab | Sandbox Physics"
description: "How can measured wavefront slopes drive a mirror fast enough to sharpen a turbulent star image?"
canonical_url: "https://sandboxphysics.com/labs/adaptive-optics-observatory/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/adaptive-optics-observatory/"
last_modified: "2026-10-27"
---

Optics 071 · Diffraction, Fourier optics, and computational imaging

# Adaptive Optics Observatory

**How can measured wavefront slopes drive a mirror fast enough to sharpen a turbulent star image?** A reconstructor turns the slopes into commands for a deformable mirror, and a fast closed loop keeps flattening the wavefront as turbulence changes. The slopes come from a Shack-Hartmann sensor: each spot behind its small lens shifts in proportion to the local slope. Delay, photon noise and limited mirror travel cap the correction, and the sensor is blind to some shapes, such as uniform piston.

Spots measured by a Shack–Hartmann sensor drive a deformable mirror whose surface you can watch bend. Compare star images with a flat and a corrected mirror, and explore modal fitting, delay, photon noise and mirror stroke.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

The aberration phase is synthetic, not a Kolmogorov turbulence model. Lenslet spots are approximated as Gaussians, and the mirror is an ideal continuous modal mirror. The PSFs are instantaneous and scalar, and piston cannot be measured.

Physics tutorial

## Audit the physics of Adaptive Optics Observatory

**Background** Each lenslet sees one patch of the relayed pupil and turns the average slope of the optical path across it into a sideways shift of its focal spot: $\Delta x=f_{\ell}\langle\partial_x W\rangle$. The Lab records the camera pixels first, then finds each spot's centroid, then solves for the mode coefficients the mirror can correct. The true phase serves only as the answer key and is not a measurement.

**Why it matters** How can measured wavefront slopes drive a mirror fast enough to sharpen a turbulent star image?

Start with the essentials

- **Focus question**: How can measured wavefront slopes drive a mirror fast enough to sharpen a turbulent star image?
- **One-sentence intuition**: Adding the same phase everywhere, called piston, changes no slope at all: $\nabla(W+p)=\nabla W$. Add piston and compare the spots and the normalized star image. The sensor cannot recover this constant, so only the RMS error with piston removed is scored.

### Core mathematical model

#### From detected electrons to slope

$$
\begin{aligned}\bar x_j&=\frac{\sum_i x_i D_{ji}}{\sum_i D_{ji}}\\\Delta x_j&=f_\ell\frac{\lambda}{R}\langle\partial_u w\rangle_j\end{aligned}
$$

The wavefront is measured in waves. Normalized pupil coordinates are the transverse distance divided by the pupil radius. Pixels are two micrometres wide and the lenslet focal length is two millimetres. Each spot is modelled as a Gaussian, integrated over pixels, with optional Poisson counts. The centroid bias from the finite window stays in the result.

#### Reconstructing modes from measured slopes

$$
\widehat{\mathbf a}=(G^TG+\epsilon I)^{-1}G^T\mathbf s
$$

The matrix holds each mode's calibrated gradient averaged over each lenslet cell, plus a tiny fixed ridge term. Dark cells are left out; the true phase never fills in for them. The modes start with tip, tilt, defocus, astigmatism, coma, trefoil and spherical shape. There is no piston column.

#### Closed-loop update from past data, and mirror sag

$$
\begin{aligned}\mathbf c_{k+1}&=\mathbf c_k+g\widehat{\mathbf a}_{k-d}\\w_{\rm res}&=w_{\rm in}-\sum_m c_m Z_m\\s&=\frac{\lambda\sum_m c_m Z_m}{2\cos45^\circ}\end{aligned}
$$

Positive sag points along the normal toward the incoming beam and shortens the optical path. Each update follows one ten-millisecond sample, and any extra delay comes in whole frames. The stroke setting scales all modal commands at the sampled pupil points by one common factor. The mirror is an ideal, quasi-static continuous surface; individual actuators are not modelled.

#### Star image and Strehl ratio from the residual phase

$$
\begin{aligned}I&=\frac{|\mathcal F\{A e^{2\pi i w_{\rm res}}\}|^2}{\sum |\mathcal F\{A e^{2\pi i w_{\rm res}}\}|^2}\\S&=\frac{\max I}{\max I_{\rm ideal}}\\S_{\rm M,axis}&\approx e^{-(2\pi\sigma_w)^2}\end{aligned}
$$

The Strehl ratio here compares peaks over the whole sampled angular grid, not just the on-axis values. Piston changes neither the image nor the RMS with piston removed. For small errors, the Marechal value approximates the nominal on-axis intensity. When tilt moves the star, it is no longer guaranteed to approximate the peak Strehl ratio.

### Common difficulties

#### Does more gain always sharpen the star?

**Typical misconception** Just raise the gain and add modes until the star is perfect.

**Better mental model** A finite set of modes cannot fit every ripple. Feedback that arrives late can oscillate, faint spots give bad centroids, and the mirror runs out of stroke. The Lab computes the exact peak Strehl ratio from the corrected pupil, not from an empirical rule based on gain.

### Run the experiment

1. 01

   #### Scene 1: Measured mirror correction

   Look at the deformable mirror itself, then at the front of the wavefront sensor. Pause playback and compare the flat mirror with the closed loop at the same frame.

   **What to observe:** The deformable mirror is opaque and folds the beam, so no light continues behind it. A beam splitter feeds two separate devices: the science camera and the wavefront sensor.

2. 02

   #### Scene 2: Moving phase and latency

   Scrub from the initial flat mirror through the first few updates. Each correction uses only spot images recorded earlier.

   **What to observe:** The flat-mirror and AO star images use the same incoming phase, pupil, normalization and fixed display scale. Each is the expected image at one instant, not an average over time.

3. 03

   #### Scene 3: Fine ripples and photon noise

   Try moving phase with delay, low photon counts, few modes and a small stroke. Add piston to test a mode the sensor cannot see.

   **What to observe:** A small residual in the fitted modes does not mean every phase feature was measured. Piston, high-order fitting error, clipping by the spot windows and delay all stay in the result.

Physical conclusion

The mirror corrects the wavefront that the sensor measured. Watch what the loop sees, and what it cannot see.

Waves & optics · Starter path

## From one ray to interference measurement

Start with refraction, find where the ray picture stops working, then use interference to measure tiny distances.

[Start here → **Optical Boundary Explorer** Turn the incident angle and watch reflected and transmitted power trade off. Then switch to the critical-angle scene. Observe · 11 min](https://sandboxphysics.com/labs/optical-boundary-explorer/)

1. [1 Optical Boundary Explorer](https://sandboxphysics.com/labs/optical-boundary-explorer/)
2. [2 Rainbow Caustic Observatory](https://sandboxphysics.com/labs/rainbow-laboratory/)
3. [3 Camera Obscura](https://sandboxphysics.com/labs/camera-obscura/)
4. [4 Coherent Wave Composer](https://sandboxphysics.com/labs/coherent-wave-composer/)
5. [5 Young Double-Slit Bench](https://sandboxphysics.com/labs/young-double-slit-bench/)
6. [6 Michelson Precision Lab](https://sandboxphysics.com/labs/michelson-precision-lab/)

[View the full path →](https://sandboxphysics.com/topics/waves-and-optics/#starter-path)
