Optimization of Virtual Shack-Hartmann Wavefront Sensing

Virtual Shack–Hartmann wavefront sensing (vSHWS) can flexibly adjust parameters to meet different requirements without changing the system, and it is a promising means for aberration measurement. However, how to optimize its parameters to achieve the best performance is rarely discussed. In this work, the data processing procedure and methods of vSHWS were demonstrated by using a set of normal human ocular aberrations as an example. The shapes (round and square) of a virtual lenslet, the zero-padding of the sub-aperture electric field, sub-aperture number, as well as the sequences (before and after diffraction calculation), algorithms, and interval of data interpolation, were analyzed to find the optimal configuration. The effect of the above optimizations on its anti-noise performance was also studied. The Zernike coefficient errors and the root mean square of the wavefront error between the reconstructed and preset wavefronts were used for performance evaluation. The performance of the optimized vSHWS could be significantly improved compared to that of a non-optimized one, which was also verified with 20 sets of clinical human ocular aberrations. This work makes the vSHWS’s implementation clearer, and the optimization methods and the obtained results are of great significance for its applications.


Introduction
Shack-Hartmann wavefront sensing (SHWS) [1] is currently the main means of wavefront aberration measurements in astronomy [2], high-energy laser [3], retinal imaging [4], optical communication [5], and optical testing [6] due to its simple principle. SHWS consists of a lenslet array (LA) and a 2D detector. Each lenslet is a sub-aperture, and the incident beam is divided into multiple individual sub-beams and is then focused on the 2D detector by the LA. The focused spots of a collimated incident beam with a planar wavefront are defined as the reference spots without wavefront aberrations. By measuring the displacement ∆s of the focused spot centroid from the reference spot centroid, the slope θ of a sub-wavefront can be obtained by θ = ∆s/F, where F is the focal length of lenslet. After obtaining all the sub-wavefront slopes, the entire wavefront at the pupil can be calculated by using a reconstruction algorithm [7]. A one-shot signal capturing in a time on the order of a millisecond to obtain the entire wavefront [8] allows for real-time aberration measurements. Although the parameters of SHWS can be carefully designed to meet a determinate application requirement, there are still some limitations in practice: First, due to the use of LA, the system and alignment are more complex, and larger noncommon-path errors between wavefront sensing and science paths may be introduced. Second, it is difficult to change the LA to meet different aberration measurements once it has been produced and mounted in system because the sub-aperture number is related to the maximum order of the Zernike aberrations that can be measured reliably [9]. Lastly,

