A wavefront sensor measures the phase distribution of a beam of light perpendicular to its axis of propagation. The Shack-Hartmann (S-H) wavefront sensor is based on segmentation of the incident light beam into small, spatially distributed, parts. Each of these parts is then incident on a lens, and the deviation of the focal spot from the lens optical axis is measured in two dimensions, usually by a camera or detector array. An array of lenses is used to characterize the wavefront of the entire beam.