*2.1. Theoretical Foundations*

Wavefront aberrations are usually described in terms of Zernike functions *Znm*(*r*, ϕ) [45] in the following way:

$$\mathcal{W}(r,\varphi) \;= \exp\left[i\kappa\alpha \sum\_{n=0}^{N\_{\text{max}}} \sum\_{m=0}^{n} \mathbb{C}\_{nm} Z\_{nm}(r,\varphi)\right],\tag{1}$$

where κ = 2π/λ is the wave number, λ is the radiation wavelength, α is the parameter corresponding to the level of aberration in wavelengths (in this paper it takes values from zero to wavelength λ), and coefficients *Cnm* are normalized.

The PSF for an aberrated wavefront can be calculated using the Fourier transform:

$$F(\mu, v) = \mathbb{S}\{\mathcal{W}(\mathbf{x}, y)\} \\
= \int\_{-\infty}^{\infty} \int\_{-\infty}^{\infty} \mathcal{W}(\mathbf{x}, y) \exp\left[-i\frac{2\pi}{\lambda f}(\mu \mathbf{x} + vy)\right] \,\mathrm{d}\mathbf{x} \,\mathrm{d}y,\tag{2}$$

where *f* is the focal length of the lens.

The optical wavefront analyzer considered in this work is based on the addition of a lens with a diffractive multichannel filter [21,25,27] of the following form:

$$\pi(\mathbf{x}, y) \;= \sum\_{p=0}^{P} \sum\_{q=0}^{Q} \Psi\_{pq}^\*(\mathbf{x}, y) \exp\left[i \left(a\_{pq}\mathbf{x} + b\_{pq}y\right)\right],\tag{3}$$

where Ψ*pq* (*x*, *y*) are the functions matched to diffraction orders (DOs) with indices (*p*, *q*), the position of which in the focal plane is determined by the spatial frequencies *apq* and *bpq*.

As a rule, the Zernike polynomials are used as Ψpq (*x*, *y*) [7,21,25,27] to analyze a wavefront. However, correct detection in this case is possible only at low levels of aberrations. In [27], it was shown that at an aberration level of more than 0.4λ, the use of such a filter leads to false detection.

In this paper, the use of a filter matched with the Zernike phase functions (Zernike polynomials correspond to the phase of the considered functions) is proposed:

$$\Psi\_{pq}(\mathbf{x},\mathbf{y}) \ = \exp\left[i\kappa\alpha\_0 Z\_{pq}(\mathbf{x},\mathbf{y})\right],\tag{4}$$

where *Zpq*(*x*, *y*) are the standard Zernike functions of double indices (*p*, *q*) [45]. The correspondence of Zernike functions to various types of aberrations is given in Table 1.

**Table 1.** Correspondence of Zernike functions of double indices (*n*, *m*) to the aberration type.


#### *2.2. Scheme for Adaptive Aberration Compensation*

We consider in detail several wave aberrations of different magnitudes and show the scheme for the adaptive method to compensate these aberrations.

We divide the aberrations into even type (*n* is even) and odd type (*n* is odd) and consider them separately. Among the even aberrations, one can distinguish axis-symmetric ones (*m* is equal to 0). Even aberrations such as (2, 0), (4, 0), . . . , (*n*, 0) have the wavefront phase and corresponding PSF axis-symmetric distribution regardless of the level of aberration α (see Table 2).

**Table 2.** Simulation results for radial wave aberration of type (*n*, *m*) = (2, 0) and (*n*, *m*) = (4, 0).

The adaptive method is described as the aberration compensation by complex conjugate functions (4) with different levels of α0. In other words, we calculate the compensated wavefront of the form

$$
\Delta \mathcal{W}(\mathbf{x}, y) = \mathcal{W}(\mathbf{x}, y) \Psi\_{pq}^\*(\mathbf{x}, y) \ = \exp[i\kappa \mathfrak{a} Z\_{nm}(\mathbf{x}, y)] \exp\left[-i\kappa \mathfrak{a}\_0 Z\_{pq}(\mathbf{x}, y)\right] \tag{5}
$$

and the corresponding PSF of the form

