Adaptive Shack-Hartmann wavefront sensor accommodating large wavefront variations

Shack-Hartmann wavefront sensors (SHWFSs) usually have fixed subaperture areas on the detector, in order to fix the minimum and maximum amounts of wavefront departure, or the dynamic range of measurement. We introduce an active approach, named Adaptive Shack Hartmann Wavefront Sensor (A-SHWFS). A-SHWFS is used to reconfigure detection subaperture areas by either blocking or unblocking desired lenslets by using an electronically modulated mask. This mask either increases or decreases the measurable aberration magnitude by placing a liquid crystal display (LCD) panel in front of the lenslet array. Depending on which control signal that is sent to the LCD, the variable, applicationdependent blocking pattern (horizontal, vertical, diagonal, uneven) makes this an adaptive and efficient sensor with a variable dynamic range of measurement. This scheme is also useful for regional blocking, which occurs when the wavefront is severely aberrated in a limited region. © 2018 Optical Society of America under the terms of the OSA Open Access Publishing Agreement


Introduction
The Shack-Hartmann wavefront sensor (SHWFS) is a well-known device for measuring a wavefront by determining its local slope distribution, or the first spatial derivative [1].It is used for a wide range of applications, including astronomy [2], ophthalmology and commercial optical testing, to name a few [1,3,4].The principle of operation for a SHWFS is that an array of small lenses (called lenslets) samples the wavefront and creates focused small spots of light in the focal plane of the lenslet array.At the nominal (i.e., unaberrated) situation in a collimated beam of light, each spot from each lenslet will be centered at the nominal or reference position on the detector (Fig. 1(a)).If the measured wavefront is aberrated, the position of the focused spots moves according to the magnitude of the local tip-tilt component of aberration (Fig. 1(b)).By measuring the new positions of the spots relative to their reference positions, we can reconstruct the slope distribution of the wavefront.The minimum and maximum amount of aberration or spatial frequency of the aberrated wavefront measurable by a SHWFS depends primarily on the focal length and size of the lenslets and the detector subapertures.A fixed optimal design of SHWFS can be dictated by a variety of factors, such as atmospheric turbulence, in the case of astronomical applications.Generally, a trade-off needs to be made in terms of resolution and dynamic range of the SHWFS, i.e., if the detection subaperture size is small, the wavefront is sampled more finely and a higher spatial resolution is produced but the maximum amount of aberration measurable for a fixed focal length becomes limited.We define dynamic range as the largest and smallest wavefront slope values that can be measured by the system.A conventional SHWFS has a fixed dynamic range of measurement but several concepts for adaptable / reconfigurable SHWFS systems have been proposed over the years.
One approach to improving the dynamic range of a traditional SHWFS is to track the movement of Hartmann spots along an optical axis by measurements at additional planes between the lenslet array and the detection plane and use a predictive algorithm to match the spots to their correct measurement locations [5].The method in [5] also makes uses of a movable relay lens and camera assembly to switch between Hartmann spot imaging and pupil imaging so that the mapping of the lenslets onto the pupil and hence an optimal size and distribution for the detector subarray can be established.Another novel approach uses an algorithm that unwraps spot dislocations and assigns spots to their correct subapertures, thereby eliminating discontinuities in the patterns of the local positions, which are wrapped modulo P, where P is the lenslet pitch [6].The technique presented in [7] uses two different measurements, a conventional image of the wavefront and the image from the classical Shack-Hartmann sensor, to estimate a parametrized description of the measured aberration.In [8], an estimate of the positions of the focal spots of neighboring lenslets is proposed by extrapolating an iterative two-dimensional spline function that assigns the spots to their respective reference points.
There are other approaches that use specially designed devices.For example, an astigmatic lenslet array that gives a characteristic mark to each spot, allowing a definite recognition of the spot even if it moves beyond its detection subaperture [9].Another approach describes a coding algorithm with a minimum number of measurement cycles to allow definitive assignment of spots if a spatial light modulation array, placed in front of the microlens array, is used to switch subapertures on and off [10].The MEMS technique in [11] is used to improve dynamic range through individual address.This method varies the mechanical resonant frequencies of individual lens-support carriages and identifies the focal spot from a particular lenslet by detecting the line image resulting from the motion of that spot.The sensor proposed in [12] replaces traditional lenslets with a microhologram array which gives a discriminable pattern to each focal spot and employs a pattern matching technique that uses cross correlation between the reconstructed images and template images.Rha et al. [13] use a reconfigurable array of Fresnel lenslets written on a phase-modulated LCD module, Zhao et al. [14] examine the customization of a digital SHWFS that uses a diffractive optical lens pattern, encoded on a spatial light modulator, as the microlens array while Yoon et al. [15] employ a translatable plate with subapertures placed conjugated to the lenslet array.By moving the plate, desired lenslets can be blocked and by taking several measurements where the plate is translated between the measurements, all focal spots can be correctly associated to their respective subapertures.
We propose an adaptive SHWFS (A-SHWFS) with the ability to change the LCD lenslet mask dynamically.This allows the sensor to change the subaperture and distribution of spatial sampling based on the aberration present in the system.While previous works on this topic may have achieved similar objectives, our method provides a simple yet powerful technique to make an adaptable SHWFS system that can be integrated into most existing SHWFS-based setups without a major system overhaul.A similar objective may be achieved by changing system parameters, such as increasing the lenslet size but that would mean making customized-and-fixed hardware (and possibly software) changes to the system such as switching out the lenslet array.Our approach applies a one-time modification to the system set-up, after which the adaptive sampling is implemented only through software control.It also does not use any complicated devices or heavy computing.Furthermore, it allows for a highly efficient, even irregular, and adaptive reconfiguration of the detection subapertures.For instance, if the measured wavefront is highly aberrated in a small area relative to the entire wavefront, only a small portion of the detection area can be used for reconfiguration to accommodate for this localized high wavefront slope change.The rest of the detection area can still maintain a high sampling.Also, it provides great flexibility in its implementation, with easy-to-apply changes.For example, the criteria for switching to a larger detection subaperture or the type of blocking / mask applied to areas with high wavefront slope change can be modified by the user per the objectives and implementation details of the application.This paper discusses the idea and implementation of our technique leveraging a fully matured economical solution, electronically modulated LCD panel, and software controls.