Implementation of vSHWS
The complex electric field E to be analyzed needs to be obtained first by using any method, such as a four-step phase shifting interferometry. In detail, four interference images I 1 , I 2 , I 3 and I 4 can be obtain, and E is given by [11]: where const is a constant, ∆ϕ is the phase difference between the sample and reference arms, and i is the imaginary sign. The working procedure of vSHWS is briefly described as follows: Generate a v-LA matrix, then multiply E by the v-LA matrix to obtain an amplitude-filtered E. Divide the amplitude-filtered E into multiple sub-areas corresponding to virtual sub-apertures, and then calculate the Fraunhofer diffraction of each sub-area to obtain diffracted spot at the focal plane of the v-LA. Calculate the centroid positions of all diffracted spots, and calculate the slopes of all sub-aperture wavefronts by using the displacements between the calculated and reference centroid positions. Finally, find the Zernike coefficients via least-squares fitting the slopes with the Zernike polynomials, and then reconstruct the wavefront by using the Zernike coefficients.
The following was performed by way of example to illustrate the working procedure of vSHWS in detail. The effective area detecting the interference images was assumed to 1200 × 1200 pixels, i.e., the wavefront W P to be measured was sampled by 1200 × 1200 points, the pixel size of the 2D detector was 10 µm, the wavelength λ was 780 nm, and the focal length F of the virtual lenslet was 10 mm. All the values were within the ranges of commercial devices. According to Equation (1), the preset E to be processed can be generated by where the amplitude A is set to 1 in this study, W P is the preset wavefront, and (2π/λ·W P ) is equal to ∆ϕ in Equation (1). W P was generated by using a set of Zernike coefficients of human ocular aberrations [23,24], which were statistical results obtained by measuring 200 healthy and normal eyes at a pupil diameter of 6 mm [25]. Figure 1a shows the W P including from the 4th to 36th terms of the Zernike coefficients (i.e., 7-order aberrations usually need to be measured and corrected in adaptive optics ophthalmic imaging), and its peak-to-valley (PV) and root mean square (RMS) are 13.454 λ and 2.585 λ, respectively. The Zernike order used in this article is the standard arrangement recommended by the Optical Society of America [26]. The first three terms of the Zernike aberrations, including the piston, tip, and tilt, usually cannot be sensed and are thus excluded. The real part of the preset E is shown in Figure 1b. We then used vSHWS to process E to obtain the Zernike coefficients; a reconstructed wavefront W R was obtained by using the obtained Zernike coefficients, and the performance of vSHWS could be evaluated by comparing W R and W P . E can be expressed by a matrix, and the shape of its effective area illuminated by the beam is usually a round. After digitally dividing the entire amplitude-filtered E into multiple sub-apertures, only the sub-apertures filled with the effective E signal can be reserved, called effective sub-apertures. According to the design principle of SHWS, the number of the effective sub-apertures should not be less than the number of the Zernike coefficients that need to be calculated reliably [16]. The shape of the virtual lenslet was designed to be round first. The arrangement of the sub-apertures was a 20 × 20 grid; a single sub-aperture was thus sampled by 60 × 60 points, and the number of the effective sub-apertures was 276. Figure 1c shows the arrangement of the sub-apertures, and each cyan grid represents a sub-aperture. In fact, it is a 2D transmittance function, where the transmittances are 1 at the white areas and 0 at the black areas. The obtained E matrix was multiplied by the transmittance matrix, and then the data in each sub-aperture were taken out separately to obtain the E 0 matrix that is passed through a single virtual lenslet. Figure 1d shows the real part of the amplitude-filtered E.  E can be expressed by a matrix, and the shape of its effective area illuminated by the beam is usually a round. After digitally dividing the entire amplitude-filtered E into multiple sub-apertures, only the sub-apertures filled with the effective E signal can be reserved, called effective sub-apertures. According to the design principle of SHWS, the number of the effective sub-apertures should not be less than the number of the Zernike coefficients that need to be calculated reliably [16]. The shape of the virtual lenslet was designed to be round first. The arrangement of the sub-apertures was a 20 × 20 grid; a single sub-aperture was thus sampled by 60 × 60 points, and the number of the effective sub-apertures was 276. Figure 1c shows the arrangement of the sub-apertures, and each cyan grid represents a sub-aperture. In fact, it is a 2D transmittance function, where the transmittances are 1 at the white areas and 0 at the black areas. The obtained E matrix was multiplied by the transmittance matrix, and then the data in each sub-aperture were taken out separately to obtain the E0 matrix that is passed through a single virtual lenslet. Figure  1d shows the real part of the amplitude-filtered E. The Fraunhofer diffraction [27] of the E 0 in each sub-aperture was calculated separately to simulate the processes in SHWS, i.e., light propagating through an LA and then focused on a 2D detector by the LA. Taking the geometric focal length F [15] of the virtual lenslet as the observation distance of the Fraunhofer diffraction, the diffracted electric field E F on the 2D detector is given by the following [27,28]: where (x 0 , y 0 ) and (x F , y F ) are the coordinates of the incident E 0 and diffracted E F , respectively; wavenumber k=2π/λ; and FT[·] is Fourier transform. Therefore, the diffracted spot I F , i.e., the intensity of E F , is given by where Conj[·] means conjugate calculation. The side length L of the diffracted spot I F is given by the following [18]: where N is the sample point number of E 0 , and L 0 is the side length of E 0 in a square shape and is 0.6 mm in this example. Figure 1e shows the diffracted spots of the entire aperture. The centroid position of each diffracted spot was calculated and then compared with the corresponding reference position to obtain the displacement vector of the centroid. Figure 1f shows the calculated and the reference centroid positions, and Figure 1g shows the displacement vectors of the centroids. The slope of each sub-aperture wavefront was obtained by using the displacement vector, and the Zernike coefficients shown as Figure 1h were calculated by using a Zernike modal reconstruction [7]. The wavefront W R shown as Figure 1i was reconstructed by using the obtained Zernike coefficients, and its PV and RMS were 13.558 and 2.633 λ, respectively, close to those of W P shown as Figure 1a. The Zernike coefficient errors and the wavefront error between W P and W R are shown in Figure 2a

Optimization of vSHWS
Step by step, the parameters obtained from the previous optimizations were used as the preset parameters for the next optimization, until all optimizations were completed. For the 1200 × 1200 sample points of WP, it is convenient to use different sub-aperture sizes, such as 30 × 30 and 80 × 80 points, etc., because it can be divisible by more sizes. The