$$
\Delta F(\mu, v) = \Re \{ \Delta \mathcal{W}(\mathbf{x}, y) \}
\\
= \int\_{-\infty}^{\infty} \int\_{-\infty}^{\infty} \Delta \mathcal{W}(\mathbf{x}, y) \exp \left[ -i \frac{2\pi}{\lambda f} (\mu \mathbf{x} + vy) \right] \mathbf{dx} dy,\tag{6}
$$

where *W*(*x*, *y*) is the analyzed wavefront with aberration (*n*, *m*) and level α, Ψ ∗ *pq*(*x*, *y*) is the complex conjugate function (4) with a variable level α0, ∆*W*(*x*, *y*) is the resulting wavefront, and ∆*F*(*x*, *y*) is the corresponding PSF.

With the successful compensation of the specified wave aberration, the phase of the resulting wavefront should be equal to a constant, and the PSF should correspond to the Airy picture (PSF for the plane WF).

The results collected in Figure 1 show the compensating process for the spherical aberration (*n*, *m*) = (2, 0) with a level α = 0.5λ by the set of Ψ ∗ *pq*(*x*, *y*) = Ψ ∗ <sup>20</sup>(*x*, *y*) with different levels of α<sup>0</sup> = {0.1λ; 0.25λ; 0.5λ; 0.75λ}. Thus, we construct the resulting wavefront defined by Equation (5) and the corresponding PSF defined by Equation (6).

**Figure 1.** Illustration of the compensating process for wave aberration *W*(*x*, *y*) of type (*n*, *m*) = (2, 0) with α = 0.5λ level (green highlights) by complex conjugate wave aberration Ψ ∗ *pq*(*x*, *y*) = Ψ ∗ <sup>20</sup>(*x*, *y*) with different levels of α<sup>0</sup> (orange highlights). Results of compensation (blue highlights) are placed at the intersection of corresponding rows and columns.

Figure 1 shows in detail the effect of the compensating wavefront *W*(*x*, *y*) with aberration type (*n*, *m*) = (2, 0) and level α = 0.5λ by Ψ ∗ *pq*(*x*, *y*) = Ψ ∗ <sup>20</sup>(*x*, *y*) with different levels of α0. The compensated phase (equal to 0) is observed at the intersection of column 4 and row 3, and the corresponding PSF (the Airy picture *D*(*u*, *v*)) is observed at the intersection of column 4 and row 4:

$$
\Delta \mathcal{W}(\mathbf{x}, y) \;= \mathcal{W}(\mathbf{x}, y) \Psi\_{pq}^\*(\mathbf{x}, y) = \exp[i2\pi 0.5Z\_{20}(\mathbf{x}, y)] \exp[-i2\pi 0.5Z\_{20}(\mathbf{x}, y)] \;= 1,\tag{7}
$$

$$\Delta\Gamma(u,v) \,=\,\Re\{\Delta\mathcal{W}(\mathbf{x},y)\} = \int\_{-\infty}^{\infty} \int\_{-\infty}^{\infty} \exp\left[-i\frac{2\pi}{\lambda f}(u\mathbf{x}+vy)\right] \mathrm{d}\mathbf{x}d\mathbf{y} = D(u,v). \tag{8}$$

In addition, it can be seen from Figure 1 that the PSFs observed in row 4, columns 3 and 5, have the same intensity. This is because the phase of the resulting wavefront for these two cases is the same up to sign:

$$\Delta \mathcal{W}(\mathbf{x}, y) = \exp[i2\pi 0.5Z\_{20}(\mathbf{x}, y)] \exp[-i2\pi 0.25Z\_{20}(\mathbf{x}, y)] = \exp[i2\pi 0.25Z\_{20}]\_\prime \tag{9}$$

$$\Delta W(\mathbf{x}, y) \ = \exp[i2\pi 0.5Z\_{20}(\mathbf{x}, y)] \exp[-i2\pi 0.75Z\_{20}(\mathbf{x}, y)] \ = \exp[-i2\pi 0.25Z\_{20}].\tag{10}$$

A change in the sign of the aberration coefficient to the opposite causes a symmetric transformation of the PSF image about the horizontal axis for negative *m*, since −sin(*m*ϕ) = sin(*m*ϕ + π), and about the vertical axis for positive *m*, since −cos(*m*ϕ) = cos(*m*ϕ + π). For even aberrations, this property is not so noticeable due to their symmetry. Therefore, PSFs for even wave aberrations that differ only in the sign of the weighting coefficient have the same intensity distribution in the focal plane.

