 Research
 Open Access
 Published:
mpfit: a robust method for fitting atomic resolution images with multiple Gaussian peaks
Advanced Structural and Chemical Imaging volume 6, Article number: 1 (2020)
Abstract
The standard technique for subpixel estimation of atom positions from atomic resolution scanning transmission electron microscopy images relies on fitting intensity maxima or minima with a twodimensional Gaussian function. While this is a widespread method of measurement, it can be error prone in images with nonzero aberrations, strong intensity differences between adjacent atoms or in situations where the neighboring atom positions approach the resolution limit of the microscope. Here we demonstrate mpfit, an atom finding algorithm that iteratively calculates a series of overlapping twodimensional Gaussian functions to fit the experimental dataset and then subsequently uses a subset of the calculated Gaussian functions to perform subpixel refinement of atom positions. Based on both simulated and experimental datasets presented in this work, this approach gives lower errors when compared to the commonly used single Gaussian peak fitting approach and demonstrates increased robustness over a wider range of experimental conditions.
Introduction
The development of spherical aberrationcorrection for scanning transmission electron microscopy (STEM) imaging has been one of the biggest triumphs of electron microscopy over the past several decades, allowing the subångström resolution imaging of crystal structures [1,2,3]. Several pioneering STEM experiments have demonstrated the feasibility of this technique for the direct visualization of atom positions from aberrationcorrected STEM images and has proved itself an invaluable tool for subångström resolution structural measurements [4,5,6,7,8]. While the typical aberrationcorrected STEM electron beam has a probe diameter approximately between 0.5 and 1 Å, supersampling scanning positions below the Nyquist–Shannon sampling limit and the subsequent fitting of the probe image with a twodimensional Gaussian function allows the subpixel precision assignment of atom column positions from aberrationcorrected STEM datasets [5, 9,10,11,12,13,14]. This technique has been used for quantitative atomic displacement measurements across thin films, 2D crystals, domain boundaries and has allowed the experimental observation of novel structural phenomena such as polar vortices [15,16,17,18,19,20].
While the Gaussian function fitting approach is an extraordinarily powerful technique, one noted shortcoming is that it assumes wellseparated atoms with no overlap, or negligible aberrations in the beam itself—conditions that are only available under a certain limited set of imaging conditions [16, 17]. Typically, such an imaging setup uses a ring shaped annular detector with the outer and inner detector collection circles centered along the microscope optic axis. Such a configuration will have an inner collection angle of approximately 85–90 mrad to capture only the incoherently scattered electrons, and is conventionally referred to as high angle annular dark field STEM (HAADFSTEM) imaging [5, 21]. This mode of imaging is referred to as dark field imaging since atom columns themselves are bright due to electrons preferentially scattering from atomic nuclei as a consequence of Rutherford scattering from proton–electron Coulombic forces [22, 23]. Since this Coulombic force experienced by the electron probe is directly proportional to the number of protons in the nucleus (Z), atom column images in HAADFSTEM datasets generate peaks with an almost linear relationship of intensity \(\mathrm {\left( \propto Z^2 \right) }\) with the atomic number and is also referred to as Zcontrast imaging [24,25,26].
Zcontrast imaging, however, is generally considered unsuitable for imaging lighter elements such as oxygen, boron or carbon [19,20,21]. However, structural metrology for many scientifically important material systems such as ferroelectrics needs the imaging and quantification of lighter atoms as well as heavier elements [27, 28]. This problem can be significantly mitigated in bright field STEM (BFSTEM) imaging, where rather than annular detectors a circular detector is used with the detector center coinciding with the optic axis of the microscope [19, 29]. The conventional collection angle ranges in BFSTEM imaging extend up to 15 mrad, significantly lower than even the inner collection angle for HAADFSTEM [29]. Because unscattered electron beams are imaged by this technique, in contrast to HAADFSTEM vacuum is bright, while the atom positions have comparatively lower intensity. The ideal BFSTEM image would thus have an intensity profile complementary to the images obtained from HAADFSTEM imaging. However, in reality owing to the lower collection angles, atom positions are more blurred from aberrations that are more prominent in BFSTEM images [30]. Additionally, since BFSTEM images capture both light and heavy atom positions the interatomic distances are substantially smaller. These effects result in atom positions that are nonGaussian in shape, and often have intensity overlaps and tails coming from their neighbors making position metrology challenging in BFSTEM images.
Methods
Fitting atom positions with Gaussians
The best modern aberrationcorrected microscopes can generate electron probes that are free of aberrations up to 30 mrad, which corresponds to beam diameters that are of the order of 0.5 Å, or 50 pm at 200 kV [8, 10]. Supersampling the beam by a factor of five results in scan positions that are spaced approximately 10 pm apart from each other. For HAADFSTEM images where oxygen atoms are not observed, interatomic distances from the low index zones are mostly of the order of 1.5 Å, allowing enough distance between atoms so that they are well separated and thus an atom position can be reasonably approximated with a twodimensional Gaussian intensity profile. Since the FWHM of this Gaussian is around 50–75 pm, this allows the determination of the peak of the Gaussian intensity distribution with accuracies approaching 0.5 pm [14, 17]. It is this combination of aberrationcorrected imaging and Gaussian peak fitting that has enabled modern electron microscopy to reliably measure domain walls, grain boundaries, defects, and strain with single picometer precision, making STEM imaging so powerful.
However, this approach runs into problems when applied to BFSTEM imaging. In Fig. 1a, we show a typical BFSTEM image of \({\text {LiNbO}}_{3}\) with 4.9 pm scanning pixel sizes. The darker regions in the image are the niobium and oxygen atom columns with the red dots corresponding to the intensity minima. While the intensity minima can be used as an initial estimate of atom positions, the error in such a measurement is at least of the order of the pixel size, which is 5 pm in our case. This makes the error of measurement in BFSTEM an order of magnitude worse than the best HAADFSTEM results. Figure 1b demonstrates the same section of the BFSTEM image with the refined atom positions obtained from fitting the intensity distribution with a single Gaussian peak with green dots next to the intensity minima (red dots). A visual estimation shows that the fitted Gaussians do not reliably converge on the atom positions, and are often tens of picometers away when the intensity minima is weak, and the neighboring atom is close. In some cases, the refined atom position is in the middle of the two neighboring atom columns with no definite atomic intensity.
This can be quantitatively demonstrated by profiling the summed intensity distribution (Fig. 1c) from the region shown along the white arrows in Fig. 1a, b. The red arrows in Fig. 1c correspond to the intensity minima, while the green arrows correspond to the Gaussian refined atom positions. The presence of an intense neighboring atom’s intensity tail gives rise to a dip in the intensity away from the original minima, right in the middle of two atom columns and the Gaussian peak fitting technique converges to that local minima rather than the original position. Previous BFSTEM imaging has attempted in circumventing such issues by using a multiparameter Gaussian peak, or performing image metrology through multivariate statistics rather than fitting each individual atoms [19, 20]. Both approaches require an initial knowledge of the crystal structure being imaged. Multiparameter Gaussian fits need an estimation of the number and location of the nearest neighbors, and thus cannot be applied as a robust technique as it necessitates custom fitting equations for individual crystal structures. In particular, this restriction limits the application of this method where more than one crystal orientation may be present. Here, we propose a novel multiGaussian refinement routine—mpfit—that does not require prior knowledge of the crystal structures being imaged and can robustly refine a wider variety of images by deconvolution of a subsection of the image into multiple overlapping twodimensional Gaussians. Since HAADFSTEM image refinement requires less stringent conditions, our algorithm extends equally well to such systems too.
The mpfit algorithm
The Gaussian curve is a centrosymmetric curve with wide uses in single processing for approximating symmetric impulse functions [31, 32]. Moreover, it has been demonstrated that given a sufficiently large number of Gaussians, any noninfinite signal can be approximated as a sum of overlapping Gaussians [31, 32]. We use this insight and extend it into two dimensions by first modeling our observed atom intensity as a sum of overlapping Gaussians. The second key idea is to recognize that not all Gaussian functions that are approximating the region of interest are in fact originating from the atom whose position we are trying to refine. Thus the Gaussian functions are subsequently sorted and only a subset of them that approximate the atom position are used to refine the atom. The flowchart of our algorithm is illustrated in Fig. 2. The steps of the mpfit algorithm can be described as:
 1.