Optimization of vSHWS
Step by step, the parameters obtained from the previous optimizations were used as the preset parameters for the next optimization, until all optimizations were completed. For the 1200 × 1200 sample points of W P , it is convenient to use different sub-aperture sizes, such as 30 × 30 and 80 × 80 points, etc., because it can be divisible by more sizes. The changes of the Zernike coefficients under different parameters and the RMS of the wavefront error between W R and W P were used to evaluate the performance of the vSHWS.
There are mainly three shapes for the lenslet of a commercial LA: round (e.g., MLA300-14AR, Thorlabs Inc., Newton, NJ, USA), square (e.g., MLA150-7AR, Thorlabs), and hexagonal (e.g., AHP-Q-P1000-R3, AMS Inc., Ismaning, Germany). Accordingly, the shape of the virtual lenslet, i.e., the light-transmitting sub-aperture, also has three options. Although an LA with hexagonal lenslets has a higher fill factor, i.e., higher signal utilization efficiency (close to 100%), its shape dividing and data processing are more complicated. Therefore, only the v-LAs with round and square lenslets were investigated in this study. The v-LA with round virtual lenslets was investigated in Section 2.1, but that with square virtual lenslets should theoretically have a better performance due to its higher fill factor (also close to 100%). In order to verify whether this theoretical intuition was true, the shape of the virtual lenslets was changed to be square without changing other parameters, and then the processing procedure described in Section 2.1 was repeated to obtain the results. The Zernike coefficient errors and the RMSs of the wavefront errors obtained from the two simulations with the round and square virtual lenslets were compared to find the better one.
In SHWS, all sub-beams are focused on the 2D detector by the LA, simultaneously. If the slope of a local sub-wavefront is too large, the focused spot falls outside its subaperture area on the detector and forms overlapped spots and spot crossovers with the adjacent sub-apertures, which limits the dynamic range of SHWS. By contrast, in vSHWS, the data of each sub-aperture is processed individually, and thus the focused spot never overlaps with others. It can be seen from Equation (5) that L is a function of N and L 0 ; if N and L 0 are increased by the same times, L does not change, but the sampling frequency of the observation plane increases. Therefore, the performance of vSHWS can be improved by expanding E 0 , or more specifically, by zero-padding E 0 , i.e., padding zeros to the edge of E 0 to increase N. The expansion ratio was increased from 1 (implying no padding), and the RMS plots of the wavefront errors varying with the expansion ratio were recorded to determine the optimal expansion ratio, which had a balanced performance and computation burden.
The size of the illuminated area on the image plane is a constant in a system, i.e., the sample point of the detected E is definite, and thus there is a negative correlation between the size and number of the sub-aperture. There is a trade-off between them: a larger sub-aperture size means that more light signals can be used for spot centroid calculation, facilitating accurate wavefront measurement; however, increasing the subaperture size reduces its number and accordingly decreases the spatial sampling rate of the wavefront, which limits the accuracy of wavefront sensing. Therefore, an appropriate subaperture number is important for both SHWS and vSHWS. Unlike SHWS, the sub-aperture number of vSHWS can be adjusted easily, which is beneficial for dynamically adjusting the performance of wavefront sensing. While maintaining 1200 × 1200 sample points of the preset E, the sub-aperture number was set to 10 × 10, 12 × 12, 15 × 15, 20 × 20, 24 × 24, 30 × 30, 40 × 40, and 60 × 60 to reconstruct W P sequentially. The RMSs of the wavefront errors between W R and W P were calculated to find the optimal sub-aperture number.
The focused spot centroid can be calculated more accurately by using a 2D detector with a smaller pixel size, which can improve the sensitivity of wavefront sensing. However, a smaller size pixel is more sensitive to noise, which reduces the accuracy of wavefront sensing. The pixel size of a used 2D detector cannot be changed, and thus data interpolation may be a way to improve the performance of wavefront sensing. The data interpolation can be performed before or after the diffraction calculation (DC), i.e., performed on the sub-aperture E 0 or the diffracted spot I F , and the interpolation algorithm and interval can also be flexibly changed. Therefore, two interpolation sequences (i.e., before and after the DC), commonly used three interpolation algorithms (i.e., linear, cubic, and spline), and different interpolation intervals were investigated so that we could observe their effects on the performance of vSHWS and subsequently find their optimal combination with the highest accuracy of wavefront sensing.

