15  Wavefront sensing

Published

September 8, 2026

Work in Progress

Suggestions of all kinds for this book draft are welcome — whether it’s fixing small errors, raising bigger questions, or offering new perspectives. Please share comments through GitHub Issues. To make feedback easier to address, please point to the section you have in mind — by section number or a short snippet of text.

15.1 Wavefront sensing overview

The previous chapter described how to represent a wavefront, \(W(\rho,\theta)\), and how that representation determines the point spread function (Chapter 14). But the wavefront itself is not something an ordinary image sensor can measure directly—a sensor records the intensity of light, not its phase. This chapter describes an instrument that measures the wavefront, the Shack-Hartmann wavefront sensor, and how it can be coupled with other optical instruments for applications ranging from astronomy to ophthalmology.

15.2 Shack-Hartmann wavefront sensor

The Shack-Hartmann wavefront sensor measures \(W\) indirectly, using the fact that a lenslet focuses collimated light to a point that shifts when the incoming rays are tilted.

The sensor places a lenslet array in front of an image sensor, with a small sensor region behind each lenslet (Figure 15.1). Each lenslet samples a small sub-aperture of the pupil. If the wavefront were flat over that sub-aperture, the lenslet would focus its light to a spot centered on its axis; a locally tilted wavefront shifts the spot away from center by an amount proportional to the local slope, \(\nabla W\). Measuring the spot displacement at every lenslet therefore samples \(\nabla W(\rho,\theta)\) across the whole pupil, from which \(W\) itself can be reconstructed—for example by fitting Zernike polynomials to the measured slopes and integrating. This is a direct extension of the ray-based lenslet measurement introduced in Section 3.2: assembling many lenslets, each with its own small sensor region, turns a single local-angle measurement into a sampled estimate of the wavefront across the entire pupil.

Figure 15.1: Principles of the Shack-Hartmann wavefront sensor.

Using Zernike decomposition on the measured slopes allows immediate interpretation and simulation without needing to reconstruct PSFs from images.

Hartmann’s screen

Johannes Franz Hartmann, a German astronomer, faced a version of this problem around 1900: how to measure whether a telescope objective sent out parallel rays from an on-axis point source. He covered the aperture with a screen pierced by an array of pinholes and photographed the resulting spots on either side of focus. A ray bundle emerging parallel to the axis produced a spot centered behind its pinhole; any deviation from parallel displaced the spot, revealing the local ray error. Diffraction blurred each pinhole’s image into a small spot rather than a point, and the pinholes passed little light, so the technique was not very sensitive.

Roland Shack and Ben Platt’s 1971 innovation was to replace each pinhole with a small lens—a lenslet—which collects far more light and focuses it to a sharper spot: the design described above.

Arizona history of the Shack-Hartmann sensor.

15.3 Adaptive optics

A wavefront sensor becomes especially powerful when paired with a deformable mirror. This is a front surface mirror whose shape can be adjusted locally, over small regions. When the rays in a light field are reflected by the mirror the shape of the surface sculpts the direction of the rays, or equivalently we can say the mirror changes the wavefront. An adaptive optics system first measures the direction of the rays (the wavefront) and then applies a correction to the rays with the deformable mirror. This reduces the aberrations so that we can focus the light and form a high quality image.

The concept was first applied in astronomical imaging. The astronomer shines a strong laser, tuned to 589 nm, into the upper atmosphere. This laser excites sodium atoms that are in a layer of the mesosphere roughly 90 km (56 miles) above Earth1. The sodium absorbs the laser light and re-emits it in all directions through resonance fluorescence. This light is called a beacon or guide star.

The sodium layer is pretty far away, but not quite far enough for the light to arrive adequately collimated (planar wavefront) at the telescope. The arriving light is still a (slightly) diverging spherical wave. On a large aperture, the wavefront sagitta deviates from planarity by about \(40\lambda\) on a 4-meter telescope and over \(200\lambda\) on a 10-meter telescope. Because this 90 km curvature is predictable, the wavefront sensing optics are set to focus at that altitude. Atmospheric turbulence then adds rapidly fluctuating, irregular phase ripples onto this nominal spherical wave.

Figure 15.2: Laser guide star at La Palma, Observatorio del Roque de los Muchachos. The 4.2m William Herschel Telescope Canary adaptive optics system was used together with the ESO laser guide star unit. Source

