A Maximum Likelihood approach to wavefront sensing. Yan Jiao and John Walker School of Electrical and Electronic Engineering University of Nottingham Nottingham NG7 2RD A novel approach to two-dimensional wavefront sensing based on a maximum likelihood algorithm is introduced. The data used is the same as for the well-known GerchbergSaxton method i.e. two intensity patterns recorded in different image planes. The algorithm developed is iterative but requires only a forward transformation not an inverse transformation. This means that the method has the advantage of not being restricted to low numerical aperture cases. The feasibility of the method is demonstrated through numerical simulations. These demonstrate that compared with the GerchbergSaxton algorithm, the maximum likelihood method is relatively insensitive to noise and works well for a wider range of chosen defocus settings. This latter feature is particularly important for a practical application of the technique for lab-based testing of lenses. Results of applying the method to experimental data are also presented. 1. Introduction Traditionally, wavefront sensing to measure the aberrations of optical lenses or optical systems is achieved through interferometry [1] where the wavefront under test is compared with an ideal wavefront generated from a reference surface. This approach requires that a suitable reference surface must be produced to good accuracy and that some form of fringe analysis is performed to obtain the desired wavefront shape. An alternative approach is that of phase retrieval [2] in which no reference beam is used but an attempt is made to recover the phase from at least two measured intensity patterns. In this paper we consider a method proposed by Gerchberg-Saxton [3] for the testing of lenses or lens systems in which two images of a point object are measured with different amounts of defocus to produce data shown in the diagram below (Figure1). Figure1 examples of intensities in two defocus planes suitable for Gerchberg-Saxton algorithms Gerchberg-Saxton proposed an iterative approach to obtain the phase, based on repeated forward and inverse Fourier transforms. This algorithm works by first making a first estimate for the phase in the exit pupil of the lens (usually zero phase is used). The complex amplitude in the exit pupil with this phase is then transformed to the one of the defocus planes by a Fourier transform with a suitable phase curvature to account for the defocus. The complex amplitude obtained is then modified to have a modulus equal to the square root of the intensity measured in that defocus plane. An inverse transform of this modified complex amplitude is then performed to obtain a modified estimate of the complex amplitude in the exit pupil. The modulus in this plane may then be set to an assumed constant value. Next this modified complex amplitude is transformed to the other defocus plane and modified as before. This process is repeated iteratively until only minor modifications of the complex amplitude are being made so that a phase/wavefront compatible with the two intensity patterns is obtained. In this paper, an alternative iterative algorithm based on the Maximum Likelihood principle is proposed and its performance is compared with the traditional Fourier transform method. 2. Maximum Likelihood Algorithm If sampled values of the complex amplitude in the exit pupil are denoted by A and the sampled complex amplitude in one of the two defocused image planes as a1 and a 2 then the transformations that connect these quantities can be expressed in the form of matrix multiplication operators H1 and H2 as a1 = H1 * A and a 2 = H2 * A and the intensities in the two defocus planes may be expressed as, I1 = | a1 |2 = | H1 * A |2 and I2 = | a 2 |2 = | H2 * A |2 , where * represents matrix multiplication. The intensity data measured will be noisy estimates of the ideal intensities expressed by the above equations and these may be expressed as I1’ and I2’. Because of the noise in the data there will be many complex amplitudes A that could generate the data. The principle of maximum likelihood method is to try to find the complex amplitude A with the highest probability of generating the data. Assuming the principal type of noise affecting the data is shot (or Poissonian) noise then the probability that data of the form I’ can be generated from an ideal intensity I, P(A) , can be expressed as a Poisson distribution P ( A) = e-I I I’ / I’! or P( A) e |H1*A| (| H1 * A |2 ) I / I ' ! 2 ' (1) The most likely complex amplitude is the one that maximizes this expression; hence to find this, the above expression needs to be differentiated with respect to A and set equal to zero. Direct differentiation of the above expression is difficult, however if the logarithm is taken first then the differentiation becomes more tractable. Taking a logarithm before differentiation does not affect finding the maximum as a logarithm is a monotonic function with the maximum of the logarithm at the same place as the maxima of the original function. Performing this differentiation and setting it equal to zero leads to the following equation H T * ( I '.(H * A) /(| H * A | 2 )) H T * (H * A) (2) where HT is the transpose of the matrix H, * is used to indicate matrix multiplication and ‘.’ and ‘/’ are used to indicate element-by-element multiplication and division. From this equation an iterative algorithm may be derived as follows: An+1 = An .[ (HT * ( I’ . (H *An) / ( | H* An |2) ) / HT * ( H* An) ) ] (3) where An is the n-th solution. The iteration may be started by setting A1 to have a modulus of unity within the exit pupil and to have zero phase. The iteration defined by equation (3) should lead to a complex amplitude compatible with one of the two intensity patterns. In order to find the phase unambiguously it must be compatible with both the patterns. One way to achieve this is to alternate between the two data sets during the iteration; i.e. to alternately use equation (3) with H1 and I1 and with H2 and I2 until the form of An converges to a stable form. Another method to ensure the recovered complex amplitude is compatible with both sets of data is to combine the two sets of data into a single matrix and similarly combine the two H matrices into a single H matrix that generates this combined data set. This combined algorithm is often more effective in recovering the phase in the exit pupil than the alternating method. This method will be described in more detail in a forthcoming paper [4]. One advantage of this maximum likelihood algorithm is that it requires only that the form of the transformation matrix H can be defined. In contrast the Gerchberg-Saxton algorithm requires that an inverse transformation is also possible. For low numerical aperture cases, the transformation is well-approximated by a Fourier transform and hence the inverse transform is readily available. But, for high numerical aperture cases the forward transform may be known but an inverse transformation is not generally known. The rest of this paper is an assessment of the performance of the Maximum Likelihood algorithm. 3. Algorithm Performance To assess the performance of the Maximum Likelihood (or ML) algorithm, a computer program has been used to simulate imaging through a lens suffering from astigmatism with a numerical aperture of 0.2 and with light of wavelength 500nm. Poissonian noise is added to the data generated to simulate detection by a CCD camera with a maximum of 30,000 electrons /pixel. Examples are shown in Figure 1. Figure (2) shows the true aberration phase and the aberration phase recovered by the ML algorithm after 40 iterations of the combined algorithm. Figure 2.left is aberration used in the computer simulation ,right is the phase recovered by ML algorithm after 40 iterations It may be seen that visually the recovered phase is a good representation of the true aberration. A more quantitative measure of the accuracy is given by calculating the rms deviation (measured in radians) between the true phase and the recovered phase. This is shown in figure(3) as a function of the iteration number. For comparison the results of the Gerchberg algorithm are also shown. Figure 3 plots of RMS deviation between the true phase and recovered phase against the iteration number for ML and Gerchberg-Saxton algorithms It may be seen that the Gerchberg-Saxton algorithm has converged more rapidly but that the combined ML method has produced a lower rms value after about 5 iterations. Simulations at other noise levels also show that generally the ML algorithm gives a slightly lower rms value than the Gerchberg_Saxton method achieves. Probably of more importance is that the ML algorithm performs well for a range of defocus values, this will be discussed further in a forthcoming paper. 4. Experimental Results To test the proposed algorithm with an experimental data, a simple imaging system was used with a 200mm focal length lens that was set at an angle of 21 degrees to the optical axis to deliberately introduce (principally astigmatic) aberrations. The two defocused intensity patterns recorded using a high quality 12-bit CCD camera are shown in figure 4. They show the expected elongation in orthogonal directions associated with astigmatism. Figure 4 two defocused intensity patterns recorded using a high quality 12-bit CCD camera Figure 5 shows the aberration phase recovered from the ML algorithm together with the phase calculated according to aberration theory. Figure 5 left is the phase recovered using the data from figure 4, right is the theoretical calculated aberration The close agreement between the results of the phase recovered from the experimental data and the theoretical prediction are very encouraging. 5. Conclusions An algorithm for recovering phase information from two intensity patterns based on the Maximum Likelihood principle has been described. This approach has the inherent advantage that it requires only the forward transformation matrix (from the exit pupil to the defocused image plane) to be known, not its inverse. The performance of the algorithm has been compared through computer simulation with the standard GerchbergSaxton algorithm and the ML method produces improved results. The method has also been tested on experimental data and has recovered an aberration phase that agrees well with the theoretical prediction for the aberration. 6. References 1. see e.g. J Dyson ‘ Interferometry as a Measuring Tool’, The Machinery Publishing Co Ltd. 1970. 2. J R Fienup ‘Phase retrieval algorithm: a comparison’ Applied Optics / Vol. 21, No. 15 / 1 August 1982 3. R. W. Gerchberg and W. 0. Saxton, Optik 35, 237 (1972). 4. Yan Jiao and John Walker ‘A Maximum Likelihood approach to Wavefront Sensing’, paper in preparation for Optics Communications, 2006. 5. V.N.Mahajan ‘Optical imaging and Aberration(Part 2)’ SPIE,2004.