A Simplified Shack Hartmann Sensor
to Demonstrate Wavefront Analysis

Shannon Hicks and John Noé

Laser Teaching Center
Department of Physics & Astronomy
Stony Brook University


At the beginning of the semester, frankly, I had no idea what I wanted to do for a project. Well, that's not true; more accurately, I had so many things I was interested in that it was extremely hard for me to narrow my options down to just one! However, I knew that I wanted to directly relate my work here in the Laser Lab back to the field of astronomy. Dr. Noé and I looked at and considered various ideas, including: measuring the angular resolution of lenses, modeling several kinds of telescopes, studying various aspects of solar astronomy and the sun, and looking at the very nature of light and how it travels. Finally, we were able to narrow the topic down to something involving a little bit of everything - Adaptive Optics (AO) and in particular the Shack-Hartmann wavefront sensor that is a key element of AO systems.

Adaptive Optics

In recent decades the technique of adaptive optics (AO) has revolutionized ground-based observational astronomy. Due to the unavoidable turbulence in the atmosphere wavefronts from distant light sources such as stars become distorted and fluctuate many times a second. Thus when these objects are viewed through a telescope the image becomes blurred and constantly shifts, an effect astronomers call "seeing." Adaptive optical systems allow astronomers to correct these wavefront distortions in real time using deformable mirrors whose shape can be rapidly varied under computer control.1

These diagrams, taken from Claire Max's AO course at UC Santa Cruz, illustrate these ideas. Click on the image to see the full-sized version.

If you're an even more visual person (like me!) then check out this awesome animation of how AO works! Watching this in my astronomy class is what got me interested in AO in the first place.

Here are a few pictures from Claire Max's powerpoint demonstrating just how much an image can be changed using Adaptive Optics. The first pair of images is of the planet Neptune. The one on the left was taken by the Hubble Space Telescope (HST) with visible light. The picture on the right also shows Neptune, but the image is much clearer even though it was taken from a ground-based telescope at a longer wavelength (infrared), due to Adaptive Optics. The second pair shows the Starburst Galaxy taken by the CFHT (Canadian-France-Hawaii Telescope) recorded with AO (left) and without it (right).

Wavefront Sensing, Greatly Simplified

A wavefront sensor is an optical device to rapidly evaluate the shape of the incoming distorted wavefronts. The commonly-used Shack-Hartmann sensor consists of a 2-dimensional array of hundreds of tiny lenses ("lenslets") that typically occupies an area smaller than a postage stamp.3 Each lenslet creates a separate focal spot on a CCD camera mounted behind the lens array. If the incoming wavefront is distorted (i.e. is not a plane wave) these spots of light shift in position by an amount proportional to the distortion. Computer programs capture images from the camera and determine the centroid shift of each spot and hence the overall shape of the wavefront.3 This information is then used to create a feedback signal that controls the shape of the deformable mirror.

The goal of our project was to simulate and demonstrate the operating principles of a Shack-Hartmann wavefront sensor and to gain experience with the associated data analysis. Instead of an array of many lenslets, we used a single "lenslet" that can be shifted to different positions using a translation stage. This single "lenslet" is not actually a tiny lens but rather a normal camera lens preceded by a centered pin-hole aperture. The lens is fixed to the CCD camera, and both move together. Thus the displacement of the focal spot depends only on the deviation of the incident wavefront from a plane wave.

This scanning wavefront sensor arrangement was used in a previous student project to study the wavefront tilt of an optical vortex laser beam 5, and scanning has been proposed for commercial wavefront sensors .4 A further simplification in the current project was to limit our study to a spherical wavefront, and to scan this along just a single line rather than across the full 2-D plane. Using a known wavefront allowed us to compare our results with a specific prediction, and hence test the accuracy of our procedures.

Setup and Procedures

The setup used materials already in the lab. The spherical wave was created by placing a strong halogen light source behind an iris aperture closed down to about 1.0 mm diameter. The "lenslet" was a 500 μm dia. pinhole attached to the front of a normal 16 mm focal length camera lens. The CCD camera was an Electrim-1000N, with 7.4 μm square pixels. The camera software saves the array of 8-bit pixel values as .tif files on a Windows 95 computer. The camera-lens assembly was mounted on a translation stage and could be moved horizontally in steps as small as one-thousandth of an inch (25.4 μm). The translation stage was placed in such a way that the lenslet aperture was 1.035 meters away from the light source aperture.

Here are two drawings I made of the setup and some pictures taken by Dr. Noe. The first four pictures show the spherical-wave light source and the second four show the CCD camera with the pinhole mounted to the lens and the one-inch micrometer that moved the stage. Click on any of the images to enlarge it.