Even aberrations with *m* 6= 0 have phase images with *m* symmetry axes and PSFs with 2*m* symmetry axes. It should be noted that the OX and OY axes are always the PSF symmetry axes (see Table 3).

**Table 3.** Results of modeling an even wave aberration of the type (*n*, *m*) = (2, 2) and (*n*, *m*) = (4, 4).


Analogical results of the compensating process for the astigmatic aberration (*n*, *m*) = (2, 2) with a level α = 0.5λ by the set of Ψ ∗ *pq* (*x*, *y*) = Ψ ∗ <sup>22</sup>(*x*, *y*) with different levels of α<sup>0</sup> = {0.1λ; 0.25λ; 0.5λ; 0.75λ} are shown in Figure 2. The situation is similar to that of Figure 1, and cases at α<sup>0</sup> = {0.25λ; 0.75λ} correspond to identical PSFs.

**Figure 2.** Illustration of the compensating process for wave aberration *W*(*x*, *y*) of type (*n*, *m*) = (2, 2) with α = 0.5λ level by complex conjugate wave aberration Ψ ∗ *pq*(*x*, *y*) = Ψ ∗ <sup>22</sup>(*x*, *y*) with different levels of α<sup>0</sup> (description for pictures are the same as for Figure 1).

Odd-type aberrations such as (*n*, *m*) = (3, 1) and (*n*, *m*) = (3, 3) have images of the wavefront phase with *m* symmetry axes and the corresponding PSFs with 2*m* symmetry axes (see Table 4).


**Table 4.** Modeling results for odd wave aberration of type (*n*, *m*) = (3,1) and (*n*, *m*) = (3, 3).

The results of the compensating process for the coma-type aberration (*n*, *m*) = (3, 1) with a level α = 0.5λ by the set of Ψ ∗ *pq*(*x*, *y*) = Ψ ∗ <sup>31</sup>(*x*, *y*) with different levels of α<sup>0</sup> = {0.1λ; 0.25λ; 0.5λ; 0.75λ} are shown in Figure 3. The situation is different from even aberrations.

**Figure 3.** Illustration of the compensating process for wave aberration *W*(*x*, *y*) of type (*n*, *m*) = (3, 1) with α = 0.5λ level (green highlights) by complex conjugate wave aberration Ψ ∗ *pq*(*x*, *y*) = Ψ ∗ <sup>31</sup>(*x*, *y*) with different levels of α<sup>0</sup> (orange highlights). Results of compensation (blue highlights) are placed at the intersection of corresponding rows and columns.

It can be seen from Figure 3 that in row 4, columns 3 and 5, PSFs are rotated by 180 degrees. This is because the phase of the resulting wavefront for these two cases is the same up to sign:

$$\Delta \mathcal{W}(\mathbf{x}, y) \;= \exp[i2\pi \mathbf{0}.5 \mathbf{Z}\_{\text{31}}(\mathbf{x}, y)] \exp[-i2\pi \mathbf{0}.25 \mathbf{Z}\_{\text{31}}(\mathbf{x}, y)] \;= \exp[i2\pi \mathbf{0}.25 \mathbf{Z}\_{\text{31}}] \; \tag{11}$$

$$\Delta \mathsf{W}(\mathbf{x}, y) \;= \exp[i2\pi 0.5 \mathbf{Z}\_{31}(\mathbf{x}, y)] \exp[-i2\pi 0.75 \mathbf{Z}\_{31}(\mathbf{x}, y)] \;= \exp[-i2\pi 0.25 \mathbf{Z}\_{31}].\tag{12}$$

Changing the sign of the aberration coefficient to the opposite one causes a symmetric transformation of the PSF image about the horizontal axis. As described earlier for positive *m*, such a symmetric transformation must be performed with respect to the vertical axis, since −cos(*m*ϕ) = cos(*m*ϕ + π). For odd-type aberrations, this property is evidentially observed in the PSF intensity distribution.

Thus, the introduced empirical criterion for odd-type aberrations is based on the described fundamental properties of the PSF of wave aberrations.

The following combined criteria for correct detection can be used:


Based on the analysis of the intensity distribution in the focal plane, taking into account the proposed criteria, it is possible to determine the range of the analyzed aberration level.

Next, we propose using a multichannel filter to implement the processing of the analyzed wavefront simultaneously by several types of aberrations taken into account.

