Modelling phase imperfections in compound refractive lenses

Compound refractive lenses (CRL) offer outstanding potential for probe formation in X-ray micro- and nano-analysis as well as for imaging applications, but effective aberration-free focusing of X-rays is a key consideration when high spatial resolution and intensities are required. Available refractive optics have non-negligible aberrations which degrade their final performance. We describe a framework based on physical-optics for simulating the effect of imperfect CRL upon an X-ray beam, taking into account measured phase errors obtained from at-wavelength metrology. We model, with increasing complexity, a CRL stack as a single thin phase element, then as a more realistic compound-element including absorption and thickness effects and finally, we add realistic optical imperfections to the CRL. Coherent and partially-coherent simulations using the"Synchrotron Radiation Workshop"(SRW) are used to evaluate the different models, the effects of the phase errors and to check the validity of the design equations and suitability of the figures of merit.


Introduction
The use of refractive optics for the focusing of X-rays dates back to the mid-1990's (Tomie, 1994;Snigirev et al., 1996) which is relatively recent when compared to the use of diffractive-(early 1930's) and reflective-optics (late 1940's). Although a recent development, X-ray lenses are used at most high-energy synchrotron facilities 1 and X-ray Free-Electron Lasers (XFEL) either for beam conditioning, final focusing of the X-rays into the sample or for imaging. The recent development and establishment of fourth-generation synchrotron light sources -as upgrades of existing machines or the construction of new facilities -and the emergence of the XFEL poses a new challenge for X-ray optics: wavefront preservation, as at modern sources the X-ray beam quality at the sample is primarily limited by the optical quality (Schroer & Falkenberg, 2014;Yabashi et al., 2014).
Under certain conditions, X-ray lenses are well adapted for situations where minimising wavefront distortions is important (Roth et al., 2017;Seiboth et al., 2017;Kolodziej et al., 2018). To understand their impact on the optical design of complete beamlines, it is necessary to be able to simulate them realistically. The basic implementation of X-ray lenses is already available on the two most widespread beamline simulation tools: SHADOW (Sanchez del Rio et al., 2011) and SRW (Chubar & Elleaume, 1998). Both implementations, although based on different schemes, ray tracing (Alianelli et al., 2007) and wave optics  respectively, are based on an ideal model combining refraction and absorption for the stacked lenses. Since then, much has been done in terms of refining the modelling of ideal X-ray lenses (Umbach et al., 2008;Sanchez del Rio & Alianelli, 2012;Osterhoff et al., 2013;Simons et al., 2017;Pedersen et al., 2018) and, to a certain extent, the modelling of optical imperfections (Pantell et al., 2001;Andrejczuk et al., 2010;Gasilov et al., 2017;Osterhoff et al., 2017). With exception of the work of Roth et al. (2014), investigating the inner structure of X-ray lenses, the present models consider only lens shape and departure from a perfect parabolic shape to either test the limits of figure errors and fabrication defects, or to improve lens shape and focusing quality. These, however, do not include the data from real lenses metrology, as is routinely done for X-ray mirrors simulations (Sanchez del Rio et al., 2016). Furthermore, it is important to have simulation tools to allow for the accurate implementation of synchrotron or XFEL light sources, allowing the CRL to be included in a complete beamline configuration in combination with other optical elements. This is possible with both SHADOW and SRW.
In this work, we propose a framework for simulating CRL taking into account their thickness, absorption and individual lens phase errors measured with at-wavelength metrology. Such phase errors can arise from material inhomogeneities (voids, impurities) and/or figure errors from the lens forming process. Our approach is fully compatible with SRW as the X-ray optics community interest shifts to the study of wavefront preservation and tolerancing in low-emittance synchrotron or XFEL beamlines. However, the extension and application of this methodology to ray-tracing (Rebuffi & Sánchez del Río, 2016) and hybrid methods (Shi et al., 2014) is possible. This paper is organised as follows: section 2 introduces basic design equations necessary for modelling X-ray lenses and figures of merit to evaluate the optical performance of the CRL. With increasing complexity, section 3 introduces the complex transmission element and from it derives the representation of the CRL and their phase errors used for accurate simulations of real imperfections. Section 4 presents the simulations in two groups: coherent and partially-coherent simulations. This is where the evaluation of the different models, the effects of the lens imperfections and checking the validity of the design equations and suitability of the figures of merit is done. Finally, the results are discussed and the main conclusions are drawn.

Compound refractive lenses
In this section, we recall some important design equations in §2.1 and figures of merit used when assessing the X-ray focusing quality in §2.2.

CRL anatomy
X-ray lenses may have different surface shape: in initial experiments (Snigirev et al., 1996) a cylindrical surface was used, which was soon replaced by a parabolic shape that almost completely removes geometrical aberrations (Lengeler et al., 1999). Parabolic lenses are the most used X-ray lenses in CRL as they can focus 1D (cylinder with parabolic section) or in 2D (paraboloid of revolution). It is worth noting, however, that, although less usual, X-ray lenses can assume other shapes: an elliptical profile when focusing collimated beams (Evans-Lutterodt et al., 2003), or a Cartesian oval for point-topoint focusing (Sanchez del Rio & Alianelli, 2012). However, parabolic shapes always present a very good approximation to geometric focusing and reduce the geometrical aberrations to levels that are smaller than contributions from the fabrication errors and diffraction effects.
Very often X-ray lenses are defined by a small set of parameters as shown in Fig. 1(a). These are: i) material; ii) apex radius of curvature (R x , R y ); and iii) lens thickness (L) or geometrical aperture (A) and iv) distance between the apices of the parabolas (t wall ).
We begin by defining the optical power F = f −1 of a single refracting surface of radius R, where f is its focal length. The index of refraction for the X-ray regime can be expressed as a complex number: n = 1 − δ + i · β, with δ being the refraction index decrement and β, the absorption index -both strongly dependent on energy and material. With the X-ray beam moving along the positive z-direction on Fig. 1, the refracting power of the vacuum/lens interface is given by: Here we will consider only the real part of the indices of refraction as this governs the focusing effect of the lenses. As illustrated by Fig. 1(a), lenses are typically formed by two refracting surfaces of nominally the same radii. From paraxial optics, the total optical power of refracting surfaces in intimate contact is the sum of their powers. The same is valid for the cases where the distance between them can be ignored. Typical materials used for X-ray lenses have 10 −7 ≤ δ ≤ 10 −3 for their usual application energies (Serebrennikov et al., 2016). To overcome the weak refraction of a single element, several X-ray lenses are stacked (Tomie, 1994;Snigirev et al., 1996). Still, under the assumption of thin elements, we have: where the 2N comes from stacking N lenslets with two refracting surfaces each, as shown in Fig. 1(b). A correction factor can be added to Eq. 2 in order to account for the thick-element nature of the CRL, as proposed by Kohn et al. (2003). The corrected focal length for a thick CRL is given by: This focal distance is taken from the middle of the CRL and L CRL is the CRL longitudinal size, that is, distance from the front surface of the first optical element to the back surface of the last lens. Another important parameter for optical design is the lens geometrical aperture A, as it provides an upper bound for the numerical aperture of the system and, ultimately, to the theoretical optical resolving power. Assuming a parabolic profile of the refracting surface, the lens geometrical aperture can be calculated as: where L is the lenslet thickness and t wall is the distance between the apices of the parabolas, commonly referred to as web thickness.
(a) lens saggital cut (b) N-stacked lenses to form a CRL

