# Adaptive Optics Shack-Hartmann Sensor and Deformable Mirror

I have a technical question regarding the Shack-Hartmann sensor in deformable mirrors. What algorithm is used to take the Shack-Hartmann measurements of local tilt and turn them into a full phase estimate that can be passed to the deformable mirror?

(Source: Wikipedia1)

I see that the the sensor itself can generate an estimate of the derivative of the wavefront $w(x,y)$ by observing the offset of the centroid of the guidestar. If the delta in from center of the guidestar is $\delta_x$ and $\delta_y$ then the derivative of the wavefront in that region is proportional $\delta$:

$\frac{dw}{dx} \propto \delta_x$ and $\frac{dw}{dy} \propto \delta_y$

Geary's Introduction to wavefront sensors2 has the following diagram:

with the comment: "To reconstruct the wavefront, the local tilts must be stitched together".

Is it enough to connect them end-to-end, perhaps make them non-negative, and pass them on? The values transmitted are usually Zernike Polynomial modes, so do we we desire to make them positive or zero mean? What algorithm is actually used to take the Shack-Hartmann measurements of local tilt and turn them into a full phase estimate that can be passed to the deformable mirror?

1 By 2pem - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=15279624

2 Geary, Joseph M.. (1995). Introduction to Wavefront Sensors.

Say your wavefront is $$w(x,y)$$, based on the diagram above you have sub-aperture local slope movements $$\delta(x,y)$$, and

$$\nabla w = \delta(x,y) / f$$

Since for Shack-Hartmann the spatial resolution is usually low, so people fit wavefront $$w$$ to a Zernike polynomial. Denote the Zernike basis be matrix $$Z$$ and coefficients be $$a$$, then

$$w = Za$$

In principle you solve a least-squares to estimate $$a$$ first

$$a = \arg\min_a \| \nabla Za - \delta/f \|^2 = \left((\nabla Z)^T\nabla Z\right)^{-1} (\nabla Z)^{T}\delta/f$$

Now you got the Zernike coefficients. And you would like to pass it to the deformable mirrors, which as @Carl mentioned contains many actuators. Say the commands to each actuator is a vector $$c$$, there is a command matrix $$C$$ that maps the commands to actual shape on the deformable mirror. In math

$$d = Cc$$

where $$d$$ the shape of the deformable mirror. Also since Shack-Hartmann and deformable mirror are in conjugate, there is another matrix describing this linear relationship, denoted as $$M$$. And

$$w = M d$$

One way to interpret matrix $$M$$ is, say your Zernike-fitted wavefront (i.e. $$w = Za$$) covers a square Shack-Hartmann sensor size of $$\sqrt{n} \times \sqrt{n}$$ $$\text{mm}^2$$. Your deformable mirror, at the conjugate plane, covers another square area of $$\sqrt{m} \times \sqrt{m}$$ $$\text{mm}^2$$. Assuming same sampling rate (e.g. 1 discretized pixel per $$\text{mm}^2$$), then:

$$w \in \mathbb{R}^n \quad d \in \mathbb{R}^m \quad \text{and} \quad M \in \mathbb{R}^{n \times m}$$

Of course the actual number of $$n$$ and $$m$$ depends on your manual specification on the resolution.

Another way to interpret $$M$$ is, $$M$$ models aperture occlusion as well. For simplicity say $$n = m$$, then $$M$$ is a square matrix. If you wavefront sensor covers area outside of the deformable mirror, you can just let those areas be zeros in corresponding position of $$M$$. Now $$M$$ is a diagonal matrix whose elements are either 1 or 0 (in ideal case). Diffraction or any setup misalignment will make $$M$$ not diagonal anymore.

Now go back to the formulation. Put it together

$$w = M d = MC c$$

Since you got $$w$$ but want $$c$$, so you need to invert the above system matrix $$MC$$, that is

$$c = (MC)^{-1} w = (MC)^{-1} Z a$$

where $$a$$ is the coefficients you solved from the least squares above. Usually $$(MC)^{-1}$$ is calibrated before the whole adaptive optics loop. So in real time correction you need only to solve $$a$$ and then pass it to the calibrated system to yield the reversal mirror shape.

• I appreciate this detail. Would you be willing to expound on the usage of M? Sep 30, 2018 at 20:50