The procedure consisted of recording a set of images as the wavefront sensor was scanned in 2.54 mm increments across the 25.4 mm range of the translation stage. The exposure was adjusted at each step to keep the maximum pixel value around 200, safely below the saturation value of 255.

Data Analysis

The goal of the data analysis was to find the centroid of each recorded focal spot and its displacement from the reference spot that would be created by a plane wave. The centroid calculations were completed using a spreadsheet program (Microsoft Excel). The first step was to convert images to arrays of pixel values. The centroid values were then obtained by matching 2-D Gaussian surfaces to these pixel arrays.

Specific Procedures:

  1. We transferred the pictures into the Linux comptuer and used xv and the "convert" command to cut all the pictures to the same size. This allowed us to conclude the number of pixels we needed to keep in the picture. After converting them, I imported them into Excel - which gave me a table of numbers that represented pixel intensities. Here's an example of one of the cropped images and what it looks like in Excel. Each cell is equivalent to one pixel in the picture, and the number inside the cell corresponds to the pixel's intensity. The smaller numbers along the edges correspond to background light, which were eventually canceled out.

    Click on an image to see the corresponding pixel values (scroll down). There is a break
    in the uniform sequence because one data point (image K) was inadvertently not recorded.

  2. Using the intensities and Excel, I was able to calculate the centroid position, width, and intensity by fitting them to a sumsquare formula. The sumsquare formula was based on a Gaussian curve fit. By adding and changing different perameters in the equation, we were able to get the data that corresponded to the least amount of error in the system. In the formula x_c and y_x are the x- and y-direction centroids, while w_x and w_y are the corresponding width parameters.

  3. The next step was measuring the Wavefront (WF) Tilt and its relation to the displacement of the centroid. Calculating Wafrefront tilt is what allows the Shack Hartmann sensor to map out the shape of the distorted wavefront coming into the actual telescope. The WF tilt is essentially the angle of a tangent to the wavefront with respect to a reference plane wave (i.e. a vertical line in this drawing). The OPD is the horizontal distance between the wavefront and the reference plane wave; it can be expressed as a distance (in nanometers) or as some multiple of a wavelength of a particular color of light. For a spherical wave the OPD is proportional to the square of the tilt.
    The wavefront tilt was calculated using a method involving similar triangles, as shown in the diagram below. The distance the centroid moved, divided by the focal length is Theta 2, or the wavefront tilt. We were able to calculate the displacement of the centroids by using the gaussian formulas to find their exact location on each picture. The pixel location was then converted to meters by a factor of 7.4 micrometers per pixel. This gave us the observed wavefront tilt. We then calculated the predicted WF tilt by noting that according to the law of similar triangles, Theta 1 and Theta 2 should be equal. This was done simply by dividing the track displacement by R (the distance fron the source to the "lenslet").

    Table of the WF Tilt - Observed and Predicted:

Data Analysis and the Final Results!

The following table summarizes our results ...

After calculating all of the WF tilt values in Excel, I was able to create a graph of them, related to the track displacement. It plots the predicted WF tilt and superimposed are the values that were actually calculated from the data we collected. It's quite close, which means that the measurements we took from scanning across the wavefront were fairly accurate.


[Stuff Shannon will write goes here ...]

The next step for this project could be to create a distorted wavefront. The data we've got here is for a nearly perfect spherical wavefront ; the next set of data will be generated by placing some sort of distorting object (such as a plastic sheet or an imperfect lens) in front of the point source. This intentional distortion will simulate the turbulence in "seeing" and the scanning wavefront sensor will be able to measure the displacement of the centroid positions.In other words - the spot will actually be moving around, and displaced from where it is supposed to be on the CCD screen (like the first diagram in the background section). From these data the wavefront tilt and OPD can be calculated and the shape of the wavefront deduced.


  1. "Adaptive Optics on the 200-inch Hale Telescope at the Palomar Observatory." 2008.
    Caltech Astronomy. 20 Apr. 2009 http://www.astro.caltech.edu/palomar/AO.

  2. Center for Adaptive Optics, Univ. of California at Santa Cruz, http://cfao.ucolick.org.

  3. Claire Max, "Introduction to Adaptive Optics." Course notes for Astronomy 289C at UC Santa Cruz. 20 April 2009 http://www.ucolick.org/%7Emax/289C/

  4. Benjamin Wells, "Revising the Hartmann Test," Wells Research and Development. 2009. 20 Apr. 2009 http://www.wellsresearch.com/library/hartmann.php

  5. Danny Minkin's Laser Lab Report