Figure 1
(a) Sagittal cut of a X-ray lens showing its main geometrical parameters. This concave lens focuses X-rays in the y-direction if n 1 > n 2 . (b) N-stacked lenses.
A single X-ray lens refracts very weakly. To overcome this drawback -pointed out as early as the late 1940's (Kirkpatrick & Baez, 1948) -lenses are usually stacked, hence "compound" in compound refractive lenses.
Due to absorption, the geometrical aperture defined in Eq. 4 is greater than or equal to the effective lens aperture as indicated by (Kohn, 2017). There are several reported ways of defining the effective lens aperture. Figure 2 shows the transmitted intensity profile of a CRL composed of 10 2D-Beryllium lenses with nominal radius R x,y = 50 µm and circular geometric aperture A = 440 µm at different energies. Unlike visible optics, where the transmitted intensity profile within the aperture, closely follows that of the illumination, the transmitted profile through a (stack of) X-ray lens(es) has strong absorption towards the edge, which defines the CRL as an apodised optical system. Intensity transmission profile of a CRL composed of 10 2D-Beryllium lenses with nominal radius Rx,y = 50 µm, geometric aperture A = 440 µm and t wall = 10 µm at different photon energies. Vertical dashed line represents the lens geometrical half-aperture. The calculations were done using the "Synchrotron Radiation Workshop" computer code (Chubar & Elleaume, 1998).

CRL performance
Here we present the reader with some other useful figures of merit commonly used for evaluating the performance of optical systems.

Diffraction limited focal spot
Even an ideal and aberration-free finite optical element is not able to image a point-source to a point-like image. Limiting the extent of the focusing element by defining an aperture will induce diffraction effects on the wavefront and these will limit the smallest reachable focus spot size. The normalised response of the optical system to this point-like source input is called the point-spread-function (PSF). For a system with circular aperture and uniform amplitude across the exit pupil, the intensity of such focused beam at the image plane is proportional to a squared first-order Bessel function of the first kind (Airy pattern). The FWHM of the central cone is given by: where the M is the magnification of the system, which goes to zero for a plane wave or a very distant source. Systems with nonuniform illumination at the pupil exit, in our case apodised systems approaching a Gaussian illumination (see Fig. 2), may present a different PSF shape depending on the truncation imposed by the aperture. A very weakly truncated focusing system (eg. transmission curve for 6 keV in Fig. 2) will have a Gaussian-shaped focal spot as little to no cropping occurs and therefore diffraction effects can be neglected. Increasing the truncation of the beam enhances diffraction effects from the geometric aperture. A strongly truncated focusing system (eg. transmission curve for 12 keV in Fig. 2) will have a PSF that resembles the diffraction pattern in the far-field associated with the aperture of the system 2 (Mahajan, 1982;Mahajan, 1986).