## *2.3. Multichannel Filter Employment*

To determine the type and magnitude of aberration in the analyzed wavefront, we propose combining the adaptive method with the use of a multichannel filter matched to Zernike's adjustable phase functions. Thus, the principle of operation of our method lies in the parallel application of the adaptive approach by a multichannel diffractive element employment. In this case, a wide range of detectable aberration values and resistance to vibrations are provided.

To realize this approach, the filter should be matched with a set of functions defined by Equation (4) with different levels of α*<sup>k</sup>* . We can design a filter tuned to one specific wave aberration with a value ranging from α<sup>1</sup> to α*K*max.

In order to detect another type of wave aberrations, it is necessary to divide each channel into *P*max*Q*max additional channels. So, different wave aberrations with different α*<sup>k</sup>* should be encoded in different diffraction orders. The transmission function of such an LT-filter will be as follows:

$$\pi\_{LT}(\mathbf{x},\mathbf{y}) = \sum\_{p=0}^{P\_{\text{max}}} \sum\_{q=0}^{Q\_{\text{max}}} \sum\_{k=1}^{K\_{\text{max}}} \exp\left[-i\kappa \alpha\_k Z\_{pq}(\mathbf{x},\mathbf{y})\right] \exp\left[i\left(a\_{kpq}\mathbf{x} + b\_{kpq}\mathbf{y}\right)\right]. \tag{13}$$

It should be noted that the accuracy of the detected (and compensated) aberration value directly depends on the number of channels *P*max*Q*max*K*max; however, the number of filter channels is limited by technological possibility. Since the filter defined by Equation (13) can be implemented using an SLM, the number of channels can be reduced taking into account a certain time delay for rebuilding the filter to different sets of channels. Moreover, in the presence of an additional adapting device, it is possible to organize an iterative process of step-by-step compensation of aberrations [30–32].

The formation of a correlation peak in one of the DOs can be considered as a criterion for successful compensation. Additional criteria for adaptive filter tuning are proposed in Section 3.

A special case of the LT-filter defined by Equation (13) is the "type" T-filter tuned for different types of aberrations with the same level α0:

$$\pi\_T(\mathbf{x}, y) \;= \sum\_{p=0}^{P\_{\text{max}}} \sum\_{q=0}^{Q\_{\text{max}}} \exp\left[-i\kappa \alpha\_0 Z\_{pq}(\mathbf{x}, y)\right] \exp\left[i(a\_{pq}\mathbf{x} + b\_{pq}y)\right]. \tag{14}$$

If the aberration type is determined and we need to more accurately determine its level, then it makes sense to use another particular version of the filter defined by Equation (13), namely the "level" L-filter tuned to only one aberration type (*p*0, *q*0) with different levels of α*<sup>k</sup>* :

$$\pi\_L(\mathbf{x}, \mathbf{y}) \;= \sum\_{k=1}^{K\_{\text{max}}} \exp\left[-i\kappa \alpha\_k Z\_{p\_0 q\_0}(\mathbf{x}, \mathbf{y})\right] \exp[i(a\_k \mathbf{x} + b\_k \mathbf{y})].\tag{15}$$

To analyze other aberration types, the filter can be quickly rebuilt using an SLM.

We have designed several variants of multichannel filters defined by Equations (13)–(15). Figure 4 demonstrates three examples of these filters: *T-filter* matched with different types of aberrations of the same level (Equation (14), Figure 4a), *LT-filter* matched with different types and levels of aberrations (Equation (13), Figure 4b), and *L-filter* matched with one aberration type of different levels (Equation (15), Figure 4c). Each of the options is suitable for a specific task. It makes sense to use a hybrid LT-filter for preliminary analysis and a filter consistent with different levels for refinement.

**Figure 4.** Examples of intensity patterns for different filters under plane wavefront illumination: (**a**) T-filter defined by Equation (14) at α<sup>0</sup> = 0.5; (**b**) LT-filter defined by Equation (13), and (**c**) L-filter defined by Equation (15) at (*p*<sup>0</sup> , *q*<sup>0</sup> ) = (3, 1).

With the help of dynamically tunable filters implemented on an SLM, it becomes possible to specify the level of aberrations of the analyzed WF or to take the average value from the already detected range. Note that the accuracy of this range directly depends on the noise level of the recording device.