A wavefront sensor measures these turbulent phase perturbations and controls a deformable mirror (illustrated below). The mirror alters its surface shape, canceling the atmospheric aberrations so that light from distant astronomical objects (which arrive from infinity) emerges with a flat, collimated wavefront.

Figure 15.3: Deformable mirror

This whole process updates rapidly (milliseconds) because the atmosphere is changing quickly. This means the sensing must be fast and the deformable mirror must be fairly light and responsive so it can change shape quickly. The whole system is illustrated in Figure 15.4. The corrected image of the stars in the sky is much sharper than would be possible by imaging through the atmosphere.

Figure 15.4: Wavefront-sensing architecture used in astronomy and ophthalmology. The incoming light can be from a star or reflected from the back of the eye. Adapted from Exosens, “Short-wave infrared adaptive optics and applications,” Fig. 1, which credits C. Max, Center for Adaptive Optics.
YouTube: Explanations of adaptive optics

Here are two helpful video explanations of adaptive optics in astronomy: the first offers an intuitive conceptual overview, while the second provides a detailed look at the engineering, including how to build a deformable mirror.

Here is an informal, very nice explanation of the adaptive optics system for astronomy. Maybe a little too cute, or maybe just perfect? I like it.

Here is an excellent, detailed video describing the use of adaptive optics in astronomical imaging, where the author describes how to build a deformable mirror. Very enjoyable!

The same architecture measures the optics of the human eye, where the aberrating medium is the cornea and lens rather than the atmosphere; we describe that application, and the resulting adaptive-optics imaging of the retina, in Section 24.4.

15.4 Spatial light modulators

What if the way a lens focuses light could be reconfigured rapidly? Perhaps even in a way that depends on the input. Sounds cool.

Spatial light modulators (SLMs) dynamically control the properties of a light field, on a pixel-by-pixel basis. They are arrays of small, programmable optical elements. The way we describe them is based on the representation of light in terms of wavefronts (Chapter 14). We can build devices that modulate the phase or the amplitude of the local electric field.

The SLMs come in two general types.

  • Phase SLMs, often based on liquid crystal arrays, can locally alter the phase of light, effectively acting as a reconfigurable lens or diffraction grating. They can be used to correct for aberrations in real-time or to sculpt a light beam into a complex pattern.
  • Amplitude SLMs, which use technologies like MEMS (micro-electro-mechanical systems) mirrors, modulate the intensity of light at each pixel.
An SLM device

With pixel sizes on the order of microns and arrays containing millions of elements, SLMs are powerful tools in adaptive optics, holography, and advanced imaging systems. This figure shows a recent phase SLM with extremely high resolution.

Figure 15.5: Holoeye phase spatial light modulator based on reflective LCOS. Max resolution 4160 x 2464, pixel Pitch 3.74 µm, Active Area 15.56 x 9.22 mm (0.7″ Diagonal, 8 Bit, 60 Hz frame rate). The small part is the SLM; the big part is the electronics. See Holoeye

Figure 15.6 illustrates how a phase SLM might be programmed to change the direction of a planar wavefront (collimated bundle of rays). We can set the elements to introduce a linear phase shift across space. This has the effect of changing the angle of the wavefront, but leaving it as planar. This phase shift changes the direction of the wave, or equivalently, the collimated bundle of rays.

Figure 15.6: This phase ramp leaves the rays parallel, but changes the orientation of the wavefront. The ray direction is perpendicular to the wavefront.

15.5 ISETCam simulation: Flare and wavefronts

Let’s finish this chapter with ISETCam flare examples. We will illustrate the impact of the aperture shape and scratches. Illustrate the use of the pupil functions in automotive modeling. We will do it again when we simulate the human eye pupil function.

  • Stopping down the aperture and changing its shape Modify \(a(\rho, \theta)\) to reduce the pupil radius
  • Adding obscurations, vignetting, or scratches Mask parts of \(a(\rho, \theta)\) or add amplitude modulation (scratches)
  • Simulating phase plates or diffractive elements Alter \(W(\rho, \theta)\) with custom phase profiles - this will require a new tutorial with linear phase ramp

  1. These atoms were deposited in this layer by vaporizing micrometeorites.↩︎