Tolerance conditions for aberrations
Introducing errors to the optical system will reduce the peak intensity in the PSF. The ratio between the peak intensities of the aberrated-and non-aberrated PSF of a system with the same aperture and focal length is referred to as the Strehl ratio -cf. §9.1.3 in (Born et al., 1999). The optical aberrations on the exit pupil of an optical system can be described by the aberration function Φ(x, y), with the dimension of metres, which represents any deviation in shape from an ideal profile. For small aberration values, the Strehl ratio can be approximated 3 by: where λ is the wavelength and ∆Φ is the standard deviation of the aberration function Φ(x, y). An important consequence of Eq. 6 is that the reduction in the peak intensity on the focal plane does not depend on the type of aberration nor the focal length of the optical system, but on its standard deviation across the exit pupil of the optical system (Born et al., 1999). Alternative expressions to Eq. 6 are available in §8.3 of (Mahajan, 2011), namely: known as the Maréchal expression and: an empiric expression that fits better numerical results (Wetherell, 1980). However, for strong aberrations, there is no simple analytic expression to describe the relation between the Strehl ratio and the standard deviation of the aberration function Φ(x, y) (Kessler, 1981). It is possible to define an arbitrary minimum acceptable value to the Strehl ratio when evaluating an optical element quality (tolerancing). This value depends on the final application and the desired performance. However, a value of S ratio ≥ 0.8 is commonly found throughout literature as an indicator of a wellcorrected optical system 4 . Inserting S ratio ≥ 0.8 in Eq. 6, one obtains: which is known as the Maréchal criterion for optical quality. Equations 7 and 8 give similar limits: λ/13.67 and λ/13.30, respectively. In order to apply Eq. 9 to the case of an X-ray lens, we use Eq. 13b (from §3.1−The complex transmission element) with ∆φ = 2π λ δσ z = 2π λ |∆Φ|, where ∆φ is the standard deviation of the phase, and we replace the projected thickness ∆z with the standard deviation of the projected figure error σ z : Equation 10 gives an upper limit to the standard deviation of accumulated figure errors for X-ray lenses in order to comply with the Maréchal criterion of tolerable wavefront aberrations, or in other words, to sustain a S ratio ≥ 0.8. For a more complete discussion on the aberrated PSF, Strehl ratio and tolerance conditions for primary aberrations, refer to §9 from (Born et al., 1999) and §8 from (Mahajan, 2011).

Chromatic aberrations
The optical properties of the X-ray lenses are strongly dependent on the wavelength as both δ and β have an energy dependency. This causes chromatic aberrations and limitations on the optical performance of the CRL under an X-ray beam with finite bandwidth. The chromaticity of X-ray lenses can be used favourably for X-ray harmonic rejection from insertion devices and coarse X-ray spectrum filtering Polikarpov et al., 2014).

CRL: physical optics modelling
In this section, we present the models for accurately representing a realistic CRL following wave-optics representation (Goodman, 2017). We start by defining a complex transmission element and, with increasing complexity, we present the different models that are based on this complex transmission element concept.

The complex transmission element
The amplitude transmission of radiation through matter can be expressed as a complex operator - §2 in (Paganin, 2006): with z being along the beam direction, x and y are the transverse coordinates to z, λ is the wavelength and C is a path integral along ds. Favouring a more compact notation, we drop here the explicit energy dependency of the index of refraction. The z−dependence of δ and β is abandoned in the projection approximation, which is often valid when modelling refractive optics 5 . The integral in Eq. 11 reduces to: where: The integration path ds is along the z−direction. It is proportional to the projected thickness ∆z, which in turn, depends on the transverse coordinates: ∆z ≡ ∆z(x, y). Equation 13a shows the absorption experienced by the wavefront when passing through matter (Beer-Lambert law) and Eq. 13b shows the phase-shift experienced by the wavefront. The coefficient multiplying ∆z in T BL is know as linear attenuation coefficient µ. The transmitted electric field is obtained by multiplication of the input field with the complex transmission operator in Eq. 12, that is,