## *2.4. Optical Setup*

The optical scheme used in the experiment is shown in Figure 5.

**Figure 5.** Schematic of the experimental setup for detection of wavefront aberrations and their superpositions using a diffractive multichannel filter. Laser is a solid-state laser (λ = 532 nm); PH is a pinhole (hole size of 40 µm); L1, L2, L3, and L4 are spherical lenses (*f* <sup>1</sup> = 350 mm, *f* <sup>2</sup> = 300 mm, *f* <sup>3</sup> = 200 mm, and *f* <sup>4</sup> = 250 mm); SLM1 is a transmissive spatial light modulator (HOLOEYE LC 2012); SLM2 is a reflective spatial light modulator (HOLOEYE PLUTO VIS); D1 and D2 are circular apertures; M1 and M2 are mirrors; CAM is a ToupCam UCMOS08000KPB video camera.

The experimental setup for detecting wavefront aberrations using a diffraction multichannel filter consists of the following elements: a solid-state laser (λ = 532 nm), a pinhole (hole size of 40 µm), spherical lenses (*f* <sup>1</sup> = 350 mm, *f* <sup>2</sup> = 300 mm, *f* <sup>3</sup> = 200 mm, and *f* <sup>4</sup> = 250 mm), the transmissive SLM (HOLOEYE LC 2012), the reflective SLM (HOLOEYE PLUTO VIS), circular apertures, mirrors, and the video camera ToupCam UCMOS08000KPB.

The output laser radiation from a solid-state laser (λ = 532 nm) was collimated using a system consisting of a pinhole (PH) with a hole diameter of 40 µm and a spherical lens (L1) (*f* <sup>1</sup> = 350 mm). A circular diaphragm D1 was used to separate a central light spot from surrounding light and dark rings occurring during diffraction at the pinhole. Then, the laser beam expanded and reflected by mirror M1 passed through a HOLOEYE LC 2012 transmissive spatial light modulator SLM1 with a 1024 × 768 pixel resolution and a pixel size of 36 µm, which was used to form a wavefront with a required combination of aberrations. Lenses L2 (*f* <sup>2</sup> = 300 mm) and L3 (*f* <sup>3</sup> = 200 mm) and diaphragm D2 were used to spatially split the aberration-distorted laser beam formed by the first modulator and the unmodulated zero-order transmitted laser beam.

A mirror M2 was used to direct the formed laser beam to the display of the second modulator. A HOLOEYE PLUTO VIS reflective spatial light modulator SLM2 with a 1920 × 1080 pixel resolution and a pixel size of 8 µm was used to implement a phase mask of a diffractive multichannel filter, which served to decompose the studied light field in terms of the Zernike polynomial basis. The laser beam reflected from this SLM was directed to lens L4 (*f* <sup>4</sup> = 250 mm), which focused it on the matrix of a ToupCam UCMOS08000KPB camera CAM with a 3264 × 2448 resolution and a pixel size of 1.67 µm.

#### **3. Results**

#### *3.1. Detection of One Type of Wave Aberration*

As a rule, when using matched filters, the appearance of a correlation peak is a criterion for detecting a matched signal [46–50]. Note that the presence of a correlation peak is determined by a nonzero intensity at the center of the DO. However, when analyzing phase distributions, this approach is correct only for small phase variations. In particular, it was shown in [27] that when the aberration level is more than 0.4λ, the use of filters matched with the basis of Zernike functions leads to the appearance of many wrong correlation peaks and false detection.

The adaptive approach considered in Section 2.2 is free from this limitation, but for its application, it is necessary to select suitable compensating functions in accordance with the developed criteria. To speed up the selection process, we use multichannel filters to analyze a wavefront simultaneously by several types of compensating functions.

In this section, we demonstrate the use of the multichannel filters described in Section 2.3 for test examples when aberrations of certain types with a given level are introduced into the wavefront.

Figure 6 and Table 5 show the results of a numerical and experimental analysis of the WF distorted by a coma-type aberration (*n*, *m*) = (3, 1) with a weight (level) α = 0.5λ, using various diffractive multichannel filters (the intensity patterns in the focal plane are shown). DOs with correlation peaks are framed by a solid line, and DOs with changed PSF orientation are framed by a dashed line. The selected (framed) orders correspond to the criteria formulated in Section 2.2. A good agreement between the numerical simulation and the optical experiment is seen.