Shape of Virtual Lenslet
Except for changing the shape of the virtual lenslets from round to square, as shown in Figure 2c, the same procedure and parameters as in Section 2.1 were used to reconstruct the preset wavefront W P , and the results are shown in Figure 2d,e. In comparing Figure 2a,d, it can be seen that the Zernike coefficient errors obtained by using the round lenslets are about an order of magnitude smaller than those obtained by using the square lenslets. Figure 2b,e shows the wavefront errors when using the round and the square lenslets, respectively; it can also be seen that the RMS (0.088 λ) when using the former is also an order of magnitude smaller than when using the latter (RMS = 0.971 λ). Therefore, the performance of vSHWS when using the round lenslets is significantly better than when using the square lenslets, which is contrary to the expectation that the latter with a higher fill factor should have a better performance. The reason might be that in order to facilitate the calculation, the round transmitting area of each round lenslet was zero-padded to form a matrix, which was essentially a pre-zero-padding of E 0 and thus could improve the performance, but there was no such pre-zero-padding for each square lenslet. This assumption would be confirmed in Section 3.2.

Zero-Padding of Sub-Aperture Electric Field
The vSHWS can avoid the phenomena of overlapped spots and spot crossover between the adjacent sub-apertures caused by the excessive slope of the sub-wavefront, and thus has a high dynamic range. The zero-padding of the sub-aperture electric field E 0 makes the centroid calculation more accurate. Figure 3a shows the RMS plots of wavefront errors varying with the expansion ratio. We can make a number of observations here: First, the zero-padding of E 0 can significantly improve the performance, especially with the RMS being decreased by two orders of magnitude when using the square lenslets. Second, the vSHWS using the round lenslets performs better when the expansion ratio is less than ≈1.53, but the situation gets reversed when the expansion ratio is greater than ≈1.53, which confirms the assumption in Section 3.1. Third, the RMS plots tend to be flat when the expansion ratio is large enough, but it occurs more later when using the square lenslets. Lastly, the optimal expansion ratios are about 1.8 and 2.2 for using the round and square lenslets, respectively; the performance gain is very limited, but the computation burden is greatly increased when the expansion ratios continue to increase. Figure 3b,c shows respectively the Zernike coefficient errors at expansion ratios of 1.4 and 1.8 when using the round lenslets and also those at expansion ratios of 1.4 and 2.2 when using the square lenslets. By changing the expansion ratios from 1.4 to the optimal values, the changes of the Zernike coefficient errors of vSHWS with the round lenslets were less than those with the square lenslets. The Zernike coefficient errors in Figure 3c are smaller than those in Figure 3b at the corresponding optimal expansion ratios. Both of these results are consistent with the results in Figure 3a. shows respectively the Zernike coefficient errors at expansion ratios of 1.4 and 1.8 when using the round lenslets and also those at expansion ratios of 1.4 and 2.2 when using the square lenslets. By changing the expansion ratios from 1.4 to the optimal values, the changes of the Zernike coefficient errors of vSHWS with the round lenslets were less than those with the square lenslets. The Zernike coefficient errors in Figure 3c are smaller than those in Figure 3b at the corresponding optimal expansion ratios. Both of these results are consistent with the results in Figure 3a.

Number of Sub-Apertures
The RMSs of the wavefront errors varying with the sub-aperture number are shown in Figure 4a, and it can be seen that (1) the effects of the sub-aperture number on the performance of vSHWS are similar for using the round and square lenslets; (2) when the subaperture number is changed from small to large, the wavefront errors decrease first and then increase, which is consistent with the theoretic analysis in Section 2.2; (3) the optimal sub-aperture numbers are 12 × 12 and 15 × 15 for the round and square lenslets, respectively; (4) compared with the previous results (RMSs of 8.150 × 10 −3 λ and 4.520 × 10 −3 λ for the round and square lenslets, respectively) at a sub-aperture number of 20 × 20 shown in Figure 3a, the RMSs decrease at the optimal sub-aperture numbers for both the round (3.106 × 10 −3 λ) and square (2.378 × 10 −3 λ) lenslets. Figure 4b,c shows the Zernike coefficient errors at sub-aperture numbers of 30 × 30 and 12 × 12 when using the round lenslets, and those at sub-aperture numbers of 30 × 30 and 15 × 15 when using the square lenslets, respectively. The Zernike coefficient errors at low modes (less than about the 21th term) are significantly decreased at the optimized sub-aperture numbers.