Ideal thin lens and single lens equivalent
At any point inside the geometric aperture of a single biconcave paraboloidal X-ray lens, the projected thickness ∆z can be calculated as: Eq. 14 can be substituted into Eqs. 13a and 13b to retrieve the complex transmission element expression for an X-ray lens: The • symbol represents an arbitrary input electric field. Eq. 15, the single lens model, accounts for the absorption (first exponential) and phase shift (second exponential ignoring the constant phase shift induced by t wall ). The complex transmission representing a CRL composed of N elements is, thus, represented by: The model represented by Eq. 16 will be referred to as the single lens equivalent. This model represents a lens stack by a single transmission element with equivalent focal distance and the projected thickness of all the N single lenses as shown in Fig. 3(a). Hierarchical depiction of the CRL. (a) illustrates a single thin element equivalent of several lenslets. This representation accounts for net refraction and absorption in one transmission element but ignores intra-lens spacing. (b) multislice (Munro, 2019) representation of a CRL. Here each lens of the stack is represented individually by one transmission element. Those are separated by a drift space corresponding to the typical distance between elements (∆s). (c) Not only can the CRL be represented as a series of thin elements separated by drift spaces, but also figure errors can be added. They are placed directly after the thin element representing a single X-ray lens.

Multi-slicing representation of a CRL
For a CRL composed of a very high number of lenslets, the single-lens equivalent approximation (Eq. 16) may not be adequate to correctly represent such optical systems mainly due to the thick nature of the stack -evidenced by Eq. 3; and due to the progressive focusing inside the CRL (Schroer & Lengeler, 2005) -exaggerated in Fig. 1(b). For such cases, it is possible to adapt the multi-slicing (MS) techniques for the calculation of the transmission of a wavefront through a CRL. Unlike the methods described by Paganin (2006) and most recently, by Li et al. (2017) and Munro (2019), where a single weakly-scattering optical element is sliced into several slabs, it is sufficient for most practical cases to break down a CRL into its lenses as shown in Fig. 3(b). This can be justified by the fact that at their typical operation energy, the materials used for lens manufacturing have a very low δ (Serebrennikov et al., 2016), rendering the individual lenslets a weak focusing element where the projection approximation holds (Protopopov & Valiev, 1998). The complex transmission representation of a CRL based on the MS approach is given by: where D(∆s) is the operator formulation of the Fresnel freespace propagation over a distance ∆s (distance between the centre of two adjacent lenses), from §1.4.1 in (Paganin, 2006).
Eq. 17 represents a wavefront • modified by a single lens complex transmission T single lens , followed by free-space propagation D(∆s) over a distance ∆s. The multiplication of the resulting electric field by the transmission element and subsequent free-space propagation is done (N − 1) times until the N th lens is reached and the last element of the lens stack is accounted for.
Optical imperfections measured with high spatial resolution can be readily converted into a transmission element by direct application of Eq. 12 to the height profile, provided it is a 2D map of the phase defects. In this case, the height profile will be the projected thickness of ∆z(x, y) in the preceding equations. The MS model introduced earlier in this section can then be adapted to account for the phase errors of the individual lenses: with: This extended version of the MS model is shown in Fig. 3(c).

Analysis of figure errors from metrology with X-ray speckle tracking
To simulate the CRL performance on a beamline more accurately, one needs a 2D map of surface imperfections. Optical and tactile metrology methods are not the most appropriate to characterise single X-ray lenses due to their geometry (Lyatun et al., 2015) and their general insensitivity to subsurface defects (voids, inclusions etc). At-wavelength metrology is often more appropriate for obtaining the figure errors. Several methods are available using X-rays: tomography (Narikovich et al., 2017), grating interferometry (Rutishauser et al., 2011), speckle tracking (Berujon et al., 2013) and ptychography . Each error profile used in the following simulations comes from a real 2D-Be lens individually characterised using X-ray speckle vectorial tracking (XSVT) (Berujon et al., 2019a; Berujon et al., 2019b) at the BM05 -Instrumentation Beamline at the ESRF (Ziegler et al., 2004). This technique allows for a high spatial resolution (pixel size of ∼ 0.65 × 0.65 µm 2 ) characterisation of the lens figure error in projection approximation, which can be incorporated directly in the simulations. Table 1 Summary of the main parameters from the metrology of the Be lenses used in the simulations. The bottom rows display the accumulated figure errors calculated by propagating a plane wave through the system; the accumulated figure errors weighted with the system transmission at 8 keV; and the quadrature summation of the individual r.