**Figure 6.** Detailed results of the analysis of the WF distorted by the odd-type aberration (*n*, *m*) = (3, 1) with α = 0.5λ, using the LT-filter: (**a**) the phase of the analyzed WF; (**b**) simulation of the filter action; (**c**) optical experiment.

The results for LT-filter show (see Figure 6) that the correlation peak located in the DO corresponding to (*p*, *q*) = (3, 1) with α<sup>k</sup> = 0.5λ and adjacent DOs contains a PSF with changed orientation (see Figure 6, positions are marked with frames). As follows from the given example, for aberrations with odd symmetry, the criterion of the correct detection can be not only the presence of the correlation peak, but also the orientation of PSF distribution in neighboring DOs. A similar result was obtained in [51,52] based on numerical simulation. In contrast to these papers, in this work, we realize experimental investigation of the proposed approach and apply it for a step-by-step compensation of a complex type of aberrations.

T-filters with different levels of α<sup>0</sup> also demonstrate (see Table 5) a change of PSF orientation when passing through the level α<sup>0</sup> = 0.5λ. A correlation peak is also observed in the DO corresponding to (*p*, *q*) = (3, 1) with a level equal to 0.5λ (see Table 5, third row).

The results of simulation and experiment with another test example, when the WF is distorted by an even type of aberration (*p*, *q*) = (2, 2) with α = 0.5λ, are presented in Figure 7. Results show that the DOs adjacent to the correlation peak have the same PSF intensity distribution. Thus, when detecting even-symmetry aberrations, in addition to the presence of a correlation peak, the criterion for correct detection can be the similarity of diffraction patterns in neighboring orders.


**Table 5.** Results of modeling and optical experiment of the operation of multichannel T-filters in detecting WF distorted by coma-type aberration (*n*, *m*) = (3, 1) with α = 0.5λ.

**Figure 7.** Detailed results of the analysis of the WF distorted by the even type of aberration (*n*, *m*) = (2, 2) with α = 0.5λ, using the LT-filter: (**a**) the phase of the analyzed WF; (**b**) simulation of the filter action; (**c**) optical experiment.

The results of a test example with a WF distorted by aberration (*n*, *m*) = (3, 3) with an increased weight α = 0.7λ are shown in Figure 8 and Table 6.

**Figure 8.** Results of the analysis of the WF distorted by the aberration (*n*, *m*) = (3, 3) with α = 0.7λ, using the LT-filter: (**a**) the phase of the analyzed WF; (**b**) simulation of the filter action; (**c**) optical experiment.

**Table 6.** Results of modeling and optical experiment of the operation of multichannel T-filters in detecting WF distorted by aberration (*n*, *m*) = (3, 3) with α = 0.7λ.

The increase in weight was considered to show the good performance of filters over a wide range of aberration values (if necessary, the filter can be easily reconfigured for a larger range). In the focal plane of the LT-filter (see Figure 8), the PSF changes orientation in the DOs marked with frames (which corresponds to an aberration of the (*p*, *q*) = (3, 3) aberration type); however, no evident correlation peak is observed between these DOs. The absence of such a correlation peak is explained by the inconsistency of the level of aberrations recorded in the filter with the level of the analyzed wave aberration. To refine the weight of the detected aberration, it is required to use an L-filter or T-filter with different levels of aberration (*p*, *q*) = (3, 3) (see Table 6).

It can be seen from Table 6 that the use of a T-filter with different levels of matched functions made it possible to refine the weight of the detected aberration (*p*, *q*) = (3, 3); thus, the correlation peak is observed at α<sup>0</sup> = 0.7λ (see Table 6, second rows). In this case, for the levels α<sup>0</sup> = 0.5λ and α<sup>0</sup> = 0.9λ (see Table 6, first and third rows), the intensity distribution changes orientation, which is an additional sign of correct detection.

#### *3.2. Detection of Superposition of Wave Aberrations (Complex Aberration)*

In this section, we illustrate the action of the adaptive (step-by-step) method for detecting a superposition of wave aberrations, where at each *l*-th stage the wavefront *Wl* (*x*, *y*) (at the first iteration it is equal to the investigated wavefront) is analyzed by the dynamically tunable SLM. In the focal plane of the filter, there are different PSF pictures. We recall that the aberration type (*p*, *q*) is associated with each string and aberration level with *k*-column (α*<sup>k</sup>* are fitted in accordance with the combined criteria introduced above) of the diffractive multichannel filter. So, the investigated wavefront is corrected taking into account the detected wave aberration as follows:

$$\mathcal{W}\_{l+1}(\mathbf{x}, \mathbf{y}) \;= \mathcal{W}\_l(\mathbf{x}, \mathbf{y}) / \mathcal{W}\_\Delta(\mathbf{x}, \mathbf{y}) \;= \mathcal{W}\_l(\mathbf{x}, \mathbf{y}) \exp\left[-i\kappa \mathbf{a}\_k \mathcal{Z}\_{pq}(\mathbf{x}, \mathbf{y})\right],\tag{16}$$

where *W*∆(*x*, *y*) = exp- −*i*κα*kZpq*(*x*, *y*) .

The criterion for correctly detected aberrations is the formation of a pronounced/evident correlation peak in the focal plane of the filter in the DO at one of the *l*-th steps. To detect the correlation peak formation, we use digital image processing and calculate mean square error (MSE) for *W<sup>l</sup>* (*x*, *y*) in the region of DO (the considered region size is *S* × *S* pixels):

$$MSE[\mathcal{W}\_l(u,v), D(u,v)] \ = \frac{1}{S^2} \sum\_{i=1}^{S} \sum\_{j=1}^{S} \left( \mathcal{W}\_l(u\_{i\prime}v\_j) - D(u\_{i\prime}v\_j) \right)^2. \tag{17}$$

where *D*(*u*, *v*) is the Airy picture (PSF for plane/ideal WF).

To illustrate this approach, we consider the WF distorted by the superposition of two aberrations 0.5λ\*(2, 2) + 0.5λ\*(3, 3). At the first stage, we used an LT-filter (see Figure 9) and revealed that the DO changes orientation in the fourth row, which corresponds to type (*p*, *q*) = (3, 3) with α = 0.5λ, and a residual aberration of the type (*n*, *m*) = (2, 2) is observed in the corresponding DO. So, at the first iteration, the wavefront aberration (*n*, *m*) = (3, 3) with 0.5λ level was compensated by LT-filter. Thus, the problem was reduced by one dimension.

**Figure 9.** Results of modeling and optical experiment in detecting WF distorted by the superposition of aberrations 0.5λ\*(2, 2) + 0.5λ\*(3, 3) using the LT-filter (change in the DO orientation—dashed line): (**a**) the phase of the analyzed WF; (**b**) simulation of the filter action; (**c**) optical experiment.

After compensating for one detected aberration, the wavefront has residual aberration (*n*, *m*) = (2, 2) with 0.5λ level. The result of the action of the same LT-filter on the obtained wavefront is presented in Figure 10. The LT-filter shows that the DOs are symmetric in the second row with respect to the correlation peak at (*p*, *q*) = (2, 2) with 0.5λ level.

**Figure 10.** Results of modeling and optical experiment in detecting WF with residual aberration (*n*, *m*) = (2, 2) with α = 0.5λ level using the LT-filter (change in DO orientation—dashed line; correlation peak—solid line): (**a**) the phase of the analyzed WF; (**b**) simulation of the filter action; (**c**) optical experiment.

In another test example (Figure 11), we considered WF distorted by the superposition of three aberrations 0.5λ\*(2, 0) + 0.5λ\*(2, 2) + 0.5λ\*(3, 3). The LT-filter shows (see Figure 11) that the DO changes orientation in the fourth row, which corresponds to aberration (*p*, *q*) = (3, 3) with 0.5λ level. So, at the first iteration, we compensated for one type of aberration and reduced the problem by one dimension. At the second iteration, the residual aberrations are similar to the first example (see Figure 9), which was compensated in a similar way.

**Figure 11.** Results of modeling and optical experiment in detecting WF distorted by the superposition of aberrations 0.5λ\*(2, 0) + 0.5λ\*(2, 2) + 0.5λ\*(3, 3) using the LT-filter (change in the DO orientation—dashed line): (**a**) the phase of the analyzed WF; (**b**) simulation of the filter action; (**c**) optical experiment.

To refine the weight of the desired aberration, it is possible to iteratively subtract the detected aberrations with low weights until a pronounced correlation peak is observed in one of the DOs.