Actively modulated lenslet array using a LCD panel
The key to dynamically blocking and unblocking lenslets is by placing a LCD screen (without its back-light illumination unit) in front of the lenslet array as shown in Fig. 2(a).Transmission of light through the LCD can be controlled by addressing an opaque (i.e., black colored) and transparent (i.e., white colored) pattern through the computer connected to the LCD screen.The pixels where the pattern (e.g., boxes, lines, irregular zones, etc.) is black will have no light passing through them and the corresponding lenslets effectively become inactive.By matching up the lines or squares of the blocking pattern on the LCD to the lenslets, we can control each lenslet or groups of lenslets in any desired, adaptable pattern.The details of the matching and alignment process applied to the real prototype system is given in Section 3.2.The areas of the LCD where the addressed pattern is white will let light through and the corresponding lenslet or lenslets become active.Essentially, we are dynamically changing the active pattern of the lenslet array, either over the entire area of the wavefront, or only in certain sections.Then, as we block certain lenslets, the corresponding detector subaperture areas expect no focused spots, which now can be used for the neighboring spots' extended detector subaperture zones.This enables originally immeasurable highly aberrated wavefronts to be detected without being limited by mixed spots between neighboring lenslets at the expense of spatial sampling resolution as depicted in Fig. 2(b).Of course, this will be a tradeoff between the dynamic range and the spatial resolution of the wavefront mapping and can be actively optimized for a given situation.However, importantly, the detection sensitivity remains the same.