Number of Sub-Apertures
The RMSs of the wavefront errors varying with the sub-aperture number are shown in Figure 4a, and it can be seen that (1) the effects of the sub-aperture number on the performance of vSHWS are similar for using the round and square lenslets; (2) when the subaperture number is changed from small to large, the wavefront errors decrease first and then increase, which is consistent with the theoretic analysis in Section 2.2; (3) the optimal subaperture numbers are 12 × 12 and 15 × 15 for the round and square lenslets, respectively; (4) compared with the previous results (RMSs of 8.150 × 10 −3 λ and 4.520 × 10 −3 λ for the round and square lenslets, respectively) at a sub-aperture number of 20 × 20 shown in Figure 3a, the RMSs decrease at the optimal sub-aperture numbers for both the round (3.106 × 10 −3 λ) and square (2.378 × 10 −3 λ) lenslets. Figure 4b,c shows the Zernike coefficient errors at sub-aperture numbers of 30 × 30 and 12 × 12 when using the round lenslets, and those at sub-aperture numbers of 30 × 30 and 15 × 15 when using the square lenslets, respectively. The Zernike coefficient errors at low modes (less than about the 21th term) are significantly decreased at the optimized sub-aperture numbers.

Data Interpolation
Using three interpolation algorithms and the two interpolation sequences, the effect of changing the interpolation interval on the performance of vSHWS using the square lenslets was studied, and the results are shown in Figure 5. An interpolation interval of less than 0.2 pixels was not considered because the data amount was too large to be calculated and the obtained RMSs were low enough at this interval. Figure 5a,b shows the RMS plots of the wavefront errors varying with the interpolation interval when applying the three interpolation algorithms before and after the DC, respectively. When performing interpolation before the DC, we noted the following: (1) the RMS plots obtained by using

Data Interpolation
Using three interpolation algorithms and the two interpolation sequences, the effect of changing the interpolation interval on the performance of vSHWS using the square lenslets was studied, and the results are shown in Figure 5. An interpolation interval of less than 0.2 pixels was not considered because the data amount was too large to be calculated  Figure 5a,b shows the RMS plots of the wavefront errors varying with the interpolation interval when applying the three interpolation algorithms before and after the DC, respectively. When performing interpolation before the DC, we noted the following: (1) the RMS plots obtained by using the spline and cubic algorithms are similar, but that of the former is a little smaller; (2) compared with the previous optimal result (RMS of 2.378 × 10 −3 λ) in Figure 4a, the spline algorithm reduces the RMS by two orders of magnitude to 5.671 × 10 −5 λ at interpolation interval of 0.7 pixels; (3) the performance improvement of vSHWS is no longer obvious when the interpolation interval is less than 0.7 pixels. When performing interpolation after the DC, we noted the following: (1) the RMS plots obtained by using the spline and cubic algorithms are still similar but that obtained by using the latter is a little smaller, and their minimums appear at interpolation interval of 0.5 pixels and are 8.653 × 10 −4 λ and 1.489 × 10 −4 λ, respectively; (2) all the algorithms are unstable, especially the linear. If the interpolation is performed before the DC, the requirement of the interpolation interval will be low. Figure 5c shows the Zernike coefficient errors obtained by performing interpolation before and after the DC and by adopting the spline algorithm and an interpolation interval of 0.5 pixels. From it we can see that the Zernike coefficient errors obtained by performing data interpolation before the DC were much smaller compared with those obtained by performing data interpolation after the DC.

Results of Parameter Optimizations
So far, the optimal parameters of vSHWS were determined to be as follows: (1) a square shape for the virtual lenslets, (2) an expansion ratio of 2.2 times for the zero-padding of E0, (3) a sub-aperture number of 15 × 15, (4) performing interpolation before the DC, (5) using spline interpolation algorithm, and (6) an interpolation interval of 0.5 pixels. These optimal parameters were adopted to reconstruct WP. Figure 6a,b shows the Zernike coefficients of WP and WR, respectively, as well as their errors. Comparing the results shown in Figures 2d and 6b, it can be seen that the Zernike coefficient errors were reduced by four orders of magnitude. Figure 6c shows the wavefront error under the optimal configuration. Comparing the results shown in Figures 2e and 6c, it can be seen that PV of the wavefront error was reduced from 3.858 λ to 5.745 × 10 −4 λ, and RMS of the wavefront error was reduced from 0.971 λ to 5.653 × 10 −5 λ. These results illustrate that the performance of vSHWS can be significantly improved by optimizing the parameters.

