A simple technique for reconstructing a wavefront from the measurement
s of a Shack-Hartmann sensor is described. The optimal estimator used
is analysed for the effect of errors in the turbulence model at differ
ent light levels. The method is then analysed in situations where the
size of the wavefront sensor is restricted by the number of available
photons and a guide star is not available. The algorithm uses a priori
statistics of the turbulence derived by observing a nearby bright sta
r which can be outside the isoplanatic angle. This differs from previo
usly published estimators since the a priori information is measured r
ather than derived from a theoretical model of the turbulence.