Abstract
Scanning X-ray nanodiffraction microscopy is a powerful technique for spatially resolving nanoscale structural morphologies by diffraction contrast. One of the critical challenges in experimental nanodiffraction data analysis is posed by the convergence angle of nanoscale focusing optics which creates simultaneous dependency of the far-field scattering data on three independent components of the local strain tensor—corresponding to dilation and two potential rigid body rotations of the unit cell. All three components are in principle resolvable through a spatially mapped sample tilt series; however, traditional data analysis is computationally expensive and prone to artifacts. In this study, we implement NanobeamNN, a convolutional neural network specifically tailored to the analysis of scanning probe X-ray microscopy data. NanobeamNN learns lattice strain and rotation angles from simulated diffraction of a focused X-ray nanobeam by an epitaxial thin film and can directly make reasonable predictions on experimental data without the need for additional fine-tuning. We demonstrate that this approach represents a significant advancement in computational speed over conventional methods, as well as a potential improvement in accuracy over the current standard.
Similar content being viewed by others
Introduction
Scanning X-ray nanoprobe diffraction microscopy (SXDM) is a synchrotron radiation-based technique widely used to image the local distribution of nanoscale structural heterogeneities in materials. In particular, this non-destructive imaging method has provided numerous insights into the structure-property relationships of battery nanoparticles1,2,3, Mott insulators4,5, and ferroelectric materials6,7, among others, in a variety of sample environments or under operating conditions. This mode of imaging spatially resolves features down to 25 nm directly by diffraction contrast, thus bypassing the need for image reconstruction by solving the phase retrieval problem.
SXDM is performed by scanning a focused X-ray nanobeam across a sample and recording diffraction intensity on an area detector as a function of real space and reciprocal space coordinates, similar to 4D scanning transmission electron microscopy8. Images at a fixed Bragg angle can be collected rapidly, making the technique ideal for in-situ and operando measurements. Yet, real-time experimental feedback is limited to quantities in the detector frame, such as the total intensity and intensity centroids in pre-defined regions of interest (ROIs), rather than more directly relevant physical parameters in terms of the crystalline lattice. Specifically, lattice parameter changes cannot be disentangled from the lattice rotation in the scattering plane, as both affect the intensity distribution in the horizontal direction on the detector. Conversely, by rocking the crystal in Bragg diffraction geometry, 3D reciprocal space maps are measured at each real space coordinate. These maps are used to solve for the local lattice strain, rotation (tilt) of the reciprocal lattice vector within and out of the scattering plane9. Nevertheless, conventional rocking curve analysis requires extensive data collection time and careful image registration of multiple scans using a diffraction-invariant signal, which lends to often imprecise extractions of lattice information and a long feedback loop for informing subsequent measurements.
Recent developments in deep learning methods to analyze increasingly large imaging data have demonstrated great improvements in speed over conventional often computationally intensive methods. Broadly, applications requiring image reconstruction under noisy or sparse data conditions, such as medical imaging10,11 and electron microscopy12,13, benefit from the relative robustness against noise of machine learning approaches. With regards to coherent imaging techniques, these deep convolutional neural networks (CNNs) have been adapted to X-ray Bragg coherent diffractive imaging14,15,16,17,18 and X-ray ptychography19,20, often with physically-aware training methods or architectures. Thus far, these implementations have focused largely on alternatives to phase retrieval for image reconstruction. While artificial intelligence-driven faster data analysis can also enable autonomous X-ray microscopy21,22, real-time analysis and feature recognition remains limited by incomplete diffraction contrast resolution.
In this study, we demonstrate a machine learning workflow that accurately identifies crystal lattice information from single-angle SXDM at speeds relevant to real-time analysis during an experiment. We introduce NanobeamNN, a light-weight CNN model that inputs images of Bragg diffraction intensity and outputs lattice strain and rotations. Our model is trained on simulated diffraction data from a highly crystalline epitaxial thin film that combines physical principles with the atypical shape of the convergent focused X-ray probe. The simulations require only knowledge of the beam, detector, and bulk crystal parameters. The X-ray energy, zone plate, and detector position are monitored instrument values, and the bulk sample can be characterized without the use of a synchrotron. This approach reduces the number of experimental measurements necessary to accurately understand local structural variations compared to conventional methods by enabling structural evaluation from 2D reciprocal space maps. We demonstrate that the neural network trained solely on simulated data can make predictions on experimental data that closely match and likely outperform state-of-the-art analysis. Additionally, the versatility of this framework and low computational requirements for training are potentially applicable to numerous systems of interest to the fields of materials science, solid-state physics, and chemistry.
Results
Model approach
The design of NanobeamNN uses a physics-aware simulated training dataset to target predictions of lattice strain and orientation. In the context of SXDM, which is primarily used to show contrast in structural morphology across a spatial region, one of the challenges of extracting the underlying crystal lattice information from reciprocal space lies in interpreting the effects of the focusing optics on the measured diffraction intensity. Hard X-ray scanning nanoprobes for dark-field microscopy typically use one of three types of focusing optics23: Kirkpatrick-Baez mirrors24,25, a multilayer Laue lens26,27, or a Fresnel zone plate27,28. Here, we consider only the case of the zone plate, which focuses the beam diffractively, but we note that the approach can be applied to each. As shown in Fig. 1a, the beam incident on the sample has a hollowed conical shape from the zone plate and central beam stop. An order sorting aperture selects only the first order of the diffractively focused beam, which is raster-scanned across the sample placed at the focal length. When in Bragg condition, highly ordered single crystal samples act as a mirror for the X-ray beam, reflecting the convergent beam shaped by focusing optics onto the pixel array detector. In such cases, the traditional analysis method of tracking shifts in intensity distribution is inherently limited because it does not consider the nature of the angular divergence of the diffracted beam and the intensity blocked by the central beam stop29.
Schematic illustration of experimental setup and neural network architecture. (a) Configuration of an archetypal scanning X-ray nanoprobe diffraction microscopy experiment in Bragg geometry. The hollowed cone on the left represents the X-ray beam focused onto the sample using zone plate optics. The diffracted intensity is measured on a 2D pixel array detector. (b) Diagram of the layers in the neural network (box dimensions not drawn to scale). Inputs are simulated diffraction patterns and outputs are strain and lattice rotation values.
To incorporate the shape of the probe beam into the analysis, we first simulate diffraction of the X-ray nanoprobe by an epitaxially grown thin film. Specifically, we take a 2D projection of the Laue oscillations in the 3D reciprocal space construction (Methods, Simulated data generation) with added Poisson noise. The simulated diffraction patterns span a representative range of potential expected values for lattice strain \(\upepsilon\), tilt in-plane \(\upomega\), and tilt out-of-plane \(\upchi\), labeled following four- circle diffractometer notation. By visualizing the effects of varying these parameters on the resulting diffraction patterns (Supplementary Information, Fig. S1), it becomes apparent that strain changes the intensity distribution within the reflection of the beam (donut-shaped reflection), while lattice rotations change the position of the reflection. This understanding of measurable changes in the diffraction images informs our decision to choose a CNN architecture for NanobeamNN, which quantifies structural inhomogeneities in thin films measured by SXDM.
Performance on simulated data
Figure 1b illustrates the composition of NanobeamNN, which is similar in structure to other CNNs18,30. Inputs are images of diffraction patterns, and outputs are predicted values that describe the crystal lattice. An activation function follows each convolutional layer, and a maximum pooling layer follows every other convolution, with one final fully connected layer. We label the simulated training data with known ground truth values used to generate the images, and NanobeamNN regressively learns to predict those parameters. Figure 2a shows the comparison between the diffraction patterns simulated with input parameters (strain, tilts) and the simulated diffraction generated by the strain and tilts predicted by NanobeamNN. The intensity distribution within the zone plate image (strain) and the position of the zone plate image within the detector frame (tilt) are correctly learned. The statistics of the network predictions for each parameter are detailed in the Supplementary Information, Figure S2. As shown in Fig. 2b, the predicted diffraction closely resembles the experimentally measured data reported on SrIrO3 thin films previously31, particularly the position of the beam within the frame and the center of the intensity in the beam. This indicates that NanobeamNN correctly identifies the changes in diffraction corresponding to changes in the crystal lattice and demonstrates the versatility of the workflow.
NanobeamNN predictions on simulated and experimental data. (a) Top row: simulated diffraction patterns directly input to NanobeamNN. Bottom row: simulated diffraction generated from the values of strain \(\upepsilon\) and tilts \(\upomega\) and \(\upchi\), predicted by NanobeamNN from the images in the top row. (b) Top row: experimentally measured diffraction patterns of the pseudo-cubic (pc) 002pc peak of an SrIrO3 thin film. Bottom row: simulated diffraction generated from predicted \(\upepsilon\), \(\upomega\), and \(\upchi\), from the images in the top row.
The simulated images are scaled to a maximum of seven counts per pixel before the addition of noise (Poisson distribution) to match the signal level of the experimentally measured diffraction (Fig. 2b). To determine the effects of intensity level (and by association, signal-to-noise ratio) on model predictions, we evaluate the performance of networks trained on noise-free simulated data from 10 to 10,000 counts on noisy data of various intensity levels scaled to the training counts (Fig. S3). Removing noise from the training process solely for this test allows us to separate the effects of noise and count level; generally, it is preferable to include noise during training for more accurate predictions as noise forces the model to generalize better to unseen data. We find that a model trained on maximum diffraction intensity on the order of 10 photons per frame makes sufficiently accurate predictions on higher intensity data that is scaled to this range. Conversely, a model trained at higher counts would not be able to do the same for data taken at lower counts because a model that learned from a data distribution with high signal-to-noise ratio would not generalize to data with lower signal-to-noise ratio. Thus, it is advisable to collect experimental data on the order of 10 counts or more per diffraction pattern.
Subsequently, to test the model’s performance in an imaging capacity, we simulate spatially distributed features similar to those that might be present in a sample. Figure 3 provides a comparison of NanobeamNN and conventional analysis methods on diffraction patterns where the ground truth values of lattice information are known, establishing a baseline for benchmarking the methods before comparing them on experimental data. Figure 3a shows a 2D sinusoidal wave in strain and 2D sigmoidal functions in lattice rotations, which imitate experimentally observed domains and film lattice tilt due to substrate step edges, respectively. Accordingly, to discuss the comparison of NanobeamNN predictions (Fig. 3c) with the results from current analysis methods (Fig. 3b), we first introduce some underlying principles of conventional SXDM analysis and the relevant experimental constraints.
Feature extraction from simulated scanning X-ray nanoprobe diffraction microscopy measurement by conventional fitting and NanobeamNN. (a) Simulated spatial distribution of strains \(\upepsilon \left(\text{x},\text{y}\right)\) and tilts \(\upomega \left(\text{x},\text{y}\right)\), and \(\upchi \left(\text{x},\text{y}\right)\), which mimic spatially distributed features present in a scanning X-ray nanoprobe diffraction microscopy measurement, where there is one diffraction pattern for each unique pixel coordinate. (b) \(\upepsilon \left(\text{x},\text{y}\right)\), \(\upomega \left(\text{x},\text{y}\right)\), and \(\upchi \left(\text{x},\text{y}\right)\), as analyzed by conventional fitting of the correlation between measured and simulated diffraction. (c) \(\upepsilon \left(\text{x},\text{y}\right)\), \(\upomega \left(\text{x},\text{y}\right)\), and \(\upchi (\text{x},\text{ y})\), predicted by NanobeamNN.
Somewhat intuitively, the only way to determine both the magnitude and direction of the momentum transfer vector Q in three dimensions is to measure scattering signal in a volume of reciprocal space32. Nonetheless, this measurement becomes less precise with a convergent beam due to the gradation in angles of the probe upon the sample and the blocking of the direct beam by the central stop. In a disordered sample, the hollowed ring of the zone plate optics would not be discernable in the measured diffraction33,34, and thus, the spread of scattered signal has no distinguishable correlation with the divergence angle of the beam. In such cases, one could track the shift in intensity distribution across multiple projections throughout the diffraction peak to establish trends in the local lattice heterogeneity1,5. In a highly crystalline sample, however, the reflection of the nanobeam is clearly visible7,35 and the sample is more constrained (i.e. mechanically, such as in the case of a coherently strained epitaxial thin film on a single crystal substrate). It is precisely this highly crystalline constraint that allows us to model physically probably changes in the sample and their effects on 2D diffraction. The physics-aware simulation approach to training NanobeamNN circumvents the need to measure 3D reciprocal space maps (a slow process by scanning probe) and improves structural analysis by correcting for the shape of the beam.
Currently, this type of simulation is employed to infer strain and lattice rotation information without a full measurement of the 3D diffraction peak by comparing each measured diffraction pattern with the simulated diffraction library in a grid search and fitting a weighted sum (interpolated center of mass) to find the highest correlation between measurement and simulation36. As shown in Fig. 3b, we apply this method to fit simulated diffraction patterns generated using the values of the artificial sinusoidal and sigmoidal microscope images in Fig. 3a. Even by fitting the correlation of simulated diffraction with our pre-generated library of training images that more than span the full range of strains and tilts represented, we are not able to fully separate features in strain and in-plane rotation. Furthermore, this method globally overestimates the magnitude of strain and can either over- or underestimate the in-plane rotation depending on the convoluting strain features. In comparison, NanobeamNN accurately resolves the feature trends in all parameters (Fig. 3c), more accurately predicts the magnitude of strain, and demonstrates a significant improvement in analysis time (see Discussion). Critically, the deconvolution of strain from in-plane lattice rotation means that NanobeamNN is less reliant on precise knowledge of the incident X-ray angle than conventional methods. While the simulated data generation process used in both methods can correct for deviations from the Bragg angle on the order of 0.1 degrees, NanobeamNN predictions of the in-plane lattice rotation (globally indicative of the incident beam angle) are precise to the order of 0.0025 degrees.
While the ground truth out-of-plane lattice rotation (Fig. 3a, right) is a smooth sigmoidal function, the results of both the correlation fitting method (Fig. 3b) and NanobeamNN predictions (Fig. 3c) show some discretization. These steps represent a quantification of the instrument resolution (resolution parameter \(\uptau\), defined in Methods, Simulated data generation) under this simulated experimental condition, which is influenced by the detector distance and pixel size, the X-ray energy, and the upsampling of the reciprocal space construction. We note that upsampling, a common technique in image processing, is used in simulation to improve the resolution of sub-pixel changes at the cost of computation time. The images are correspondingly downsampled to match the physical detector resolution at the final step of the simulation. The prediction values at which the steps in out-of-plane rotation occur correspond to the points at which the diffraction patterns shift by one pixel. The effects of the discrete detector pixels are not as pronounced for in-plane lattice rotation because the effects of strain and in-plane tilt on the intensity distribution in the horizontal direction on the detector are more nuanced.
Performance on experimental data
Although we demonstrate that NanobeamNN has the potential to provide more accurate quantification of lattice structure than conventional SXDM analysis methods through simulation, there remains a need for application to experimental data. Figure 4 shows a direct comparison between the analysis of an SXDM measurement by experiment-simulation correlation fitting (top row) and NanobeamNN (bottom row). The NanobeamNN results are the average predictions of ten models trained separately with different randomized model initializations and Poisson noise conditions. All models exhibit consistent metrics during training and validation, as well as consistent predictions on experimental data (Fig. S4), demonstrating robustness against noise. While we cannot comment definitively on which, if either, method is correct, we illustrate that the extracted feature maps are highly correlated (in particular, the strain maps have a Pearson correlation coefficient of ~ 0.89). Notably, the strain predictions by NanobeamNN are smaller in magnitude than those found via fitting, which aligns with the trend from simulated data shown in Fig. 3. The relative improvement in SXDM data analysis of NanobeamNN is evident in consistency across both simulated and experimental data.
Comparison of conventional fitting and NanobeamNN on experimental data. (a) Diffraction contrast features of the SrIrO3 002pc peak measured by scanning X-ray nanoprobe diffraction microscopy as analyzed by conventional fitting of the correlation between measured and simulated diffraction. (b) NanobeamNN evaluations of the experimental data shown in (a).
Discussion
The NanobeamNN workflow significantly reduces the computational time needed to extract structural parameters from SXDM data. The experimental map shown in Fig. 4 has 165 × 165 points; calculating the correlation matrix for and fitting three parameters from 64 × 64 pixel diffraction patterns takes approximately 10 h using close to 1 TB of RAM for just one scan. To be precise, on CPU, the fitting time for one diffraction pattern is 1034 ± 19 ms. The total computation time scales linearly with the number of data points and depends on the amount of available memory. Conversely, NanobeamNN makes predictions on the same data within seconds, at a rate of 0.072 ± 0.002 ms per image, which is a factor of over 14,000 improvement. On GPU, NanobeamNN performs inference on data approximately 70 times faster than the conventional method (SI, Table 1). Moreover, once the neural network is trained, it can directly make predictions on any measurement carried out at the same X-ray energy, Bragg condition, film thickness, and detector parameters, without the need for adjustments, further reducing computational costs across multiple SXDM scans. We note that although generation of the expansive simulated dataset is somewhat computationally costly (see Methods, Simulated data generation), it is highly parallelizable and completed before an experiment, as well as being a necessary component of both the conventional correlation fitting analysis and NanobeamNN training. The time required to train the neural network and make predictions will vary depending on one’s machine; however, the network is small enough to be trained on a personal computer without the use of GPUs in a reasonable timeframe (see Methods, Neural network architecture and training).
With further development, NanobeamNN can be adapted for real-time analysis of lattice heterogeneity and generalizability to more tunable instrument conditions, such as consideration of X-ray energy in resonant diffraction experiments. This implementation is designed to be trained once for each SXDM experiment and requires that the count rate be held at the same order of magnitude as that used in the training data for the duration of the experiment. Notably, due to the physical basis of Laue oscillations for the scattering model, these analyses (both correlation fitting and NanobeamNN) methods are limited to films of exceptional quality in which these oscillations can be observed. Consequently, we estimate that the optimal thickness range is between approximately 5 nm and 300 nm (depending on the photon energy), with loss of strain (intensity distribution throughout the zone plate reflection) resolution approaching the lower bound and loss of thickness fringe resolution approaching the upper bound. The exact constraints will also depend on the detector pixel size in reciprocal space parameter \(\tau\) (Methods, Simulated data generation). In this work, NanobeamNN gives accurate predictions for films within approximately 10% of the true thickness value of 12 nm (Fig. S5). For cases in which the film thickness is not known prior to the experiment, the training dataset may be expanded to span a range of thicknesses in addition to the existing parameters of strain and tilts. The prediction head of the neural network would therefore be correspondingly modified to include prediction of the film thickness. There is a tradeoff between depth of characterization and computational load, as additional parameter axes exponentially increase the computational time for generating training data. Despite these restrictions on the sample choice, we emphasize that many of the functional materials characterized by SXDM meet the criteria for NanobeamNN prediction.
In conclusion, NanobeamNN provides several critical improvements to SXDM data analysis. It significantly reduces the analysis time by using physical principles to model nanobeam diffraction, as well as increases the accuracy of lattice strain and orientation quantification over conventional methods in cases of highly crystalline epitaxial thin film samples. Current real-time experimental feedback consists of the total intensity within in a pre-defined ROI, as well as the shift in intensity distribution across detector coordinates (Fig. S6), which does not resolve lattice strain from in-plane rotation. NanobeamNN, with its physics-aware pre-training method using known instrument, bulk crystal, and Bragg diffraction conditions, enables quantification of the lattice structural morphology at a rate applicable to real-time analysis during experimental data acquisition with an edge computing device22.
Methods
Neural network architecture and training
The NanobeamNN model is a convolutional neural network that predicts crystalline lattice information from X-ray nanoprobe diffraction. As shown in Fig. 1b, the model trains only on inputs of simulated focused nanobeam diffraction patterns, and outputs values of strain and lattice rotation about two axes. We use a PyTorch implementation of 2D convolution layers and maximum pooling, followed by a fully connected layer, with a mean squared error (squared L2 norm) loss criterion to regressively learn these physically relevant parameters.
The training dataset of simulated diffraction patterns spans ranges of strain and lattice rotation values that cover structural heterogeneities potentially observed in experiments. As described in the section “Simulated data generation”, 2D diffraction of an X-ray nanobeam from a single crystal thin film was modeled using the physics principle of Laue oscillations. The entire simulated dataset consists of 68,921 images of 64 × 64 pixels each, which is randomly split into training (80%), validation (10%), and test (10%) sets. To ensure model robustness, we add representative noise to each image according to the Poisson distribution. The training cycle uses the adaptive moment estimation (ADAM) optimizer with a learning rate of 0.0001 to update the weights and biases of the model. Each epoch also includes a validation cycle to evaluate the performance of the network. The network trains on a single NVIDIA GeForce RTX 3090 GPU for 500 epochs, which takes ~ 40 min with a batch size of 64. Alternatively, the same training method takes ~ 80 min on CPU.
Simulated data generation
Diffraction of a zone plate optics focused X-ray nanoprobe (convergent beam) by a highly crystalline epitaxially grown thin film is modeled using geometric optics by taking a 2D projection of the Laue oscillations in the 3D reciprocal space construction from known bulk sample and instrument parameters. We generate simulated images of a sinc function convoluted with the position of the diffracted beam on the detector, given by the relative position and orientation of the crystal to the focusing optics and detector. The method is derived below.
Angles and detector geometry:
1. Define the incident beam angle for diffraction corresponding to the 00 \(l\) Bragg peak as \({\theta }_{B}\), where \(\lambda\) is the X-ray wavelength and \(c\) is the out-of-plane lattice constant, both in angstroms. The incident angle may be adjusted for off-Bragg measurements by the parameter \(\Delta \theta\) if necessary.
2. Define the exit beam angle.
3. Detector coordinate matrices \(X\) and \(Y\) are created as 2D meshes. Let \({X}_{0},{Y}_{0}\) denote the horizontal and vertical pixel numbers, respectively, indicating the beam position on the detector when \(2\theta =0\).
Reciprocal space construction
1. Each pixel on the detector is associated with an angular value of the exit beam.
Where \(p\) is the detector pixel size in meters and \(D\) is the sample-detector distance in meters.
2. Detector Q-space mapping: wavevector \(k=\frac{2\pi }{\lambda }\)
Zone plate coordinates
1. A second coordinate grid is defined for the incorporation of the zone plate effects.
2. The angular divergence in the diffracted beam created by the zone plate focusing optics is calculated as a shifting of the origin of reciprocal space, defined below.
3. Define a mask for the angular divergence according to the focal length \(f\) and the diameters of the zone plate and central beam stop, \({d}_{ZP}\) and \({d}_{CS}\), respectively.
Diffraction intensity function
We define the simulated intensity for a given lattice strain strain \(\epsilon =\frac{\Delta {d}_{00l}}{{d}_{00l}}\) in the [\(00l\)] direction, lattice rotation (tilt) angle in the scattering plane \(\omega\), and out of the scattering plane \(\chi\) at each detector pixel \((x,y)\) and zone plate reciprocal space coordinate \((u,v)\). The sinc function comes from the finite thickness \(t\)(truncated crystal) of the thin film and the rotation terms are given by the intersection of the Bragg peak in those directions with the Ewald sphere.
Where:
-
\(\epsilon \in \left\{-0.005,-0.00475,\dots , 0.005\right\}\)
-
\(\omega \in \{-0.05^\circ ,-0.0475^\circ ,\dots , 0.05^\circ \}\)
-
\(\chi \in \left\{-0.1^\circ ,-0.095^\circ ,\dots , 0.1^\circ \right\}\)
-
\(\text{sinc}\left(x\right)=\frac{\text{sin}(\pi x)}{\pi x}\)
-
\(\delta \left(x\right)=\left\{{\begin{array}{c}1, \left|x\right|<precision\\{0, otherwise}\end{array}}\right.\)
The detector pixel size in reciprocal space for any given experimental setup is given by the following parameter \(\uptau\):
We note that upsampling of the zone plate reciprocal space coordinates is used in simulation to improve the resolution of sub-pixel changes near edge features at the cost of computation time. The final detector images are downsampled to match the physical detector size.
Data acquisition
The experimental methods, including sample synthesis and scanning X-ray nano-probe data acquisition have been reported previously31. Synchrotron light sources have traditionally provided unique insight into condensed matter physics systems due both to their high penetrating power and the fundamental monochromaticity of the X-ray beam (typically 10-4 or greater at third generation sources, e.g. a 1 eV bandpass on a 10 keV beam). This gives the potential for studying complex phenomena within extended volumes at a strain resolution (dc/c ~ 10-4 = 0.01%) that is several orders of magnitude higher than achievable with conventional electron microscopy. Especially with the advent of diffraction limited storage rings, this sensitivity is now being harnessed for real-space imaging of crystalline ordering through nano-focusing optics; however, a key challenge in this methodology is the beam convergence angle introduced by the focusing optics which convolutes micro-radian level lattice curvatures with lattice strain in the far-field scattering pattern.
Experimental data analysis
Experimental data is used to test the performance of NanobeamNN against state-of-the-art conventional data analysis methods. A region of interest (ROI) of 128 × 128 detector pixels is selected to encompass the entire measured diffraction peak. The pixels of this ROI are binned by aggregating each 2 × 2 array into one value, for a final image size of 64 × 64 pixels, to improve the signal to noise ratio. Currently, the only method to infer strain and lattice rotation information without a full measurement of the 3D diffraction peak is by fitting a weighted sum (center of mass interpolation) to find the highest correlation between each diffraction pattern and each simulated diffraction condition.
Data availability
The simulated and experimental datasets that support the findings of this study are available using the https://doi.org/10.5281/zenodo.14990394.
Code availability
The code and trained model developed in this are available at this public GitHub repository: https://github.com/AdvancedPhotonSource/NanobeamNN.
References
Li, J. et al. Probing lattice defects in crystalline battery cathode using hard X-ray nanoprobe with data-driven modeling. Energy Storage Mater. 45, 647–655 (2022).
Judge, W. J. et al. Evaluation of chemical and structural homogeneity in single particles of Li 1–x Ni 0.33 Mn 0.33 Co 0.33 O 2. J. Phys. Chem. C 126, 16082–16089 (2022).
Liu, T. et al. Rational design of mechanically robust Ni-rich cathode materials via concentration gradient strategy. Nat. Commun. 12, 6024 (2021).
Shabalin, A. G. et al. Nanoscale imaging and control of volatile and non-volatile resistive switching in VO 2. Small 16, 2005439 (2020).
Singer, A. et al. Nonequilibrium phase precursors during a photoexcited insulator-to-metal transition in V 2 O 3. Phys. Rev. Lett. 120, 207601 (2018).
Lummen, T. T. A. et al. Thermotropic phase boundaries in classic ferroelectrics. Nat. Commun. 5, 3172 (2014).
Guzelturk, B. et al. Sub-nanosecond reconfiguration of ferroelectric domains in bismuth ferrite. Adv. Mater. 35, 2306029 (2023).
Ophus, C. Four-dimensional scanning transmission electron microscopy (4D-STEM): from scanning nanodiffraction to ptychography and beyond. Microsc. Microanal. 25, 563–582 (2019).
Holt, M., Harder, R., Winarski, R. & Rose, V. Nanoscale hard X-Ray microscopy methods for materials studies. Annu. Rev. Mater. Res. 43, 183–211 (2013).
Zhu, B., Liu, J. Z., Cauley, S. F., Rosen, B. R. & Rosen, M. S. Image reconstruction by domain-transform manifold learning. Nature 555, 487–492 (2018).
Musleh, A. Computed tomography (Ct) scan assisted machine learning in the management of artifacts related to paranasal sinuses and anterior cranial fossa. Comput. Intell. Neurosci. 2022, 1–9 (2022).
Zhou, T., Cherukara, M. & Phatak, C. differential programming enabled functional imaging with lorentz transmission electron microscopy. Npj Comput. Mater. 7, 141 (2021).
Ziatdinov, M., Ghosh, A., Wong, C. Y. & Kalinin, S. V. AtomAI framework for deep learning analysis of image and spectroscopy data in electron and scanning probe microscopy. Nat. Mach. Intell. 4, 1101–1112 (2022).
Cherukara, M. J., Nashed, Y. S. G. & Harder, R. J. Real-time coherent diffraction inversion using deep generative networks. Sci. Rep. 8, 16520 (2018).
Wu, L., Juhas, P., Yoo, S. & Robinson, I. Complex imaging of phase domains by deep neural networks. IUCrJ 8, 12–21 (2021).
Lim, B. et al. A convolutional neural network for defect classification in bragg coherent X-ray diffraction. Npj Comput. Mater. 7, 115 (2021).
Chan, H. et al. Rapid 3D nanoscale coherent imaging via physics-aware deep learning. Appl. Phys. Rev. 8, 021407 (2021).
Yao, Y. et al. AutoPhaseNN: Unsupervised physics-aware deep learning of 3D nanoscale Bragg coherent diffraction imaging. Npj Comput. Mater. 8, 124 (2022).
Cherukara, M. J. et al. AI-enabled high-resolution scanning coherent diffraction imaging. Appl. Phys. Lett. 117, 044103 (2020).
Hoidn, O., Mishra, A. A. & Mehta, A. Physics constrained unsupervised deep learning for rapid, high resolution scanning coherent diffraction reconstruction. Sci. Rep. 13, 22789 (2023).
Kandel, S. et al. Demonstration of an AI-driven workflow for autonomous high-resolution scanning microscopy. Nat. Commun. 14, 5501 (2023).
Babu, A. V. et al. Deep learning at the edge enables real-time streaming ptychographic imaging. Nat. Commun. 14, 7059 (2023).
Sakdinawat, A. & Attwood, D. Nanoscale X-ray imaging. Nat. Photonics 4, 840–848 (2010).
Mimura, H. et al. Hard X-ray diffraction-limited nanofocusing with kirkpatrick-baez mirrors. Jpn. J. Appl. Phys. 44, L539 (2005).
Osterhoff, M. et al. Focus characterization of the NanoMAX Kirkpatrick-Baez mirror system. J. Synchrotron Radiat. 26, 1173–1180 (2019).
Kang, H. C. et al. Focusing of hard x-rays to 16 nanometers with a multilayer Laue lens. Appl. Phys. Lett. 92, 221114 (2008).
Nazaretski, E. et al. Design and performance of an X-ray scanning microscope at the hard X-ray nanoprobe beamline of NSLS-II. J. Synchrotron Radiat. 24, 1113–1119 (2017).
Winarski, R. P. et al. A hard X-ray nanoprobe beamline for nanoscale microscopy. J. Synchrotron Radiat. 19, 1056–1060 (2012).
Ying, A. et al. Modeling of kinematic diffraction from a thin silicon film illuminated by a coherent, focused X-ray nanobeam. J. Appl. Crystallogr. 43, 587–595 (2010).
Simonyan, K. & Zisserman, A. Very Deep Convolutional Networks for Large-Scale Image Recognition. https://doi.org/10.48550/ARXIV.1409.1556 (2014).
Luo, A. et al. X-ray nano-imaging of defects in thin film catalysts via cluster analysis. Appl. Phys. Lett. 121, 153904 (2022).
Warren, B. E. X-Ray diffraction (Dover Publications Inc, 1990).
Chen, Y. et al. Seeded lateral solid-phase crystallization of the perovskite oxide SrTiO 3. J. Phys. Chem. C 123, 7447–7456 (2019).
Calvo-Almazan, I. et al. Strain mapping of CdTe grains in photovoltaic devices. IEEE J. Photovolt. 9, 1790–1799 (2019).
Li, X., Luo, Y., Holt, M. V., Cai, Z. & Fenning, D. P. Residual nanoscale strain in cesium lead bromide perovskite reduces stability and shifts local luminescence. Chem. Mater. 31, 2778–2785 (2019).
Roy, P. et al. Origin of topological hall-like feature in epitaxial SrRuO 3 thin films. Adv. Electron. Mater. 9, 2300020 (2023).
Acknowledgements
This material is based upon work supported by the U.S. Department of Energy, Office of Science, Office of Workforce Development for Teachers and Scientists, Office of Science Graduate Student Research (SCGSR) program. The SCGSR program is administered by the Oak Ridge Institute for Science and Education for the DOE under contract number DE‐SC0014664. A.S. acknowledges the support by the U.S. Department of Energy, Office of Science, Office of Basic Energy Sciences (Contract No. DE-SC0019414). M.J.C also acknowledge support from the U.S. Department of Energy, Office of Science, Office of Basic Energy Sciences Data, Artificial Intelligence, and Machine Learning at DOE Scientific User Facilities program under Award Number 34532. Work performed at the Center for Nanoscale Materials and Advanced Photon Source, both U.S. Department of Energy Office of Science User Facilities, was supported by the U.S. DOE, Office of Basic Energy Sciences, under Contract No. DE-AC02-06CH11357.
Author information
Authors and Affiliations
Contributions
A.L. adapted the simulations to experimental conditions, built the neural network model, and performed network training and testing, with advice from T.Z., A.S., and M.J.C. T.Z. and M.V.H. developed the simulation and correlation fitting method. A.L., T.Z. A.S., and M.J.C. contributed the proposal of the initial idea and the manuscript writing.
Corresponding authors
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary Information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Luo, A., Zhou, T., Holt, M.V. et al. Deep learning of structural morphology imaged by scanning X-ray diffraction microscopy. Sci Rep 15, 21736 (2025). https://doi.org/10.1038/s41598-025-97183-0
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-025-97183-0