Thus, using the adaptive/iterative process and the introduced empirical criteria, the wavefront aberrations are compensated. The criterion for the iterative process completion is the formation of a pronounced correlation peak in one of the DOs of the focal plane of the filter, i.e., when the MSE defined by Equation (17) equals a minimal value.

#### **4. Discussion**

In order to show the possibility of using the proposed method for detecting wavefronts with complex aberrations, we investigate how much one wave aberration (*n*1, *m*1) with a level α<sup>1</sup> affects the wave aberration (*n*2, *m*2) with a level α2. For an objective assessment, the analysis of the PSF corresponding to the superposition of aberrations is proposed.

Figure 12 shows the simulation results for the superposition of even- and odd-type aberrations. It is seen that if the ratio of the level of aberrations is more than 10 times, then the effect of an aberration with a lower weight coefficient on the resulting PSF is extremely weak. In addition, the ratio of the level of aberrations being more than 5 times also insignificantly affects the resulting wavefront (with an accuracy to the scale and overall shape of the PSF).

**Figure 12.** The results of modeling the superposition of the odd wave aberration of the type (*n*<sup>1</sup> , *m*<sup>1</sup> ) = (3, 1) with α<sup>1</sup> = 1.0λ level (green highlights) and even wave aberrations of the type (*n*<sup>2</sup> , *m*<sup>2</sup> ) = (2, 2) with different levels of α<sup>2</sup> (orange highlights). Results of compensation (blue highlights) are placed at the intersection of corresponding rows and columns.

Thus, if the superposition contains aberrations with coefficients different in magnitude, then it makes sense to first compensate for aberration with a large level. This fact allows us to say that the analyzed wavefront with a pronounced single aberration can be successfully detected by the proposed filters defined by Equations (13)–(15) without using an additional iterative algorithm.

#### **5. Conclusions**

In this work, we experimentally tested a diffractive multichannel wavefront sensor matched to phase distributions in the form of Zernike functions.

Several variants of filters were designed: filters matched with different types of aberrations of the same level, filters matched with one type of aberration of different levels, and a hybrid filter. Each of the options is convenient for a specific task. It makes sense to apply a hybrid filter for preliminary analysis and then apply a filter matched to different levels for adjusting. When using a dynamic transparency, it is possible to quickly adjust the filters and compensate for the aberration step by step.

Criteria of the proposed adaptive algorithm for determining the aberrations of the analyzed wavefront were formulated: scattering region, PSF compactness, maximum intensity, and orientation of each diffraction order in the focal plane of the multichannel filter. An adaptive compensation of wavefront aberrations was performed using the proposed method and introduced empirical criteria. We show the possibility to reduce a problem dimension at each stage, so the wavefront aberration compensation is provided. We realized an experimental investigation of the proposed approach and applied it for a step-by-step compensation of a complex type of aberrations.

Finally, based on numerical modeling and the results of an optical experiment using a dynamic transparency, we show the efficiency of the proposed filters for detecting wavefront aberrations in a wide range (from 0.1λ to λ).

Considering the wide range of correctly detected aberration values using the proposed method, the field of application can include the measurement and correction of wavefront aberrations in devices such as ground-based telescopes and optical microscopes, in optical communication systems, in industrial laser technology, and in ophthalmology.

**Author Contributions:** Conceptualization: S.N.K. and P.A.K.; methodology, S.N.K. and P.A.K.; software, P.A.K.; validation, S.N.K., P.A.K. and A.P.P.; formal analysis, S.N.K. and P.A.K.; investigation, S.N.K., P.A.K. and A.P.P.; resources, S.N.K.; data curation, S.N.K., P.A.K. and A.P.P.; writing—original draft preparation, S.N.K. and P.A.K.; writing—review and editing, S.N.K. and P.A.K.; visualization, S.N.K., P.A.K. and A.P.P.; supervision, S.N.K.; project administration, S.N.K.; funding acquisition, S.N.K. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was financially supported by the Russian Foundation for Basic Research (grant No. 20-37-90129) for numerical calculations and analysis and by the Ministry of Science and Higher Education of the Russian Federation under the FSRC "Crystallography and Photonics" of the Russian Academy of Sciences (the state task No. 007-GZ/Ch3363/26) for experimental research.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

## **References**