Focused spot centroiding algorithm
Due to scattering from the LCD's internal structures as well as the diffraction effect from the diamond-turned tool marks on the lenslet array, the focal plane image spots are degraded compared to the standard SHWFS without an LCD mask.Hence, an intensity-weighted centroiding algorithm was applied to determine the statistical centroid of the spots.The following equations are used to calculate image centroids: where c x and c y are coordinates of the image centroid and I is the spot intensity on the detector subaperture.
To improve the process of determining the correct spot locations, the following technique was applied.The algorithm finds the brightest spot in each subaperture region.This is implemented in our code by scanning the subaperture region, applying MATLAB's inbuilt findpeaks function [16] and comparing the values in the region to find the location of the brightest peak in that subaperture.In order to mitigate the effect from the noise background, a thresholding, which is specific to the as-built system, is applied to the findpeaks function.
Once the peak location is detected, certain area around the peak position is selected and the weighted centroiding algorithm (Eq.( 1) is applied over this area of interest.This positional information is utilized to calculate the differential spot motion indicating the local wavefront slope change.
The centroiding methodology used in this work is generic but sufficient for our applications.Many techniques, found in existing literature, may be applied to the data processing pipeline in this method and can further improve the performance of the sensor.In the meantime, the data reconstruction process, described in Section 2.3, is a novel approach and can improve or enhance the wavefront reconstruction process in many situations.

Modal wavefront reconstruction
Once the local slope data is obtained (i.e., x and y slope distribution), it can be integrated to reconstruct the wavefront.Measured slope data is processed by a modal reconstruction algorithm, based on the newly developed gradient polynomials [17], called the G  polynomial set.These polynomials are obtained from the gradients of two-dimensional Chebyshev polynomials as shown in Eq. ( 2).The scalar and vector polynomial sets are both orthogonal across a rectangular aperture, which optimally matches the format of the A-SHWFS detector. ( The scalar (F) polynomial set is a two-dimensional Chebyshev basis set, constructed from two one-dimensional Chebyshev polynomials of the first kind, as shown in Eq. ( 3).T and n T are the one-dimensional Chebyshev polynomial sets used for the construction of the scalar basis.The double index variables n and m are related to the order of the polynomials [17] while î and ĵ are unit vectors representing the axes of a Cartesian coordinate system.Figure 3 shows the quiver plots for the first three non-trivial G  polynomials.The virtue of this modal vector-based methodology is to fit the data in the measurement (i.e., slope) domain and directly obtain the gradient polynomial coefficients.These coefficients are used to obtain the coefficients of the scalar polynomials, which can then be used along with the scalar polynomial basis set to acquire the reconstructed wavefront.The scalar and vector polynomial coefficients have a one-to-one relationship.An attractive feature of this reconstruction methodology for the A-SHWFS is that it can easily deal with different kinds of non-uniform samplings.As introduced in Section 2.1 and expanded with an example in Section 4.2, the A-SHWFS can actively and efficiently vary the sampling distribution of the wavefront.The modal reconstruction method used here can handle all these situations and other variations of samplings effectively [18].
The G  polynomial modal set allows for efficient and accurate generation of up to tens of thousands of polynomial terms, employing recursive relationships for both the scalar and vector polynomial basis sets.This method gives a lower error compared to several traditional zonal and modal methods when the slope of the wavefront changes sharply or when the aperture is blocked in certain regions.Several examples of comparisons between this modal method and a traditional Southwell zonal method have been reported [17], for surface reconstructions from simulated and real data.Also included is a comparison with Zernike gradient polynomial fitting [17].From these examples, it is seen that the G  polynomials perform better (e.g., in terms of accuracy), compared to the zonal or Zernike gradient polynomial methods for various cases.As a comparative reference, Neal et al. [19] provided a detailed account of data fitting and reconstruction methods for a conventional SHWFS, as well as an in-depth investigative result of SHWFS precision and accuracy.

A-SHWFS system prototype
To demonstrate the concept and quantitatively investigate different aspects of the A-SHWFS system, a prototype was designed and built using an off-the-shelf LCD panel.This system also includes a combination of customized components such as a diamond-turned lenslet array.

Overall system layout and configuration
Light from a laser source goes through a spatial filter and a lens is used for collimating the beam, which sets the reference wavefront.Then, light is reflected off the three hexagonal segmented flat mirrors system, which is used for introducing and controlling systematic wavefront aberrations in the system.Two of the three mirrors are kept stationary while the third mirror's tilt actuator is motorized as discussed in Section 4.1.The moving mirror has a precision actuator mounted on it.This mirror provides the section of wavefront that creates a large, localized (relative to the entire beam reflected from the three mirrors) tilt, which will be used to demonstrate the adaptive sampling capability of the sensor.The other two mirrors are both kept stationary and together they provide the section of wavefront that will not change and hence the detection area corresponding to light reflected from these two mirrors will show no change in sampling.The actuator allows the mirror to be moved in a certain direction.By connecting it to an actuator controller, we can electronically control the amount the actuator moves, which allows for a reliable and precise motion of the mirror (in this case, it allows the mirror to be tilted).The collimating lens acts as the system stop, so the beam hitting the detector has a diameter of ~50.8 mm.The beam overfills the detector and ensures that there is enough light to fill the detector even when the hexagonal mirror is tilted considerably.The segmented mirror configuration was specially designed and built in order to represent and examine a locally varying wavefront with large magnitude variations, which is the key target situation of the A-SHWFS technology.Figure 4 is the prototype set-up and Table 1 summarizes the specifications of all non-trivial system components in order to provide a retrace-ability of the presented system performance.In principal, the A-SHWFS works using the relative change of the measured wavefront from a reference state.To obtain the reference state, the sensor can be calibrated using a known wavefront input, such as a collimated beam.Unlike a typical SHWFS, the A-SHWFS can accommodate large wavefront departures, so the reference wavefront can even be a powered wave.In our case, the reference (or calibration) wavefront was a collimated plane wave and the initial spots were recorded based on the measurement of this reference wavefront.This helps account for the residual spatial error introduced by the LCD.In practice, the A-SHWFS should first be calibrated using the target (or reference) wavefront and the reference spot positions recorded.Then, the sensor reports the wavefront deviation from the calibrated reference wavefront, as a slope measurement.

Wavefront slope measurement accuracy
The experiment described in this section aims to quantify the accuracy of the A-SHWFS by comparing its measurement values against those obtained by a commercial precision autocollimator, which directly measures the mirror surface slope change.The MÖLLER-WEDEL ELCOMAT 3000 electrical autocollimator was used, which has a superb accuracy and resolution of ± 1.21 × 10 −3 mrad and 2 × 10 −4 mrad respectively.The maximum possible measurement range of this autocollimator is 9.70 mrad.
The wavefront measurement area was carefully chosen as the boundary region of the three hexagonal mirrors, so that two remain stationary while one is systematically moved to introduce tilt in the reflected beam wavefront as shown in Fig. 6(a).Also, a small mirror was attached to the backside of the moving hexagonal mirror.Light from the autocollimator reflects off the small mirror and goes back to the autocollimator which measures the orientation of the mirror with respect to its optical axis (i.e., reference) as in Fig. 6(b).As the active hexagonal mirror is tilted using the Piezo inertia actuator, the autocollimator measures the co-mounted small mirror's orientation which provides the golden standard values for the A-SHWFS test.(Note: The factor of 2 between the direct surface orientation change and the reflected beam's wavefront slope change due to the double-path was considered and accounted for in this comparison.)The A-SHWFS measures the tilt by calculating centroids of the focused light spots from the moving mirror (as described in Section 2.2) and modally fitting the slope data using the G  vector polynomials.This experiment was done for two cases: one with small actuator motions corresponding to small changes in the beam's tilt (Fig. 7(a)) and the second with a larger actuator motion corresponding to large tilt angle range (Fig. 7(b)).Results, including the error are summarized in Fig. 7.The percentage error between the two sets of measurements was calculated using Eq. ( 5) and then averaged.The final results from the A-SHWFS show agreement of 1.32% average error for the small range case and 1.13% error for the large range case compared to the autocollimator values, which confirms the fidelity of overall data processing pipeline and the actual prototype system performance.

Adaptive wavefront sampling
One of the biggest applications of the A-SHWFS is reliably measuring wavefronts that have high regional aberrations or sharp local slope change (i.e., not over the entire wavefront, but only in a certain region).Since the subaperture blocking using LCD panel does not have to be applied over the entire wavefront sampling area, this enables a unique tradeoff between dynamic range and spatial resolution over a selective localized area where the wavefront is aberrated beyond its nominal detection dynamic range.
To demonstrate this adaptive capability, the three hexagonal mirrors set-up was employed (Fig. 6(a)) in a way that two mirrors remained stationary while the third one was moved by the Piezo inertia actuator continuously.Portion of the beam reflected off the moving mirror had increasing tilt (i.e., localized excessive tilt) as the actuator continued tilting the active hexagonal mirror.The rest of the beam (reflected off the two stationary mirrors) had almost no or a fixed, small amount of tilt as a reference.
When the amount of tilt is small, the entire detection area has the nominal and uniform spatial sampling.This sampling is determined by the total number of lenslets and corresponds to the smallest possible detector subaperture area for this particular lenslet array.This situation corresponds to the image in Fig. 8(a).It is also represented in Fig. 9(a), where the length of the quiver plot arrows (corresponding to the amount of wavefront slope) is small.As the active mirror's tilt increases to the point where it can no longer be measured by this small subaperture area on the detector, the blocking LCD mask pattern is activated and the detector subaperture area increases (as described in Section 2.1) to adapt to this steeper wavefront to be within the measurable dynamic range.However, since the steep wavefront is only over a portion of the beam reflecting off the active hexagonal mirror, only the localized section of the detection area adapts its spatial sampling by controlling the matching LCD panel's blocking on / off signals.
The result is selectively optimized detector subapertures as shown in Fig. 9(b).The higher spatial sampling was achieved over the small dynamic range portion of the wavefront from the stationary mirror zones.In contrast, the lower spatial sampling with enhanced dynamic range was applied in order to monitor the wavefront from the highly tilted active mirror.The measured wavefront slope data in Fig. 9(b) clearly highlights this adaptive concept and capability, where the quiver arrows are much longer in the localized region corresponding to the high tilt active mirror.The reconstructed wavefront time-lapse (zoomed-in portion of data corresponding to red dotted areas in Fig. 9) shows continuously increasing wavefront tilt as the active mirror was being tilted up-to and beyond the nominal 28.5 mrad dynamic range.The average slope magnitude for each map is shown as well.The dotted red line represents the start of adaptive gating i.e., when the blocking mask was applied to the LCD.
Here, only a few screenshots are shown but this is one way of measuring using the A-SHWFS where either images can be taken at different intervals (depending on the required frequency of measurement) and these images can be processed in nearly real-time or a video can be recorded once and then screenshots can be extracted at any interval required for a post-analysis need.The frequency of image processing depends primarily on the computational resources connected to the sensor.It also depends on the amount of data obtained through the detector.

Simulation study for A-SHWFS
As mentioned previously, the A-SHWFS concept allows the sensor to be very efficient and highly customizable.It can measure various types of wavefronts, under different circumstances.To show the possibility and capability of the sensor to work for other situations, a simulation study was performed, the details of which are described in this section.Random wavefronts are generated using combinations of various low and higher order Zernike terms in combination with pupil masks.A detection area corresponding to 22 × 22 lenslets is used for this study.
The adaptive masking algorithm is applied in the following manner: The size of each detection subaperture is 130 × 130 pixels.If the absolute wavefront slope measurement (i.e., the absolute difference between the measured and reference spot locations) at any location exceeds 80% of the native detection subaperture half-width, the algorithm automatically switches to a lower sampling resolution but larger detection subaperture area.This new subaperture area corresponds to 3 × 3 lenslets (or 390 × 390 detector pixels).The measurement location ("unblocked lenslet") is now the central lenslet and 8 lenslets around it are blocked.If the next measurement keeps the higher magnitude of wavefront slope, the subaperture stays at the larger size.If, however, the magnitude of aberration at that location is reduced with the next measurement so that the measured slope is within the 80% threshold, the sensor switches that location back to the native sampling subaperture size (i.e., 130 × 130 detector pixels).
Visualization 1 is a video showing the adaptable detection process, as various wavefronts with low and high local slope changes are applied in the simulation.The images are quiver plots, where the length of the arrows corresponds to the magnitude of the simulated wavefront slope using A-SHWFS concept.Figure 11 shows four snapshots from the video, with different wavefronts being simulated.Fig. 11.Quiver plots of simulated data, representing measurements (Visualization 1) from different wavefronts.The blue arrows are measurements from native detection subapertures while the red arrows are measurements from optimized, larger detection subapertures, where regional A-SHWFS blocking was applied.(Note: a magnification factor of 4 is applied to the length of all arrows, to make them easier to see.) Details and implementation of the blocking algorithm can be modified and customized according to the situation and specific applications.For example, the switching criterion can be changed to 90% or 75% etc. of the native subaperture dynamic range.The user may also choose to apply some completely different criteria, such as applying blocking when multiple spots are detected.It can be iterated to make the subaperture larger and larger till no multiple spots are detected in a single detection subaperture.Other modifications can include a different size of the larger subaperture as soon as blocking is applied, e.g., instead of switching to a 3 × 3 lenslet subaperture, one may switch to 2 × 2, 5 × 5, or even 2 × 3 lenslets.

Summary
The Adaptive Shack-Hartmann Wavefront Sensor introduced in this work was designed to have an adaptable dynamic range of wavefront measurement accommodating dynamic local (or global) wavefront changes at the expense of spatial sampling, as necessary.This concept does not require a mechanical motion or other such mechanisms of the lenslet array to deliver this capability.No complex optics or heavy computation is necessary either.With only an electrically controlled LCD panel, it is able to dynamically change the detection subaperture distribution on the detector.This paper presents and demonstrates the adaptive wavefront sensing concept, application and basic implementation as an actually built system.
We discussed the details of hardware and software implementation of the prototyped A-SHWFS so the concept can be understood, verified, and improved upon in future modifications and cross-checks.Additionally, by taking measurements from the sensor and simultaneously comparing them against a standard testing method, we prove the merit of this method, as well as make an estimate of its accuracy.Finally, measurement for a locally-andhighly aberrated dynamic wavefront was simulated using a three hexagonal mirrors segment and tested by the A-SHWFS to provide a realistic case example of some of the unique capabilities and advantages of this system.However, we acknowledge that some of the avenues of improvement include LCD and SPDT lenslet array with lesser scattering, better matching between pixels of the LCD and lenslet array, and better calibrations.If scattering or diffraction is a problem for certain applications, a customized micro-shutter system replacing the LCD may be considered in the future.Also, computational power for quicker and more efficient data processing will be a critical factor for some high-speed application cases requiring kHz-level operations.
The A-SHWFS concept showed a unique strength and its versatile applications to meet adaptive wavefront sensing and analysis needs.The adaptability ensures that while a more and more aberrated wavefront can be reliably measured, the system does not have to sacrifice with low spatial resolution when the aberration magnitude is not strong.This is of particular importance for the case where a wavefront is highly aberrated locally or in a certain region only.The new tradeoff space enabled by this solution can benefit future optical systems requiring multi-purpose adaptive functionalities.

Fig. 2 .
Fig. 2. (a) Schematic layout of the A-SHWFS using actively modulated LCD lenslet array mask.(b) Depiction of how the LCD lenslet array mask (left) and the corresponding detector subapertures (right) are changed dynamically, from a fully unblocked (top) to partially blocked (bottom) situation.The squares on the left represent the pattern sent from the computer to the LCD screen.

F
Eq. (2) and Eq.(3), m n G  are the gradient polynomials, m n are the scalar polynomials, and m

Fig. 3 .
Fig. 3. Quiver plots for three low-order G  polynomials in a normalized rectangular domain.

Fig. 4 .
Fig. 4. A-SHWFS prototype configuration for proof-of-concept experiment.The green arrows represent the direction of laser wavefront propagation through the setup.

Fig. 6 .
Fig. 6.(a) Picture of the three adjacent hexagonal mirror segments set-up.The green circle represents where the test beam hits the mirror set-up and the dotted orange circle shows the approximate location of the small mirror behind the active segment used for the reference autocollimator measurements.(b) Schematic of autocollimator set-up providing the golden standard for the A-SHWFS accuracy test.Red dotted arrows represent the autocollimator beam going to / from the small mirror.

Fig. 7 .
Fig. 7. (a) Small, and (b) Large magnitude of tilt measurements comparing the autocollimator and A-SHWFS values (blue circles).The error (red crosses), which is the difference between the autocollimator and A-SHWFS values, is shown with its own axis on the right side in both figures.A linear fit to the data is shown as the black line.

8 .Fig. 10 .
Fig. 8 relativ mirror The re maint select in the