Aberrations from metrology data
Following Harvey et al. (1995), the figure errors of the lenses can be specified in terms of their spatial frequency, as they often have different effects on the image quality. Three regions are commonly used for that: low-, mid-and highspatial-frequencies. The low-spatial frequencies are responsible for changing the beam profile and reducing the peak intensity. Mid-and high-spatial frequencies (HF) are responsible for scattering the light around the (focused) beam and have potential for broadening it, together with the expected reduction of the Strehl ratio. The low-frequencies are related to the conventional optical aberrations (Born et al., 1999) and they can be described by a set of orthonormal polynomials. For optical systems with a circular aperture, 2D Zernike polynomials are often used (Mahajan & Dai, 2007), while for rectangular apertures (typical of 1D-focusing lenses) 2D Legendre polynomials are more common (Ye et al., 2014) 6 . The mid-and high-frequencies are the residuals from the polynomial fit of the aberrated profile. When referring to the full frequency extent, that is, the addition of the low-, mid-and high-spatial-frequencies, we use "full profile" (FF). From the analysis of the experimental data we can infer that the low-frequencies span from ∼ 500 µm or 2 × 10 3 m −1 (geometrical aperture of a lenslet) to ∼ 50 µm or 2 × 10 4 m −1 (power spectral density cut-off -cf. Fig. 4), while the mid-and high-frequencies span from ∼ 50 µm or 2 × 10 4 m −1 to ∼ 1.3 µm or 0.8 × 10 6 m −1 (obtained from the Nyquist frequency of the measured data: determined by one over twice the detector resolution). Table 1 presents the radius of curvature, r.m.s. value of the figure errors and useful aperture obtained by XSVT for each simulated lenslet and the accumulated error profile, the net erroation seen by a plane wavefront passing through the lens stack. Figure 4 presents the accumulated figure errors for the simulated stack, along with their power spectrum density for the full profile, low-, and mid-and high-spatial frequencies; as well as the Zernike polynomial fit of the full profile, which is dominated by primary spherical aberration (Z 11 ), tertiary spherical aberration (Z 37 ) and horizontal coma (Z 8 ). Tilts and defocus (Z 2 , Z 3 and Z 4 ) are not treated here as optical errors. Z1 · · · Z5 · · · · Z10 · · · · Z15 · · · · Z20 · · · · Z25 · · · · Z30 · · · · Z35 · · −0.   Zernike polynomials (in Noll notation) amplitude from the transmitted wavefront phase from CRL with full errors. The amplitudes are normalised to the wavefront inÅngström. The orange bars indicate rotationally-symmetric terms. Notable contributions are Z 2 and Z 3 (tilts), Z 4 (defocus), Z 8 (horizontal coma), Z 11 (first order spherical aberration) and Z 37 (third order spherical aberration).

Simulation results
In this section, we present the simulations of the main CRL models. All simulations presented here were done using the "Synchrotron Radiation Workshop" (SRW) (Chubar & Elleaume, 1998) 7 , as it conveniently offers the possibility of fully-and partially-coherent calculations, and presents native parallelisation with the MPI standard . Fully coherent calculations were done using a single CPU of an Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz, while partial coherent simulations used 28 CPUs of the same computer infrastructure (NICE OAR cluster at the ESRF).

Lenses and lens stack
The simulated lenses are 2D-Be lenses with a nominal radius of R x,y = 50 µm chosen as representative of lenses used widely at beamlines at many synchrotrons. Such lenses have typically 1 mm thickness and are held in a 2 mm thick lens frame. If the wall thickness is ∼ 30 to 40 µm, the lens geometric aperture calculated by applying Eq. 4, which gives A ≤ 440µm. The lens stack is composed of ten lenses piled without any spacing other than the intrinsic lens frame thickness. The transmission through this CRL can be seen in Fig. 2. At 8 keV, the energy used for the simulations, the index of refraction for Beryllium is n = 1−5.318×10 −6 +i·2.071×10 −9 . Applying Eq. 2 with N = 1, one obtains the focal length for a single lens: f lens = 4.701 m. The lens stack focal distance can be obtained by applying Eq. 3 with N = 10 and L = (N−1)·2 mm = 18 mm: f CRL = 473 mm, giving a magnification of approximately 126 : 1 (M ≈ 8 × 10 −3 for a source 60 m away from the CRL) and a diffraction-limited spot size (Eq. 5) of ∼ 200 nm.

Simulations with a coherent wavefront
For this set of simulations, we used a collimated (plane) wavefront as any deviations from a constant phase and intensity on the exit of the optical system can be immediately attributed to the CRL model being studied.

The PSF: ideal focusing
After passage through the CRL model being studied, a plane wave will develop a quadratic phase term that has a curvature radius equivalent to the effective focal distance of the optical system. Table 2 compares the calculated focal lengths (Eq. 2 and Eq. 3) against the focal length extracted from the simulation models. While the single lens equivalent model and the CRL multi-slicing values were obtained using the nominal radius R = 50 µm, the focal length the CRL-MS+FF model was obtained considering the radii from Table 2.
The propagation of the wavefront from the exit pupil of the CRL to the focal length distance (image plane) is equivalent to an optical 2D-Fourier transform of the system pupil function. The PSF of the optical system corresponds to the squared modulus of this Fourier transform, which is the wavefront intensity at the focal plane, considering a plane wave illumination as in §2.3.1 and §6.2 from (Goodman, 2017). The phase of the propagated field at the focal position along with the normalised PSF for the multi-slice CRL models (without and with the addition of figure errors) can be found in Fig. 5(d)-(e), Fig. 6(d)-(e), Fig. 7(d)-(e) and Fig. 8(d)-(e). The calculated FWHM of the central lobe of the PSF for the single-lens equivalent, multi-slicing and multi-slicing with figure errors is displayed on Table 3 along with the theoretical diffraction-limited spot size (Eq. 5). The relative intensities of the aberrated PSF normalised to the ideal case (Strehl ratio) are compiled in Table 4 and shown in Fig 9(a).