Get intensity minima/maxima The initial starting point of this algorithm is the calculation of intensity maxima for inverted contrast BFSTEM images or ADFSTEM images. This can be implemented through standard MATLAB or Python peak finding routines. However, in noisy images, sometimes a single atom may generate multiple maxima. To prevent this, if there are more than one maxima with the distance between the maxima smaller than the resolution of the microscope, the center of mass of this cluster of points is chosen as the starting reference point.
 2.
Calculate median interneighbor distance Following the identification of intensity minima, the median interpeak distance is calculated, which is rounded to the nearest integer, which we call \(\mathbf {\eta }\).
 3.
Get region of interest The region of interest is a square with the intensity minima as the central pixel, with the sides of the square given by \(\mathbf {s = 2\eta + 1}\), where s is the side of the square. Thus the \(\mathbf {\left( \eta + 1, \eta + 1 \right) }\) pixel in the square is the intensity minima that was the original starting point. Other regions of interest schemes, such as a Voronoi tessellation around the intensity minima actually demonstrate comparatively worse results (see Fig. 8 in Appendix).
 4.
Fit iteratively with Gaussians The region of interest is then fit by a single 2D Gaussian function with a user determined tolerance factor. The tolerance factor refers to the mean absolute difference in intensity between the fitted Gaussian and the original data. The fitted Gaussian function is then subtracted from the original region of interest, and the residual is subsequently fitted again. This process continues for a predetermined number of iterations, with the sum of all the Gaussians then subsequently representing the original region of interest. In the authors’ experience, the tolerance factor is less important than the number of iterative Gaussians used, with reasonable accuracy and speed being obtained with a tolerance of \(\mathrm {10^{12}}\) and 12 to 16 iterations for the mpfit examples presented in this text. We deal with the background intensity by normalizing each ROI cell from 0 to 1 before starting the estimation of the individual Gaussians.
 5