Results of Parameter Optimizations
So far, the optimal parameters of vSHWS were determined to be as follows: (1) a square shape for the virtual lenslets, (2) an expansion ratio of 2.2 times for the zero-padding of E 0 , (3) a sub-aperture number of 15 × 15, (4) performing interpolation before the DC, (5) using spline interpolation algorithm, and (6) an interpolation interval of 0.5 pixels. These optimal parameters were adopted to reconstruct W P . Figure 6a,b shows the Zernike coefficients of W P and W R , respectively, as well as their errors. Comparing the results shown in Figures 2d and 6b, it can be seen that the Zernike coefficient errors were reduced by four orders of magnitude. Figure 6c shows the wavefront error under the optimal configuration. Comparing the results shown in Figures 2e and 6c, it can be seen that PV of the wavefront error was reduced from 3.858 λ to 5.745 × 10 −4 λ, and RMS of the wavefront error was reduced from 0.971 λ to 5.653 × 10 −5 λ. These results illustrate that the performance of vSHWS can be significantly improved by optimizing the parameters. coefficients of WP and WR, respectively, as well as their errors. Comparing the results shown in Figures 2d and 6b, it can be seen that the Zernike coefficient errors were reduced by four orders of magnitude. Figure 6c shows the wavefront error under the optimal configuration. Comparing the results shown in Figures 2e and 6c, it can be seen that PV of the wavefront error was reduced from 3.858 λ to 5.745 × 10 −4 λ, and RMS of the wavefront error was reduced from 0.971 λ to 5.653 × 10 −5 λ. These results illustrate that the performance of vSHWS can be significantly improved by optimizing the parameters.

Anti-Noise Performance
The effect of the parameter optimizations on the anti-noise performance of vSHWS was also investigated. Different white Gaussian noises were added to WP to generate the wavefronts with different signal-to-noise ratios (SNRs), which were calculated in decibel units on 10·log10. These wavefronts were then reconstructed by using the non-optimized and optimized vSHWS, respectively. The non-optimized vSHWS was configured as follows: square virtual lenslets, sub-aperture number of 20 × 20, expansion ratio of 1.2 times for the zero-padding of E0, and no data interpolation. The real part of E with an SNR of 30

Anti-Noise Performance
The effect of the parameter optimizations on the anti-noise performance of vSHWS was also investigated. Different white Gaussian noises were added to W P to generate the wavefronts with different signal-to-noise ratios (SNRs), which were calculated in decibel units on 10·log10. These wavefronts were then reconstructed by using the non-optimized and optimized vSHWS, respectively. The non-optimized vSHWS was configured as follows: square virtual lenslets, sub-aperture number of 20 × 20, expansion ratio of 1.2 times for the zero-padding of E 0 , and no data interpolation. The real part of E with an SNR of 30 dB is shown in Figure 7a as an example, and it is seriously blurred. Figure 7b,c shows the Zernike coefficient errors obtained by using the optimized vSHWS at SNRs of 30 and 100 dB, respectively, and it can be seen that the Zernike coefficient errors are much smaller at SNR of 100 dB. The RMS plots of the wavefront errors varying with SNR are shown in Figure 7d. All the RMSs obtained by the optimized vSHWS were smaller than those obtained by the non-optimized vSHWS, illustrating that the anti-noise performance was improved by the parameter optimizations. The RMS plot tends to be flat from SNR of ≈45 dB for the non-optimized vSHWS, while it appears from SNR of ≈100 dB for the optimized vSHWS. In addition, at an SNR of 100 dB, the RMS (6.316 × 10 −5 λ) obtained by the optimized vSHWS was three orders of magnitude smaller than that (2.770 × 10 −2 λ) obtained by the non-optimized vSHWS. The two results illustrate that the optimized vSHWS gains more benefit at high SNR.