Beam caustics
The beam characteristics at the image plane are very important and the simulations show obvious differences between the CRL multi-slice with and without figure errors at that position. We complement this with investigations of the effect of optical imperfections away from the focal position, especially because several experimental applications may use a defocused beam. To get an overview of the beam evolution up-and downstream the focal position, one can propagate the wavefront along the optical axis and for each position extract a cross-section of the beam. This will be referred to as the beam caustic 8 . The beam cross-section for selected positions along the beam optical axis can be seen in Figs. 5(b)-8(b), while Figs. 5(c)-8(c) show the beam caustics for the same multi-slice CRL models. The horizontal cuts were taken at y = 0. The zero position along the optical axis is given by the distance from the centre of the CRL to the image plane for each model (c.f. Table 2). To calculate the beam caustics, the wavefront was propagated from 10 mm upstream the focal position to 10 mm downstream in 4001 equally spaced steps along the optical axis.

Partially coherent simulations
The PSF and beam caustic simulations shown previously are both fully-coherent calculations. They present the focusing of a perfect plane wavefront to a diffraction-limited spot. This shows the intrinsic limitations of the optical system, but inherently neglects the effects of an extended and partially coherent source.

X-ray source
The emission of a single electron passing through an undulator (filament beam) is fully coherent. By changing the electron initial conditions (positions, direction and energy), propagating the emission of this electron through the beamline and adding up intensities, one can simulate partially coherent radiation if the electron beam phase space (5D) is sufficiently sampled . In a conservative approach, the partially coherent simulations presented here were done using 10 4 wavefronts to ensure convergence.
For this section, we chose to implement a hypothetic beamline operating on the new Extremely Brilliant Source (ESRF-EBS) magnetic lattice (Dimper et al., 2014). The beamline sits on a straight section and has a CPMU18 9 undulator as an insertion device. The undulator was tuned to its first harmonic at 8 keV for all simulations. The photon source size is ∼ 71.92 × 12.38 µm 2 and its divergence ∼ 17.66 × 14.72 µrad 2 (FWHM, horizontal vs. vertical). The first optical element was placed 60 m downstream of the centre of the undulator to ensure a beam footprint larger than the geometric aperture of the CRL being studied (A ∼ 440 µm) and a constant intensity over it. The transverse coherence length at the optical system is estimated to be ∼ 60×448 µm 2 , from van-Cittert-Zernike theorem. If there is no cropping of the beam (e.g. use of slits to generate a secondary source), the horizontal direction is less coherent than in the vertical, leading to stronger blurring of the image in the less coherent direction -cf. §7.5 in (Goodman, 2017).

Beam characteristics at the focal position
The image of the extended X-ray source is similar to convolution between the geometrically demagnified image of the source and the 2D-PSF of the imaging system, provided the beam is not strongly cropped anywhere in the beamline being simulated. Figs. 5(e)-8(e) show the normalised demagnified image of the undulator photon source while Table 3 presents the horizontal and vertical FWHM for those simulations. Normalising the images to their peak intensity aids qualitative comparison, but omits the fact that the introduction of aberrations to the system contributes to the reduction of the peak intensity and increases the background radiation -which has been discussed in §2.2−Tolerance conditions for aberrations. Figure 9(b) shows horizontal and vertical intensity cuts for the multi-slice CRL models. This is a graphical representation of the Strehl irradiance ratio, as the intensities of the aberrated models are normalised to the peak intensity of the aberration-free CRL model.

Beam profile evolution along the optical axis
Calculating the full beam caustic with partially-coherent simulations is impractical using current simulation methods and computers/clusters especially if: i) the beamline does not present a very high degree of coherence, thus requiring a very large number of wavefronts to accurately simulate the partialcoherence; ii) the beamline has low transmission (strong beam cropping, diffraction orders outside apertures); or iii) the sampling along the optical axis is high. Still, many applications require to operate up-or downstream of the focal position and assessing the beam quality on such positions is essential. Figures 5(a)-8(a) show the beam profile evolution spanning 10 mm along the optical axis for selected positions up-and downstream the image plane. Images are displayed showing their relative intensity to the beam in the focal plane. The positions chosen were the same as in , selected cuts along the beam caustics, so direct comparison between fully-and partially-coherent simulations can be done.

