X-ray mirrors are widely used in beamlines and laboratories as focusing or collimating optics. As well as the highly accurate processes used to fabricate them, optimized alignment of X-ray mirrors also plays an important role in achieving an ideal X-ray beam. Currently, knife-edge scans are the most often used method for aligning X-ray mirrors, which can characterize the focal size and tune the alignment iteratively. However, knife-edge scanning provides only one-dimensional information and this method suffers from being time-consuming and requiring a high-resolution piezo translation stage. Here we describe a straightforward and non-iterative method for mirror alignment by measuring the relationship between the tilt aberration and the misaligned pitch angle, which is retrieved by an at-wavelength metrology technique using a randomly shaped wavefront modulator. Software and a graphical user interface have been developed to automate the alignment process. Combining the user-friendly interface and the flexibility of the at-wavelength metrology technique, we believe the proposed method and software can benefit researchers working at synchrotron facilities and on laboratory sources.
Reflecting mirrors operating at grazing angles are an important component in many beamlines and laboratories for focusing or collimating X-ray beams with high efficiency. Significant advances in fabricating highly accurate X-ray mirrors have been made in the last decade with the root-mean-square (RMS) roughness reaching less than 0.1 nm.1 In addition, to realize an optimized beam shape and wavefront, precise alignment of the optics is also extremely important. As shown by simulations, even a small misalignment of a mirror can introduce obvious wavefront aberrations,2,3 especially for high-precision strongly focusing mirrors.
Currently, there are several different approaches that are commonly used for alignment of X-ray focusing mirrors including characterizing either the focal spot size4,5 or the ray or wavefront error6–10 as feedback for iterations of alignment. Alternatively, the beam probe can be reconstructed with phase retrieval techniques as a guide for alignment.11,12 For nano-focusing optics, the focal spot cannot be easily imaged directly by currently available detectors due to their limited spatial resolution. Knife-edge scanning4,5 for characterizing focal spot sizes also faces challenges due to the requirement for nanometer resolution on the translation mechanism. The knife-edge measurement is also time-consuming because it is one-dimensional (1D), whereas the focus needs to be located in three-dimensional (3D) space. Some wavefront sensing techniques, such as with a Hartman sensor,9 can provide 2D information albeit with low spatial resolution. Furthermore, the methods discussed above provide no direct information of the misalignment due to the nonlinearity between the aberrations and the misalignment for focusing mirrors. Therefore, either a manual trial and error procedure or a dedicated closed-loop control system13 is needed for accurate mirror alignment. Recently, ptychography has seen impressive applications in at-wavelength metrology due to its ability to quantitatively retrieve the whole beam profile from the optics to image plane and, therefore, the focal plane can be determined and the wavefront aberration characterized simultaneously.12 However, at the moment, it is still challenging to apply on partially coherent sources, such as bending magnet beamlines and laboratory sources, can have an extremely small field of view, requires long acquisition and computational times, and has a high demand on stability of beamline components.
In recent years, X-ray near-field speckle patterns have been widely applied in phase-contrast imaging techniques and at-wavelength metrology.10,14 These speckle-based techniques have drawn increased attention due to their cost-efficiency and flexibility compared with other wavefront sensing techniques. Speckle-based metrology has been successfully used to measure the wavefront of X-ray beams,10 slope errors of X-ray mirror surfaces,15 and the transverse coherence of X-ray beams.16
Here, we describe a software tool for automatic alignment of X-ray mirrors using a novel method,17 combining the principles of pencil-beam scanning6,7 and speckle-based at-wavelength metrology.18 The process has the simplicity of a pencil-beam scan but is able to provide 3D information because the speckle-based technique utilizes a 2D randomly shaped wavefront modulator rather than the 1D slit used in traditional pencil-beam scanning techniques. This method does not require iterative processes and, therefore, the image acquisition and data processing can be conveniently separated. The independent software we have developed is not restricted to any specific hardware control and can be used by any beamline or laboratory.
In this section, we give a synopsis of the proposed method which is illustrated in Fig. 1. Assuming an ideal line-focusing elliptical mirror is misaligned by an angle of Δθ in pitch. From the ray tracing simulation, shown in Fig. 1(b), it can be seen that the misalignment causes both lateral and longitudinal ray aberrations compared to the perfect line focus illustrated in Fig. 1(a) where no misalignment exists. Pencil-beam scanning with the detector at or close to the focal plane measures the lateral ray aberration directly. The shape of the ray error with respect to the slit position indicates the potential misalignment of the mirror.7,19 Our proposed method shares a similar principle, but, instead of measuring the lateral ray error, it uses the longitudinal ray aberration to quantify the misalignment.17
By using a randomly shaped wavefront modulator, we have adapted a speckle-based at-wavelength metrology technique.18 Assuming a speckle is centered at pixel i on the detector and shifted to pixel j due to the translation s of the modulator, as illustrated in Fig. 1(c), the focus-to-detector distance R can hence be calculated with
where p is the detector pixel size and L is the distance between the modulator and the detector. As shown in Fig. 1(d), Ri is not linear with respect to i when there is a misalignment in the pitch angle, but the slope of ΔR/Δi has been found to be linear with Δθ.17 Only when there is no misalignment in the pitch angle (Δθ = 0) does R become the same for all pixels because there is no longitudinal aberration. Therefore, correct alignment of the pitch can be achieved by finding the linear function of ΔR/Δi = f(θ) = 0. As R can be calculated using Eq. (1), the focal position can therefore be located simultaneously with the alignment procedure. Experimentally, a series of scans translating the wavefront modulator are made at different pitch angles close to the expected, theoretical value and the speckle-based technique18 is applied to measure si in Eq. (1).
III. GRAPHICAL USER INTERFACE (GUI)
The software was written in MATLAB (The MathWorks, Inc.) and can be run as a MATLAB GUI although the compiled executable file can also be run as a standalone application without the need to install the MATLAB program. A screenshot of the graphical user interface (GUI) is shown in Fig. 2. All parameters are accessible within a single control window.
The input image files are expected to be in a single directory for each value of θ, and the software can select multiple directories to process the images in all the scan positions. Images in each directory are expected to have the same dimensions. The file paths of the image directories can be chosen via the file selection dialog or can be entered or edited manually in the file path table. No flat-field or dark images are required because the offset or errors from flat-field or dark signals exist in all the images and, therefore, do not affect the matching of the speckle pattern, assuming the speckle image signal is much stronger than the error from the flat-field or dark signal. The software can read all the image formats that MATLAB recognizes by allowing the user to specify the image extension. The default format is the most commonly used Tagged Image File Format (TIF). During the calculation, the data are converted to 64-bit floating number format for higher accuracy.
A standard procedure for processing a set of scans at different θ with the software consists of choosing the input image directories, specifying the experimental parameters, defining the data processing parameters, and activating the data processing. Among the experimental parameters, the pitch angles for the scans can be input manually in the table. However, if they are consequential, it is less time-consuming to input the starting angle and the step size as an array, and the range of pitch angles will be generated automatically according to the number of file directories. Even if it is not possible to measure the distance, L, between the wavefront modulator and the detector accurately, the alignment will not be affected by a small offset. This distance can also be a good indication of whether the result is reasonable because the retrieved R should be slightly larger than L if the wavefront modulator was located downstream of the focus. If the result was not reasonable, one cause could be that the scan direction was set incorrectly because this determines whether the translation of the modulator s in Eq. (1) is positive or negative and changes the value of the result.
When setting the parameters for the calculation, defining appropriate regions of interest (ROIs) is not trivial because meaningless results from outside of the mirror edges could disrupt the fitting of R and calculation of the correct pitch angle. In the software, the ROI range can be manually input as pixel values or selected by dragging a rectangle over the desired region in an image window. For 1D focusing mirrors, the ROI pixel values input here are only defined in the direction orthogonal to the focusing direction because the focusing direction is automatically defined in the software for each pitch angle scan. Otherwise, when the pitch angle is changed, the image position on the detector would also change and, therefore, to manually define all ROIs for each scan angle would be time-consuming and potentially less accurate. The automatic determination of the ROI is achieved by locating the intensity drop in the normalized integrated profile of the image that occurs at the edge of the mirror. The results can also be improved by removing some pixels from the edges of the mirror reflection in case there are interference patterns or less accurately polished parts at the mirror edges that distort the calculations.
For efficient alignment, 1D processing is recommended. Parallel processing of all the scans can be chosen to speed up the calculation if many scans were taken. Tracking of the shift of the modulator is achieved computationally by 2D normalized cross-correlation and locating the local maxima with subpixel accuracy by polynomial fitting. The cross-correlation outputs can be monitored during the process although it is not recommended to be turned on all the time because it increases the processing time when plotting cross-correlation results for each pixel. After the process has finished, the optimal pitch angle is calculated by linear regression and the position of the focus is also output. For the 2D processing, extra parameters have to be set and images from only one, specified, θ value scan is chosen. The correlation window width can be set although there is a trade-off between noise and spatial resolution that needs to be considered.20 A 2D map of calculated R is produced together with the retrieved Zernike coefficients.21
Further technical details and instructions can be found in the user guide included with the software distribution.
IV. EXAMPLE OF MIRROR ALIGNMENT
In this section, we describe an example of the mirror alignment using the software. The experiment was performed at the B16 Test Beamline at the Diamond Light Source synchrotron.22 An elliptical mirror with specification of source-to-mirror center distance p = 45 m, mirror-to-focus distance q = 0.235 m, and theoretical pitch angle θ = 3 mrad, which forms the vertically focusing mirror of a pair of Kirkpatrick-Baez (KB) mirrors, was tested. The randomly shaped wavefront modulator was a piece of abrasive paper with an average grain size of 5 µm. The detector was a Photonic Science scintillated CCD camera with a pixel size of 6.45 µm. The distance between the mirror and the modulator was about 0.35 m and between the modulator and detector was 2.583 m. The abrasive paper was mounted on a piezo translation stage and scanned with a 0.2 µm step size. Initially, the mirror was roughly aligned to be parallel to the beam longitudinally and to the detector horizontally with the help of direct radiography, then the pitch angle was set to the nominal value of 3 mrad. Five speckle-based scans of the wavefront modulator with pitch angles ranging from 2.97 to 3.21 mrad were measured. The ROI was chosen in the software, as shown in Fig. 3(a); R was calculated using Eq. (1), and the output is shown in Fig. 3(b). Compared to the smooth simulations displayed in Fig. 1(d), the results are heavily influenced by the signal derived from the mirror slope error, which can be identified by the same characteristic peaks appearing for each of the speckled-based scans. However, it was still possible to measure the different slopes of Ri that were induced at the different pitch angles for each scan using the 1st polynomial fitting, as shown in Fig. 3(c). From this, the best alignment pitch angle of 3.11 mrad was determined when the slope was zero. At the same time, the location of the focus at the optimized pitch angle was found to be 121.4 mm before the wavefront modulator. The time taken for the scan was 40 min by having 100 steps of the wavefront modulator at each pitch angle and 5 s per projection image, and the time taken for the calculation was approximately 30 s when 5 MATLAB workers (separate instances) were used in parallel. The scan time can be reduced by having fewer steps of the wavefront modulator and shorter exposure time per projection. Of course, at different beamlines and laboratories with different detectors, the required exposure time will vary in order to obtain a sufficient signal-to-noise ratio in the images. The example described here demonstrates that at the bending magnet beamline B16, excluding the initial manual coarse alignment, the proposed method is expected to take 5–10 min to run all the scans at different pitch angles and <1 min for the calculations to determine the optimum alignment pitch angle and the focal plane position of an X-ray mirror automatically.
An advantage of using this speckle-based technique for mirror alignment compared with using conventional pencil-beam scanning is that it can provide detailed 2D information as well23 and an example is shown in Fig. 4. In the 2D image, the horizontal stripes deriving from the mirror slope errors from fabrication are clear to see, together with some stronger and irregular patterns that are likely due to either contamination or radiation damage. These defects can be easily identified with the 2D processing, which can provide a better understanding of the alignment result compared with 1D methods, such as pencil beam scanning. From the fitted Zernike polynomials, we can also see that the 2nd term, which represents vertical tilt, is very strong and this agrees with our expectation because in this example we used the 1st scan, with a pitch angle of 2.97 mrad. Obviously, compared to the calculated optimum alignment pitch angle of 3.11 mrad, the 2D results from this scan at 2.97 mrad should have a prominent tilt aberration. Compared to 1D, 2D processing takes a longer amount of time, and for the example in Fig. 4, the elapsed time was 101 s for a single scan. Therefore, we recommend use of the 1D process for mirror alignment and the 2D calculation for assessment of the homogeneity and defects on the mirror surface.
An efficient and accurate method for aligning X-ray mirrors has been adapted from a speckle-based at-wavelength metrology technique. It shares similar principles as the pencil-beam scanning method, but instead of retrieving the transversal ray error, this new approach uses the longitudinal ray error to calculate the misalignment angle. Compared with conventional slit scanning, the proposed method can provide additional 2D information with the inherent advantages from the speckle-based technique. A user-friendly software tool has been developed to give the broader X-ray optic community access to automatic alignment of mirrors using an at-wavelength metrology technique based on a randomly shaped wavefront modulator. Through an intuitive graphical user interface, users can define and undertake calculations with minimal training because the software requires only the image file paths and a few parameters of the experimental setup as inputs. The example of mirror focusing demonstrates the value of the software as a fast tool to determine the optimum alignment of the mirror pitch angle and the location of the focal plane. It can also be used to produce a 2D image of the longitudinal aberrations of the mirror surface and to characterize the surface inhomogeneity and defects. The software is available to download together with a detailed user manual included in the distribution.24
The work was carried out with the support of Diamond Light Source Ltd. We wish to acknowledge Andrew Malandain and Ian Pape for technical support at beamtime mt16534-1 on B16. T.Z. wishes to thank Sebastien Berujon and Yogesh Kashyap for early development of the software, and Douglas M. Schwarz, E. M. C. Jones, Robert W. Gray, and Joseph M. Howard for sharing their MATLAB codes.