Clinical Human Ocular Aberrations
In order to avoid the obtained occasional results shown above when using only one set of data, 20 sets of clinical human ocular aberrations were also used to evaluate the performance of the optimized vSHWS. The data were clinically collected with an aberrometer (KR-1W, Topcon Corp, Tokyo, Japan) at a pupil diameter of 6 mm from 20 patients at the Eye Hospital of Wenzhou Medical University. They were diagnosed by experienced physicians to two groups: 10 normal eye patients with an age range from 6 to 75 years with a mean age of 38 years, and 10 diseased eye patients with an age range from 19 to 58 years with a mean age of 37.8 years. Data processing was performed the same way as previously: First, the Zernike coefficients were used to generate the preset E, and then the optimized vSHWS was used to obtain the Zernike coefficients from the preset E. The Zernike coefficient errors, RMS, and PV of the wavefront errors between W R and W P for every eye were recorded, and the statistical Zernike coefficient errors for all normal and all diseased eyes were finally obtained. proved by the parameter optimizations. The RMS plot tends to be flat from SNR for the non-optimized vSHWS, while it appears from SNR of ≈100 dB for the vSHWS. In addition, at an SNR of 100 dB, the RMS (6.316 × 10 −5 λ) obtained b mized vSHWS was three orders of magnitude smaller than that (2.770 × 10 −2 λ by the non-optimized vSHWS. The two results illustrate that the optimized vSH more benefit at high SNR.

Clinical Human Ocular Aberrations
In order to avoid the obtained occasional results shown above when usin set of data, 20 sets of clinical human ocular aberrations were also used to ev performance of the optimized vSHWS. The data were clinically collected wit rometer (KR-1W, Topcon Corp, Tokyo, Japan) at a pupil diameter of 6 mm fr tients at the Eye Hospital of Wenzhou Medical University. They were diagnose rienced physicians to two groups: 10 normal eye patients with an age range fr years with a mean age of 38 years, and 10 diseased eye patients with an age r 19 to 58 years with a mean age of 37.8 years. Data processing was performed way as previously: First, the Zernike coefficients were used to generate the pre then the optimized vSHWS was used to obtain the Zernike coefficients from th The Zernike coefficient errors, RMS, and PV of the wavefront errors between W As an example, Figure 8a,b shows the wavefront error and the Zernike coefficient errors when using the data from a normal eye (Patient 5 in Table 1), respectively. Figure 8c shows the statistical Zernike coefficient errors with a form of mean ± 2SDs (standard deviations) for all the normal eyes' aberrations. Similarly, the same terms are shown in Figure 8d,e for a diseased eye (Patient 5 in Table 1) and in Figure 8f for all the diseased eyes. From Figure 8c,f, it can be found that all the mean ± 2SDs' absolute values of the Zernike coefficient errors, except for the 5th term (i.e., the defocus), are less than 7 × 10 −4 µm for both the normal and diseased eyes, although these values (on the order of 10 −4 µm) are increased by two orders of magnitude compared to the result (on the order of 10 −6 µm) in Figure 6b, but still small. The worst from the 5th term is less than 2 × 10 −3 µm for both the normal and diseased eyes, and it is also not too large. The RMSs and PVs of the obtained wavefront errors for every patient are listed in Table 1. Most of the RMSs are on the order of 10 −5 λ for the normal eye and 10 −4 λ for the diseased eye, and most of the PVs are on the order of 10 −4 λ for all eyes. The worst RMS and PV (Patient 2 of normal eye in Table 1) are still on the order of 10 −3 λ and 10 −2 λ, respectively. Therefore, the results obtained by using clinical data with 20 samples demonstrated that as a whole, the optimized vSHWS has a high performance for wavefront sensing. the normal and diseased eyes, and it is also not too large. The RMSs and PVs of the obtained wavefront errors for every patient are listed in Table 1. Most of the RMSs are on the order of 10 −5 λ for the normal eye and 10 −4 λ for the diseased eye, and most of the PVs are on the order of 10 −4 λ for all eyes. The worst RMS and PV (Patient 2 of normal eye in Table 1) are still on the order of 10 −3 λ and 10 −2 λ, respectively. Therefore, the results obtained by using clinical data with 20 samples demonstrated that as a whole, the optimized vSHWS has a high performance for wavefront sensing.

Discussion
The complex electric field E of the beam at the pupil needs to be obtained first by using a designated method for the task, such as interferometry, and then vSHWS can be used to obtain wavefront aberrations. Currently, vSHWS is usually used for CGWS. We saw that vSHWS is more stable against the phase singularities compared to the methods for performing phase unwrapping directly [14]. Therefore, their combination, i.e., CG-vSHWS, is suitable for the aberration measurements of inhomogeneous biological specimens. The main disadvantage of CG-vSHWS is that interferometry complicates the system and alignment, but it is no longer a problem when it is combined with adaptive optics optical coherence tomography.
There are many algorithms for centroid calculation, such as calculating first-order moment, windowing, and thresholding [29,30], etc. The first one was used in this work, due to its simple principle and fast calculation speed. However, this algorithm becomes unstable as the noise becomes strong, and a more stable algorithm should be used in practice. Wavefront reconstruction algorithms can be classified into zonal and modal reconstructions [7], and the Zernike reconstruction used in this work is a kind of the latter. In addition, there are also Taylor reconstruction, Fourier reconstruction, and iterative Fourier reconstruction to be used.
From Figure 3a, we can see that the zero-padding of E 0 can significantly improve the performance of vSHWS. The optimal RMS (4.520 × 10 −3 λ) of the wavefront error when using the square lenslets is smaller than that (8.150 × 10 −3 λ) when using the round lenslets because the v-LA composed of the square lenslets has a higher fill factor and thus uses more E information. However, the round lenslets should still be considered a candidate that can be used for the following occasions: (1) the performance of vSHWS using the round lenslets is better when a low expansion ratio is required to reduce the computation burden; (2) there is not much difference between the RMSs of the wavefront errors obtained by using the round and square lenslets at their corresponding optimal expansion ratios, but the calculation burden of the latter is increased.
Data interpolation can improve data density, which is beneficial for improving the accuracy of centroid calculation and thus improve the sensitivity of wavefront sensing. The results from Figure 5 indicate that a proper interpolation strategy can significantly improve the performance of vSHWS. We can see from Figure 5b that the RMSs of the wavefront errors obtained at some interpolation intervals, such as 0.6, 0.8, and 0.9 pixels, are higher than those obtained without data interpolation. The reason may be that an improper interpolation interval causes too much original data loss during resampling. Therefore, the interpolation intervals that should be used are the ones where we can obtain as much original data as possible, and those satisfying the Nyquist-Shannon sampling theorem are recommended, especially when performing interpolation after the DC. Comparing Figure 5a,b, we can see that performing interpolation before the DC is a better choice for all the interpolation algorithms. However, not only the RMS of the wavefront error but also the computation burden should be considered in practice, especially for real-time aberration measurement. Because the time-consuming fast Fourier transform is required for the DC, the computation burden of performing interpolation after the DC is less than that before the DC. On the premise that the accuracy of wavefront sensing meets the application requirement, it is recommended to perform interpolation after the DC.
For SHWS, the focused spot position is confined by the sub-aperture size [31], and there is a trade-off between the dynamic range and the sensitivity. The focal length F of the lenslet is an important parameter for SHWS because it is related to both the dynamic range and the sensitivity [16]. For vSHWS, both the dynamic range and the sensitivity can be increased because E 0 is processed separately, and the focused spot centroid can be calculated no matter how the wavefront is distorted. Equation (5) shows that the centroid displacement ∆s is related to F, but F is eliminated when calculating the wavefront slope θ. Therefore, F of the virtual lenslet may not affect the performance of vSHWS. In order to verify this assumption, W P was reconstructed by the optimized vSHWS at different F from 5 to 150 mm. The result shows that the RMS of the wavefront error almost did not change (the maximal change was 9.932 × 10 −13 λ), and the above assumption was verified to be accurate.
The data processing time of vSHWS was longer than that of SHWS because it calculates the light propagation and performs the zero-padding and the data interpolation. However, these calculations are easy to complete for a well-configured computer. We ran the programs of an optimized vSHWS and a real SHWS to process the same set of wavefront aberrations for 10 times on a same PC; the runtimes were recorded, and the averages were obtained to be 3.367 s and 1.621 s, respectively. We can see that the former is about twice the latter, but they are still on the same order of magnitude. Furthermore, the processing time of vSHWS can be reduced by improving the processing algorithms and the PC's performance, and in this way it can meet the requirements of most applications.
For real SHWS, an incident beam is divided into multiple sub-beams and then is focused on a 2D detector by an LA. For vSHWS, the above process used is a Fresnel diffraction approximation, which is a general method for diffraction calculation and is widely used in physical optics. Therefore, the computation error indeed exists in vSHWS, but it does not have a big impact on the result.
The method for obtaining the optimal parameters is the focus of this work. In principle, the obtained optimal parameters in this work cannot be used as a general standard of vSHWS, and they should be found out according to detailed requirement and special application. Fortunately, the study in Section 3.7 demonstrated that the optimized vSHWS obtained with a set of ocular aberrations also worked well when it was used for other aberrations directly. Therefore, some results and conclusions in this work may be adopted by other works if their measurement conditions are similar to our conditions.

Conclusions
The working process of vSHWS was described in detail, and some optimization methods were used to improve the performance. The wavefront to be measured was preset by using a set of Zernike coefficients of normal human ocular aberrations, and the procedure and methods for reconstructing the preset wavefront using vSHWS were shown. The effects of the lenslet shape, the E 0 zero-padding, the sub-aperture number, and the data interpolation of E 0 or I F , on the performance of vSHWS were studied. The Zernike coefficient errors and the RMS of the wavefront error between the reconstructed and preset wavefronts were used to evaluate the performance, and the optimal configuration of vSHWS was finally obtained. By comparing the reconstructed wavefronts obtained by the optimized and non-optimized vSHWSs, it was found that the wavefront sensing accuracy and the anti-noise performance could be significantly improved by the parameter optimizations; more specifically, the RMS of wavefront error indicating the sensing accuracy was reduced from 0.971 λ to 5.653 × 10 −5 λ in this work. The performance of the optimized vSHWS was also verified with 20 sets of clinical human ocular aberrations including normal and diseased eyes.

Data Availability Statement:
The normal human ocular aberrations used in Section 2.1 are available at Ref. [24]. The clinical human ocular aberrations used in Section 3.7 are listed in Tables A1 and A2.