Discussion
In this section, we discuss the main results drawn from the simulations presented previously. We start by making considerations on the effect of optical imperfections on a (partially) coherent X-ray beam. The merit of using the Strehl ratio for X-ray lenses tolerancing is discussed. Finally, some comments on the simulation times of the several models and simulations are done.

The effect of optical imperfections
Applying the Maréchal criterion (Eq. 9) calculated for Beryllium lenses illuminated at 8 keV requires the accumulated projected figure errors to be σ z ≤ 2.08 µm. Table 1 and Fig. 4 show that except for the high-frequency range, the system is operating far from ideal as the system exceeds the limit imposed by the Maréchal criterion.
The addition of the mid-and high-spatial frequency errors (σ z ∼ 1.77 µm) are related to scattering around the focused beam, contributing thus to increased background and consequently reducing the peak intensity following Harvey et al. (1995). Using a linear scale, both the ideal PSF and the demagnified source image in Figs. 5(e)-(f) are indistinguishable from their aberrated counterparts in Figs. 6(e)-(f), which is due to the fact that the accumulated figure error complies to the Maréchal criterion. When considering the low-spatialfrequency figure errors (σ z ∼ 4.91 µm), however, concentric faint rings start appearing on the PSF. Homogeneous concentric rings on the PSF are a classical signature of spherical aberration, which is a major component of the LF figure errors -cf. Z 11 in Fig. 4(g). The predominance of spherical aberration on 2D parabolic Be lenses has already been observed; see Fig. 6.14 of Seiboth (2016). The PSF due to spherical aberration can be seen also in Figs. 8.5 and 8.6 from (Mahajan, 2011). In the partially-coherent simulations, the rings around the main lobe seen at the PSF simulations are stretched horizontally to the point that their visibility is maintained vertically, but horizontal cuts ( Fig. 9(b)) show almost no trace of them, due to the reduction in transverse horizontal coherence (blurring effect). Small misalignments between the lenslets and some residual tilt from the LF errors contribute to a lateral displacement of the beam in the image plane -this is observed also in Figs. 7(e) and 8(e). Using the full-frequency-range figure errors (σ z ∼ 5.22 µm) yields a combined effect that is analogous to the superposition of the HF and LF figure errors. The CRL-FF model can be seen in Fig. 8. The diffraction effects from the aperture of the CRL are not easily observable because the system has an apodised Gaussian intensity at the exit pupil (Mahajan, 1986).
The addition of figure errors change the beam profile more significantly up-and downstream of the focal position. Fig. 5(a)-(c) show the focusing done by the multi-slicing model of the CRL without any optical imperfections. Introducing the HF errors does not significantly change the beam shape as they contribute to the scattering of light outside the beam envelope defined by the beam caustics -cf. Figs. 6(a)-(c). The LF errors act to change the beam shape dramatically as can be seen in Figs. 7(a)-(c) and Figs. 8(a)-(c). Upstream of the image plane, a persistant central lobe is observed, albeit much less intense, with a high background around it thus reducing the signal to noise ratio. Downstream, the beam has a drop in intensity in the middle, looking like a doughnut when a cut transverse the optical axis is made. This behaviour is observed both on fully-and partially-coherent simulations. Such beam caustics have been extensively reported by experimental groups working under high coherent conditions, with similar optics and ptychographic reconstruction of X-ray beams -cf. Fig. 3 in (Schropp et al., 2013), Fig. 2 in  and Fig. 3 in (Gasilov et al., 2017).

Figure 10
Strehl ratio from numerical simulations and from the application of different approximations (Eqs. 6-8) as a function of the figure error σz from a lens stack made of Beryllium illuminated at 8 keV. The vertical dashed black line indicates the maximum tolerable thickness (Eq. 10) for complying with the Maréchal criterion (Eq. 9), that is, σ λ/14 ≈ 2.08 µm. The partially-coherent simulations were done with 10 4 wavefronts.