Sort peaks and get the refined position The Gaussian peaks are then subsequently sorted based on their distance from the original minima (step 1) with only those peak positions whose distances are less than \(\mathbf {\frac{\eta }{2}}\) from the minima/maxima (step 1) used for refinement. The refined atom position is then the weighted average peak position of all the Gaussians that lie within this selected region, with the peak amplitudes being the weights used.
Results and discussion
Results on simulated BFSTEM images
The efficiency and accuracy of the mpfit algorithm was tested on simulated BFSTEM images of \({\text {LiNbO}}_{3}\). The advantage of simulated data is that the accurate atom positions are already known and can be compared with mpfit results. This allows the estimation of the relative errors of the single Gaussian and the multiple Gaussian mpfit approaches, with the simulation parameters outlined in Table 1. Following the steps of the algorithm outlined in Fig. 2, the intensity minima were first calculated for the simulated image, with Fig. 3a demonstrating the simulated BFSTEM image of \({\text {LiNbO}}_{3}\) with the intensity minima overlaid as blue dots. These intensity minima are subsequently used to calculate the median nearest neighboring distance \(\mathbf {\left( \eta \right) }\) between the minima. Based on the calculated \(\mathbf {\eta }\) value, the region of interest for this image is demonstrated for one of the atoms as a red square in Fig. 3a. The region of interest for that atom is shown in Fig. 3b with the contrast inverted and the intensity minima for the atom in question overlaid as a blue dot. As could be ascertained from Fig. 3b, the intensity distribution from the bottom left atom partially overlaps with the atom position we are aiming to refine, precisely indicating the scenario where single peak Gaussian fitting approaches often give erroneous results.
Sixteen iteration steps were chosen to represent this section of the image, as per step four of the algorithm. The first 12 of these iteration steps and the evolution of the Gaussian summation are shown in Fig. 3c. The calculation of the Gaussian is performed by taking in the entire image, and calculating a twodimensional Gaussian peak with the smallest absolute difference with the initial region of interest. Multiple different Gaussian fitting approaches can be used, with the fitting equation used in this approach expanded in Eq. 1. As could be observed from Fig. 3c, the summation of the Gaussian peaks starts to approximate the region of interest within only a few iterations. This demonstrates that the iteration number chosen was sufficient enough to capture the complexities of the data being fitted. It is even more interesting to look at the result of the first iteration, which is mathematically equivalent to the single Gaussian peak fitting approach. As the first iteration in Fig. 3c shows, the single Gaussian peak fitting approach is a special case of the mpfit algorithm, where the number of iterations is one. According to this image, the first Gaussian peak does not exist near the center of the image, and is extracted towards the bottom left corner. The central peak related to the atomic column of interest is captured in the second iteration rather than the first, thus visually demonstrating why the single Gaussian approach fails in some cases.
While it may be possible to adjust the calculation of the region of interest to capture the atom position accurately, this approach necessitates tinkering with multiple different collection areas and a nonuniform solution for all the atoms in the image. mpfit on the other hand, removes the necessity for such complicated user modifications, allowing the estimation of all the Gaussian peaks that contribute to the final image. The individual peak positions are visually represented as a function of the iteration number in Fig. 3d where the radius of the spheres are scaled to the amplitude of the Gaussian calculated—with the X and Y position of the sphere referring to the location of the Gaussian peak. Only Gaussian peaks lying below a certain distance from the intensity minima (shown as the red circle in Fig. 3d) are used for the estimation of the refined position. As could be observed, the peak obtained from the the most intense Gaussian in green is actually assigned to the neighboring atom, and two other peaks are also assigned to two neighboring atoms, and only the subset of Gaussian peaks lying within the red circle are used for refinement. Summing all the Gaussian functions together we obtain Fig. 3e, which shows close fidelity to the input data (Fig. 3b).
Based on the final step of the algorithm, the Gaussian peaks are assigned either to neighboring atoms or the central atom depending upon the distance of the peak center from the initial intensity minima. As can be seen in Fig. 3e, the intensity minima is not always a reliable estimator of the actual atom position, but the mpfit algorithm converges extraordinarily close to the actual atom position (green and red dots overlapping), demonstrating its superiority. The representative summation of the Gaussian summation can thus be broken down into two components—the Gaussian peaks that were used for atom position refinement, the sum of which is visualized in Fig. 3f and the Gaussian peaks that were further off, and assigned as contributions of neighboring atom intensity—represented in Fig. 3g. Thus, the combination of the main atom and the neighboring contributions gives rise to the total intensity profile that was observed.
We further evaluated the accuracy of the mpfit algorithm for an entire image rather than a single atom. Figure 4 shows and compares the three different atom position metrology techniques—intensity minima/maxima, single Gaussian peak fitting and the mpfit algorithm with each other, respectively. Figure 4a demonstrates the intensity minima itself may not be coincident with the ideal atom positions due to minute intensity variations that are not accurately captured given a limited detector dynamic range, with the errors of the order of a single pixel. As a result, the intensity minima atom positions are clustered at several different clustering values, which can be understood based on the fact that results from the intensity minima are always on the order of a pixel. Thus compared to position refinement algorithms, just the minima itself is incapable of subpixel precision metrology. Figure 4b demonstrates the difference of the single peak approach from the ideal atom positions, with the results being clustered into three distinct clusters. This can be understood based on the fact that there are three separate types of intensity distributions in the simulated data. For wellseparated atoms, the single peak and the atom positions show close agreement, which generates the central cluster. However, there are also atom columns, where the neighboring atoms are either on the top left or the top right, giving rise to the two extra clusters—demonstrating the shortcomings of this approach when the intensity distributions of neighboring atoms approach the resolution limit of the electron microscope. The results from the mpfit algorithm, demonstrated in Fig. 4c, are on the other hand clustered in a region less than 0.5 pm across from the known atom positions—demonstrating it’s accuracy. However, in the authors’ experience, the mpfit technique fails to converge for the edge atoms, which shows up as atom positions that are not clustered and have a higher error. For the rest of the atoms in the image, however, mpfit is significantly superior to the other approaches.
Results on experimental BFSTEM images
Along with simulated datasets, we additionally performed position metrology on experimental BFSTEM images of \({\text {LiNbO}}_{3}\) viewed from the \({\left[ 1{\bar{1}}00 \right] }\) zone axis [15]. The results were obtained through STEM imaging in a spherical aberrationcorrected FEI \(\mathrm {Titan^3}\) transmission electron microscope, corrected for upto third order spherical aberrations. Imaging was performed at a camera length of 145 mm and the BFSTEM images were collected using Gatan detectors with an outer collection semiangle of 15 mrad, using scanning pixel step sizes of 9.8 pm.
In contrast to simulated datasets, the exact ideal atom positions are not known owing to specimen drift, thermal vibrations, signaltonoise ratio, and localized imperfections in the crystal lattice. Figure 5a demonstrates a region of interest in an experimental dataset, with the intensity reversed, with Fig. 5b showing a section of the image marked by the red box in Fig. 5a. The blue dot in Fig. 5b corresponds to the intensity minima, while the green dot represents the position calculated by the single Gaussian peak fitting approach. As can be visually ascertained, the calculated atom position does not correspond to the atom position, and thus is an inaccurate representation. Following step 4 of the algorithm, and similar to the procedure outlined in Fig. 3c, the region of interest is represented by a succession of closely spaced twodimensional Gaussian peaks over 16 iteration steps,with the contribution from the first 12 steps shown in Fig. 5c. The individual Gaussian peaks that contribute to the final representation of the region of interest are pictorially represented in Fig. 5d, with the radius of the circle corresponding to the amplitude of the Gaussian. Peaks that are further from the original intensity minima by more than twice the median interpeak distance (which is indicated by the red circle) are assigned to the neighboring atoms, and only peaks lying inside the red circle are used to calculate the refined atom position.
Figure 5b demonstrates the initial experimental data, while Fig. 5e demonstrates the final summation from the 16 Gaussian peaks with visual inspection revealing close correspondence between the experimental and represented data. Extending the number of iterations would allow progressively smaller Gaussian peaks resulting in better correspondence, but would also increase the demand for computational resources without a correspondingly significant increase in precision. The intensity minima are overlaid on the images in blue, with the results from the single peak fit approach in green and the mpfit results in yellow, respectively. Thus the mpfit algorithm accurately determines the atom location rather than converging to saddle points created from intensity tails from neighboring atoms. Figure 5f represents the sum of the Gaussians that represents the atom being refined and Fig. 5g represents the contribution from the intensity tails from the neighboring atoms, and is calculated from the Gaussian peaks represented with red borders in Fig. 5d.
Returning back to the original experimental BFSTEM image in Fig. 1a, we revisit that experimental data in Fig. 6a, comparing the results obtained with the mpfit approach. As could be visually ascertained, while the single peak fit approach fails in some of the cases, the mpfit approach reliably refines to the atom position, which can also be ascertained by the intensity profile demonstrated in Fig. 6b.
Comparisons with other algorithms
Several other specialized algorithms have been designed to quantify atom positions in electron microscope datasets, such as Atomap [33], StatSTEM [34] and oxygen octahedra picker [35]. The Atomap algorithm uses principal component analysis to obtain denoised STEM images and finds the center of mass based on the initial guess of local intensity maxima or minima. Using the center of mass as the starting estimate, it then subsequently approximates a twodimensional Gaussian to locate the estimated position of atoms. Atomap can additionally sort the different species of atom columns in the image and analyze them individually. StatSTEM on the other hand is a modelbased fitting algorithm for extraction of the atom position information from STEM images. StatSTEM models the atoms in the images as the superposition of twodimensional Gaussian peaks, and since this is a modelbased technique it requires prior knowledge of the crystal structure of the sample being imaged to give a better estimation of the initial guess. After obtaining the initial guess, the algorithm will go through iterations to reach the leastsquares estimation of fitting parameters, and then determines the position. oxygen octahedra picker is a software specialized in identifying the octahedra rotations in the \({\text {ABO}}_{3}\) perovskite oxides. It sorts out the oxygen and B atom positions and provides users the option of selecting a fast center of mass estimation or a slower peak fitting with twodimensional gaussians. It exhibits an impressive accuracy of as small as 3 pm in simulated HAADF images. However, the existing methods still possess limitations in practical cases—with neither the oxygen octahedra picker and the Atomap software being able to process STEM images where atomic columns being measured will have intensity contributions from their neighbors. Thus both these approaches work well for wellseparated atom columns in HAADF images, but face accuracy penalties with BFSTEM images. While StatSTEM’s modelbased algorithm is able to solve the overlapping issue by assuming atom columns as overlapping 2D Gaussian peaks, its iterative model fitting process is computationally intensive, and requires prior knowledge of the crystal structure being imaged. As demonstrated in Fig. 7a, visually there is almost no difference between the fitting results of StatSTEM versus mpfit, with StatSTEM’s results being slightly offcentered from mpfit’s estimation. Comparison of the results in Fig. 7b demonstrates that both technique give results that are less than a pixel apart from each other, with mpfit outperforming StatSTEM. The standard deviation \(\mathrm {\left( \sigma \right) }\) of mpfit’s estimation from known atom positions is 1.49 pm compared to a \(\mathrm {\sigma }\) of 3.31 pm from StatSTEM.
Conclusions
While it may be possible to assume from the results presented here that the single Gaussian peak fitting approach fails to converge to atom solutions and gives erroneous results, it actually performs perfectly adequately for the majority of STEM experiments. However, for certain nonideal imaging conditions, the single Gaussian peak fitting approach fails, while mpfit accurately obtains precise atom positions. For wellseparated atoms, the results from mpfit and a single Gaussian refinement are in fact identical. Additionally, it has to be kept in mind, that even with parallelization implemented, the mpfit algorithm solves for over ten Gaussian peaks in a batch process. On the other hand, the single Gaussian approach solves for just one peak, thus making the single Gaussian approach faster by at around an order of magnitude.
Future planned improvements include solving for neighboring peaks simultaneously using the tail functions to deconvolve the full obtained image as an independent set of impulse functions originating from individual atoms. Additionally, atom columns whose separation distances are below the resolution limit of the microscope may be particularly suited for this approach, by the deconvolution of the observed impulse function into two closely separated Gaussians and enabling the superresolution metrology of atom positions from STEM datasets.
Thus, our results demonstrate that the mpfit algorithm can reliably and robustly refine the subpixel precision of atoms even without a priori knowledge of the underlying crystal structure. Additionally, since the single Gaussian approach is a special case of the mpfit approach with the total number of iterations as one, this approach will also work for ADFSTEM images, enabling a single approach to the metrology of a wide variety of STEM data. The results are superior to existing algorithms, and exceeds the state of the art—StatSTEM in accuracy, with the added advantage of being agnostic to the crystal structure being imaged.
Availability of data and materials
mpfit code in MATLAB is freely available from the mpfit Github repository (https://github.com/dxm447/MPFit). The Python codes are available in the afit module of stemtools (https://github.com/dxm447/stemtools/tree/master/stemtools/afit). The datasets used and/or analyzed during the current study are available from the corresponding author (N.A.) on reasonable request.
Abbreviations
 STEM:

scanning transmission electron microscopy
 ADF:

annular dark field
 BF:

bright field
 HAADF:

high angle annular dark field
References
 1.
Haider, M., Uhlemann, S., Schwan, E., Rose, H., Kabius, B., Urban, K.: Electron microscopy image enhanced. Nature 392(6678), 768 (1998)
 2.
Batson, P., Dellby, N., Krivanek, O.: Subångström resolution using aberration corrected electron optics. Nature 418(6898), 617 (2002)
 3.
Pennycook, S.J., Varela, M., Hetherington, J., Kirkland, A.I.: Materials advances through aberrationcorrected electron microscopy. MRS Bull. 31(1), 36–43 (2006)
 4.
Nellist, P.D., Chisholm, M.F., Dellby, N., Krivanek, O., Murfitt, M., Szilagyi, Z., Lupini, A.R., Borisevich, A., Sides, W., Pennycook, S.J.: Direct subångström imaging of a crystal lattice. Science 305(5691), 1741–1741 (2004)
 5.
Aso, K., Shigematsu, K., Yamamoto, T., Matsumura, S.: Detection of picometerorder atomic displacements in driftcompensated HAADFSTEM images of gold nanorods. J. Electron Microsc. 65(5), 391–399 (2016)
 6.
Kisielowski, C., Freitag, B., Bischoff, M., Van Lin, H., Lazar, S., Knippels, G., Tiemeijer, P., van der Stam, M., von Harrach, S., Stekelenburg, M., et al.: Detection of single atoms and buried defects in three dimensions by aberrationcorrected electron microscope with 0.5Å information limit. Microsc. Microanal. 14(5), 469–477 (2008)
 7.
O’Keefe, M.A.: Seeing atoms with aberrationcorrected subångström electron microscopy. Ultramicroscopy 108(3), 196–209 (2008)
 8.
Sawada, H., Tanishiro, Y., Ohashi, N., Tomita, T., Hosokawa, F., Kaneyama, T., Kondo, Y., Takayanagi, K.: Stem imaging of 47pmseparated atomic columns by a spherical aberrationcorrected electron microscope with a 300 kV cold field emission gun. J. Electron Microsc 58(6), 357–361 (2009)
 9.
Krivanek, O., Dellby, N., Lupini, A.: Towards subÅ electron beams. Ultramicroscopy 78(1–4), 1–11 (1999)
 10.
Erni, R., Rossell, M.D., Kisielowski, C., Dahmen, U.: Atomicresolution imaging with a sub50pm electron probe. Phys. Rev. Lett. 102(9), 096101 (2009)
 11.
Kimoto, K., Asaka, T., Yu, X., Nagai, T., Matsui, Y., Ishizuka, K.: Local crystal structure analysis with several picometer precision using scanning transmission electron microscopy. Ultramicroscopy 110(7), 778–782 (2010)
 12.
Gao, P., Kumamoto, A., Ishikawa, R., Lugg, N., Shibata, N., Ikuhara, Y.: Picometerscale atom position analysis in annular brightfield STEM imaging. Ultramicroscopy 184, 177–187 (2018)
 13.
Yankovich, A.B., Berkels, B., Dahmen, W., Binev, P., Sanchez, S.I., Bradley, S.A., Li, A., Szlufarska, I., Voyles, P.M.: Picometreprecision analysis of scanning transmission electron microscopy images of platinum nanocatalysts. Nat. Commun. 5, 4155 (2014)
 14.
Zhu, Y., Ophus, C., Ciston, J., Wang, H.: Interface lattice displacement measurement to 1 pm by geometric phase analysis on aberrationcorrected HAADF STEM images. Acta Materialia 61(15), 5646–5663 (2013)
 15.
Mukherjee, D., Prokhorenko, S., Miao, L., Wang, K., Bousquet, E., Gopalan, V., Alem, N.: Atomicscale measurement of polar entropy. Phys. Rev. B 100(10), 104102 (2019)
 16.
Yadav, A., Nelson, C., Hsu, S., Hong, Z., Clarkson, J., Schlepütz, C., Damodaran, A., Shafer, P., Arenholz, E., Dedon, L., et al.: Observation of polar vortices in oxide superlattices. Nature 530(7589), 198 (2016)
 17.
Nelson, C.T., Winchester, B., Zhang, Y., Kim, S.J., Melville, A., Adamo, C., Folkman, C.M., Baek, S.H., Eom, C.B., Schlom, D.G., et al.: Spontaneous vortex nanodomain arrays at ferroelectric heterointerfaces. Nano Lett. 11(2), 828–834 (2011)
 18.
Azizi, A., Wang, Y., Stone, G., Elias, A.L., Lin, Z., Terrones, M., Crespi, V.H., Alem, N.: Defect coupling and subangstrom structural distortions in \({\text{ W }}_{{\rm 1x}} {\text{ Mo }}_{{\rm x}} {\text{ S }}_{2}\) monolayers. Nano Lett. 17(5), 2802–2808 (2017)
 19.
Stone, G., Ophus, C., Birol, T., Ciston, J., Lee, C.H., Wang, K., Fennie, C.J., Schlom, D.G., Alem, N., Gopalan, V.: Atomic scale imaging of competing polar states in a RuddlesdenPopper layered oxide. Nat. Commun. 7, 12572 (2016)
 20.
Matsumoto, T., Ishikawa, R., Tohei, T., Kimura, H., Yao, Q., Zhao, H., Wang, X., Chen, D., Cheng, Z., Shibata, N., et al.: Multivariate statistical characterization of charged and uncharged domain walls in multiferroic hexagonal \({\text{ YMnO }}_{3}\) single crystal visualized by a spherical aberrationcorrected stem. Nano Lett. 13(10), 4594–4601 (2013)
 21.
Williams, D.B., Carter, C.B.: Transmission Electron Microscopy. Springer, Berlin (1996)
 22.
MacArthur, K., Pennycook, T., Okunishi, E., D’Alfonso, A., Lugg, N., Allen, L., Nellist, P., et al.: Probe integrated scattering cross sections in the analysis of atomic resolution HAADFSTEM images. Ultramicroscopy 133, 109–119 (2013)
 23.
Watanabe, K., Yamazaki, T., Kikuchi, Y., Kotaka, Y., Kawasaki, M., Hashimoto, I., Shiojiri, M.: Atomicresolution incoherent highangle annular dark field STEM images of Si (011). Phys. Rev. B 63(8), 085316 (2001)
 24.
Abe, E., Kawamura, Y., Hayashi, K., Inoue, A.: Longperiod ordered structure in a highstrength nanocrystalline Mg1 at% Zn2 at% Y alloy studied by atomicresolution Zcontrast STEM. Acta Materialia 50(15), 3845–3857 (2002)
 25.
Rosenauer, A., Schowalter, M.: STEMSIM—a new software tool for simulation of STEM HAADF Zcontrast imaging. In: Microscopy of Semiconducting Materials 2007, pp. 170–172. Springer, Berlin (2008)
 26.
Wang, Z., Li, Z., Park, S., Abdela, A., Tang, D., Palmer, R.: Quantitative Zcontrast imaging in the scanning transmission electron microscope with sizeselected clusters. Phys. Rev. B 84(7), 073408 (2011)
 27.
Spaldin, N.A.: A beginner’s guide to the modern theory of polarization. J. Solid State Chem. 195, 2–10 (2012)
 28.
Lines, M.E., Glass, A.M.: Principles and Applications of Ferroelectrics and Related Materials. Oxford University Press, Oxford (1977)
 29.
Okunishi, E., Ishikawa, I., Sawada, H., Hosokawa, F., Hori, M., Kondo, Y.: Visualization of light elements at ultrahigh resolution by STEM annular bright field microscopy. Microsc. Microanal. 15(S2), 164 (2009)
 30.
Watanabe, K., Asano, E., Yamazaki, T., Kikuchi, Y., Hashimoto, I.: Symmetries in BF and HAADF STEM image calculations. Ultramicroscopy 102(1), 13–21 (2004)
 31.
Hossain, J., Sharma, S., Kishore, V.: Multipeak gaussian fit applicability to wind speed distribution. Renew. Sustain. Energy Rev. 34, 483–490 (2014)
 32.
Mukoyama, T.: Fitting of gaussian to peaks by noniterative method. Nucl. Instrum. Methods 125(2), 289–291 (1975)
 33.
Nord, M., Vullum, P.E., MacLaren, I., Tybell, T., Holmestad, R.: Atomap: a new software tool for the automated analysis of atomic resolution images using twodimensional gaussian fitting. Adv. Struct. Chem. imaging 3(1), 9 (2017)
 34.
De Backer, A., Van den Bos, K., Van den Broek, W., Sijbers, J., Van Aert, S.: StatSTEM: an efficient approach for accurate and precise modelbased quantification of atomic resolution electron microscopy images. Ultramicroscopy 171, 104–116 (2016)
 35.
Wang, Y., Salzberger, U., Sigle, W., Suyolcu, Y.E., van Aken, P.A.: Oxygen octahedra picker: a software tool to extract quantitative information from STEM images. Ultramicroscopy 168, 46–52 (2016)
 36.
Levenberg, K.: A method for the solution of certain nonlinear problems in least squares. Q. Appl. Math. 2(2), 164–168 (1944)
 37.
Marquardt, D.W.: An algorithm for leastsquares estimation of nonlinear parameters. J. Soc. Ind. Appl. Math. 11(2), 431–441 (1963)
 38.
Li, Y.: Centering, trust region, reflective techniques for nonlinear minimization subject to bounds. Technical report, Cornell University (1993)
 39.
O’Keefe, M.A., Kilaas, R.: Advances in highresolution image simulation. Scanning Microsc. Suppl. 2, 225–244 (1988)
 40.
Abrahams, S., Reddy, J.M., Bernstein, J.: Ferroelectric lithium niobate. 3. Single crystal xray diffraction study at 24 °C. J. Phys. Chem. Solids 27(6–7), 997–1012 (1966)
 41.
Boysen, H., Altorfer, F.: A neutron powder investigation of the hightemperature structure and phase transition in \({\text{ LiNbO }}_{3}\). Acta Crystallogr. Sect. B Struct. Sci. 50(4), 405–414 (1994)
 42.
Megaw, H.D.: A note on the structure of lithium niobate, \({\text{ LiNbO }}_{3}\). Acta Crystallogr. Sect. A Cryst. Phys. Diffr. Theor. Gen. Crystallogr. 24(6), 583–588 (1968)
Acknowledgements
The authors would like to acknowledge Dr. Jason Lapano and Prof. Venkatraman Gopalan of Penn State for helpful discussions on atom fitting metrology.
Funding
The authors acknowledge funding support from the Penn State Center of Nanoscale Science, an NSF MRSEC, funded under the grant number DMR1420620.
Author information
Affiliations
Contributions
DM and GS, advised by NA designed the algorithm. DM developed the MATLAB and Python subroutines for the algorithm implementation. DM and LM, advised by NA analyzed the data and developed the algorithm. DM performed the electron microscopy simulations. DM wrote the manuscript. NA edited the manuscript. All authors commented on the final manuscript. All authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix
Appendix
Gaussian calculation parameters
The Gaussian peaks were calculated based on Eq.1
where \(Z\left( x,y \right)\) is the Gaussian output as a function of x and y, \(\sigma _x\) and \(\sigma _y\) are the two normal distributions in the x and y directions, \(x_0\) and \(y_0\) are the position of the Gaussian peak, A is the amplitude of the Gaussian peak and \(\theta\) is the rotation in the counterclockwise direction of the twodimensional Gaussian peak.
Thus given a set of x,y, and z values from the experimental region of interest, a Gaussian curve is estimated from Eq.1 such that:
where \(\tau\) is the tolerance, which was \(\mathrm {10^{8}}\) for our implementation.
The equation itself is calculated through the leastsquares approach using the trustregion reflective algorithm. Trustregion algorithms are an evolution of Levenberg–Marquardt (LM) algorithms. However, compared to the LM algorithms, this algorithm is curvature independent and is thus computationally significantly faster [36,37,38].
Simulation parameters
The \({\text {LiNbO}}_{3}\) images were simulated using the MacTempasX software, with the simulation parameters enumerated in Table 1 [39].
Voronoi vs. square ROI
One other region of interest method was tried, apart from the standard box centered on the intensity minima—a ROI based on the Voronoi region around the intensity minima. A Voronoi region for a point is defined as the section of the image, for which the Cartesian distance to the point is the lowest compared to all other points in the image. However, we observed that the standard ROI actually gave better results rather than the Voronoi tessellation. This is most clearly visible in Fig. 8b where the distances between the two methods is scattered over even 20 pm, while the standard mpfit results are clustered less than 5 pm away from the known atom positions as could be observed in Fig. 7b. The standard deviation \(\left( \sigma \right)\) between the positions calculated with the two ROI techniques is 10.93 pm, much higher than the standard deviation between the simulated peak positions and the standard mpfit technique.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, 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 changes were made. 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/4.0/.
About this article
Cite this article
Mukherjee, D., Miao, L., Stone, G. et al. mpfit: a robust method for fitting atomic resolution images with multiple Gaussian peaks. Adv Struct Chem Imag 6, 1 (2020). https://doi.org/10.1186/s406790200068y
Received:
Accepted:
Published:
Keywords
 Peak refinement
 BFSTEM imaging
 Subpixel resolution
 Aberrationcorrected STEM