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.
Speaking as one who has dealt with those equations (and those problems) since 1984.

Yes, the simplest approach is to use matrix methods to force the phases at the edges of every subaperture to be the same.  The assumption is that there is no phase tearing , and if there were, adaptive optics pretty much would be unable to handle such disruptions.   Once the full "map" is constructed, the mean value is removed (aka the "piston" term, zeroth Zernike) to reduce the overall stroke requirement on the deformable mirror (DM).  In most systems, the mean tip &amp; tilt values (first Zernike terms) are removed as well and passed off to a full aperture tip/tilt correction mirror.  Again, that reduces overall stroke requirements on the DM.  

There's lots more in practice, because the subaperture actuators on the DM (other that segmented ones, which have a host of other problems) have what's known as the "influence function".  That is, moving an actuator essentially creates a "hill" or "valley" over a decent region of the mirror.  These influence functions may or may not overlap neighboring actuators, depending on the mirror design, but in any case the final correction matrix has to take into account the difference between an idealized subaperture tip/tilt correction and what the mirror actually can do.  

Follow that up with spatial and temporal (history) noise reduction filters, and off you go.   

Now, back to the start: the constant of proportionality between Hartmann spot motion and phase tilt (or tip) is a simple function of the lens focal length. Draw the triangle consisting of the optic axis distance from lenslet to image plane (i.e. lens focal length), the distance from the origin to the centroid of the spot image, and the hypotenuse from the center of the lens to the centroid of the spot.  You can thus easily see that the tilt is the difference between the length of the hypotenuse and the focal length.  Convert that from meters (or microns) to wavelengths of the sensing light, and there you are.