The Strehl ratio for X-ray lenses
The Strehl ratio for the CRL models is presented in Table 4. In the numerical simulations, the intensity at the centre of the beam is normalised to the intensity obtained by a single-lens equivalent system. Due to this fact, the CRL-MS model has slightly more intensity in the central peak than the single-lens equivalent (∼ 0.9% and ∼ 0.4% for the coherent and partiallycoherent cases, respectively), which is explained by the fact that the X-rays are continuously being focused inside the CRL 10 -cf. (Schroer & Lengeler, 2005).
Our results show ( Table 4) that applying the Strehl ratio calculated from analytic equations (Eqs. 6-8) overstates the effect of moderate figure errors on the overall system performance. In order to understand the dependency of the numerically simulated Strehl ratio versus height error r.m.s. we used the CRL-MS+HF model and scaled each individual figure error (Table 1) by a constant value to allow for a scanning of the total projected figure error σ z . The results in Figure 10 show the expected Strehl ratio as a function of the projected figure errors σ z for different analytical approximations (Eqs. 6-8) and for the numerical calculations with a fully-and partially-coherent illumination. All approaches show very good agreement up to S ratio > 0.8, when they start diverging. The expressions for S ratio a (Eq. 6) and S ratio b (Eq. 7) can be considered as approximations for S ratio c (Eq. 8), therefore are only expected to be valid over a restricted range (large S ratio ). A fit of the simulation data (coral rhombuses and blue squares in Fig. 10) give: S ratio coh. ≈ exp − 2.32 · 10 10 σ 2 z − 6.13 · 10 4 σ z + 2.54 · 10 −2 , S ratio part.-coh. ≈ exp − 2.28 · 10 10 σ 2 z − 5.07 · 10 4 σ z + 2.29 · 10 −2 .
Unfortunately, due to the nature of the projected figure errors (in the range of few micrometres r.m.s.), we are not able to discard the non-quadratic terms. We can rewrite Eqs. 20 as: where κ are scaling constants that, in principle, the number of elements, lens material, energy and, mostly importantly, the spatial distribution of the accumulated errors over the optical element aperture. For our particular examples, κ 1 = 0.71, κ 2 = 0.28 and κ 3 = 2.54 · 10 −2 for the coherent case and κ 1 = 0.70, κ 2 = 0.24 and κ 3 = 2.29 · 10 −2 for the partiallycoherent case. When comparing Eq. 21 with Eq. 8, a κ < 1 suggests that there is some weighting of the phase errors reducing their effect, but simply multiplying the accumulated phase errors (cf. Table 1) with the normalised optical system transmission (cf. Fig. 2) does not allow prediction of κ and we leave this as an open question at the time of writing.
Following the recent discussion about the pertinence of the S ratio ≥ 0.8 as an indicator of optical quality for the X-ray regime and the performance of such optical systems away from the focal position (Cocco, 2015;Cocco & Spiga, 2019), we can observe from our simulations (Figs. 5-8) that in terms of wavefront preservation, X-ray lenses are apparently more susceptible to the low-frequency figure errors, as they are the ones that change the beam profile up-and downstream the focal position. The high-frequency errors lead to scattering of the beam and speckles, but generally, do not change the beam shape even away from the focal position. It is clear from Figs. 7 and 8 that the Strehl ratio encountered at the focal position (cf. Fig. 9) is not preserved up-or downstream from it. Fortunately, the low frequencies are those which can be readily corrected by the fitting of corrective optics . Corrective plates aim at increasing the Strehl ratio in the low-frequency range, leaving the high-frequencies as the bottleneck for corrected systems performance.

Simulation time
Increasing the complexity of the simulation model comes at the expense of increasing the overall simulation time, but as long as the transverse wavefront sampling is maintained, memory consumption is not affected from one model to another. The time increase in the simulations is mainly due to: i) increase in the number of drift spaces and the number of optical elements; ii) from reading the densely sampled metrology data. Table 5 presents the typical simulation times for this work. Those are particularly high because the transverse sampling of the wavefronts is several times larger than the nominal minimal sampling necessary to mitigate artefacts or under-resolved features on the wavefront. Employing 10 4 wavefronts for the partially coherent simulations is also exaggerated, but was done to ensure that any changes on the simulation come from the change of model being studied and not from statistical nature of the sampling of the electron-beam phase-space. The simulation times presented on Table 5 can be certainly be reduced without loss of accuracy by adopting a more sensible sampling.

Table 5
Summary of the simulation times for different CRL models. From the most simple one (single lens equivalent) up to the more complex multi-slicing (MS) with figure errors. Simulations were performed on a Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz cluster at the ESRF. Partially coherent calculations were done using 28 cores in parallel.

Conclusion
Building on physical optics concepts and already implemented optical elements in SRW, we have expanded the concept of the complex transmission element representation of the CRL to account not only for its thick element nature but also real imperfections obtained with at-wavelength metrology. We have studied the adequacy of commonly used design equations and figures of merit by doing coherent and partially-coherent simulations. We were able to accurately simulate the effects of figure errors on beam shape and intensity along the optical axis. Our simulations of the beam caustics compare well with experimental data from other research groups using the same type of Be lenses. We show that using the Strehl ratio formulations given by Eqs. 6-8 leads to an underestimation of the system performance if the total projected figure errors are larger than the limit imposed by the λ/14 criterion (Maréchal criterion for optical quality). We see an immediate application to lens tolerancing and guidelines for accepting or not commercial optical elements and in-house lens production and testing of X-ray lenses (quality control). By decomposing the figure errors in frequency ranges, we note that the strongest contribution to the degradation of the wavefront both in focus and away from it comes from the low-frequency range, which is where corrective optics are most efficient. By being able to add individual lens profiles to a lens stack we envisage the possibility of calculating corrective optics for an arbitrary lens combination offline, as opposed to experimentally measuring the wavefront phase errors of the lens stack as proposed by Seiboth et al. (2017).