Accurate SEM-EDS quantification, automation, and machine learning enable high-throughput compositional characterization of powders Authors: Andrea Giunto, Yuxing Fei, Pragnay Nevatia, Bernardus Rendy, Nathan J Szymanski, Gerbrand Ceder Published: 2026 ABSTRACT AbstractCompositional characterization is essential for understanding and optimizing material performance. For powder-based materials underpinning many modern technologies, however, accurately and rapidly resolving the composition of individual constituent phases remains an unsolved challenge, slowing materials research and limiting autonomous laboratory platforms. Scanning electron microscopy with energy-dispersive X-ray spectroscopy (SEM-EDS) offers a time- and cost-effective route, but artifacts generated by irregular particle morphologies fundamentally limit its reliability for quantitative compositional analysis. Here, we introduce a scalable particle-based SEM-EDS quantification scheme that overcomes these artifacts requiring only one experimental standard per element, including light elements conventionally difficult to quantify. To deploy this capability at scale, we then integrate this core quantification scheme with automated measurements and unsupervised machine-learning analysis in an end-to-end automated Python-based framework, AutoEMX, to enable identification and extraction of phase-level compositions within multiphase samples. AutoEMX consistently quantifies atomic fractions across diverse chemistries with relative errors below 10% and typically below 5%, resolving primary phases and intermixed impurities that evade conventional particle-averaged analysis. This work removes a long-standing barrier to rapid powder compositional characterization, enabling seamless integration in autonomous laboratories for accelerated discovery.Subject terms: Characterization and analytical techniques, Scanning electron microscopy, Materials for energy and catalysis Introduction The accelerating pace of materials discovery and optimization is increasingly constrained not by synthesis, but by the speed and accuracy of characterization—a bottleneck that limits the effectiveness of autonomous, self-driving laboratories1–3. In materials research and development, an essential component of characterization is the identification of phases formed during synthesis or processing, including minor or unintended secondary phases that may affect performance4–6. In powder-based materials, foundational to technologies from energy storage and conversion7–12 to thermoelectrics13,14 and additive manufacturing15,16, crystal structure is typically probed with X-ray diffraction (XRD), but structural data alone are often insufficient for unambiguous phase identification, particularly in multi-phase or chemically complex systems17. Complementary compositional analysis is therefore critical, yet established powder characterization methods are often labor-intensive and fail to simultaneously deliver the quantitative accuracy, throughput, and spatial resolution needed for rapid phase-level composition analysis across diverse chemistries6,18,19. Scanning electron microscopy with energy-dispersive X-ray spectroscopy (SEM-EDS) offers an attractive balance of speed and cost-effectiveness, enabling (sub-)micrometer compositional resolution with minimal sample preparation through direct powder deposition onto a substrate20. However, in powder samples, irregular particle sizes and morphologies yield strong mass and absorption effects that significantly distort X-ray peak intensities in EDS spectra (see Supplementary Note 1.1), fundamentally compromising quantification accuracy20,21. This limitation is widespread in commercial SEM-EDS software (see Supplementary Note 1.2), which is typically designed for flat, bulk specimens21; when misapplied to particles, commercial software workflows can produce substantial quantification errors, perpetuating the misconception that SEM-EDS is merely a semi-quantitative technique22. Nevertheless, the peak-to-background P/B approach offers a way to mitigate geometry-induced artifacts by exploiting the co-localized generation of peak and continuum X-rays, which scale similarly with particle morphology effects20,23. By normalizing characteristic peak intensities to the local background, studies have reported relative errors of 10–20% for some micron-scale particle compositions23–29. Yet prior demonstrations have been narrow in scope, typically focusing on a handful of particles and chemistries, and have relied on (1) sample-specific reference materials—such as strictly compositionally matched standards24,25 or standards with a closely matched average atomic number23. Because these methods require a priori knowledge of the sample to select appropriate references, they are not scalable for analyzing unknown, multiphase reaction products. Alternatively, prior work has relied on (2) standardless schemes requiring normalization of the measured mass fractions to 100%26–29, which preclude determination of the raw analytical total, a key indicator of measurement reliability21,22,25. The absence of an accurate, reliable and scalable quantification scheme, combined with persistent difficulties in light-element analysis with the P/B method30, has restricted the adoption of SEM-EDS for rigorous phase-level compositional analysis of loose particles dispersed onto a substrate22. As a result, both manual and automated SEM-EDS workflows remain confined to performing qualitative elemental mapping or broad chemical classification (e.g., aluminosilicates, nitrides) on raw, unpolished powders31–33, which is insufficient for accurate phase identification. In this study, we reengineer the P/B method to enable accurate and scalable particle-based SEM-EDS quantification using a single experimental standard per element, including light elements conventionally challenging to quantify in powders. By delivering reliable quantitative measurements of localized particle compositions, our approach enables automated acquisition of large, high-quality datasets, which reduce statistical uncertainty and support non-trivial machine learning (ML)-driven insights beyond simple compositional averaging. We package this fundamental advance into an end-to-end automated Python framework, AutoEMX, which embeds our core P/B approach within a unified pipeline of SEM-EDS spectra acquisition and quantification, principled data filtering, and unsupervised ML-based analysis of the measured elemental distributions. Capable of processing tens of samples per day, AutoEMX resolves multiphase samples by extracting the compositions of individual constituent phases and providing associated confidence scores of analysis. Validated across a chemically diverse set of commercial powders, minerals, and lab-synthesized materials spanning elements from nitrogen to bismuth, AutoEMX consistently achieves atomic fraction measurements with relative deviations from expected values below 5–10% and reliably identifies the composition of minor or intermixed phases. Together, these results overcome a long-standing barrier to quantitative SEM-EDS analysis and establish a robust framework for fully automated, high-throughput phase-level compositional characterization of loose, as-deposited powders, enabling seamless integration into autonomous laboratories for accelerated materials discovery and optimization. Results Framework for automated powder compositional analysis Fully automated compositional analysis of loose, as-deposited powders is achieved through a framework consisting of four primary components: (1) autonomous SEM particle localization and EDS spectra acquisition, (2) accurate EDS quantification, (3) automated filtering of unreliable measurements, and (4) unsupervised machine learning-based analysis of the resulting compositional data. This framework is implemented in a Python-based software package, AutoEMX (Automated Electron Microscopy X-ray spectroscopy), and demonstrated on a cost-effective desktop SEM-EDS system (Thermo Fisher Phenom XL G2). We present the AutoEMX workflow, schematized in Fig. 1 and described in detail in the “Methods.” AutoEMX requires only two inputs (Fig. 1a): the sample position on the microscope stage and the set of elements present in the sample. Optionally, the user may provide candidate phase compositions, whose presence is then evaluated by direct comparison with the measured compositions in the final step of the workflow. AutoEMX workflow for powder compositional analysis. Operation begins after the sample is loaded into the SEM. a The only required inputs are the SEM stub coordinates on the stage and the elements present in the sample; optionally, the user may also provide candidate phase compositions expected in the material. Automated EDS spectra acquisition is performed through b C-tape detection and subdivision into frames, c particle segmentation and localization, and d selection of positions for EDS spot measurements on individual particles. e The acquired spectra are fitted, and the composition at each spot is quantified in terms of elemental mass fractions wi. f Compositional data are filtered, and g analyzed using a k-means clustering algorithm to (h) identify the number and composition of phases present in the sample. Operation begins once a powder sample is dispersed onto a carbon tape (C-tape) stub and loaded into the SEM. AutoEMX first detects the C-tape region (Fig. 1b) and subdivides it into a grid, with each tile defining a stage position for particle search. Particles are segmented by intensity thresholding of SEM images and filtered by size (Fig. 1c), favoring those larger than 2 μm to reduce the mass effect illustrated in Supplementary Fig. 1. For each randomly-selected particle, up to five EDS spot spectra are acquired (Fig. 1d); points are spaced sufficiently far apart to avoid X-ray generation volume overlap and are selected away from edges to minimize substrate signal contamination. Typically, per sample, 100 spectra of 50,000 counts are collected, with total acquisition times ranging from 20 to 45 min. For each acquired EDS spot spectrum, AutoEMX quantifies the local composition in the form of elemental mass fractions wi using a reengineered peak-to-background (P/B) method to correct for geometry-induced artifacts (Fig. 1e). Conventional EDS quantification of wi assumes that measured peak intensities originate from a “bulk” sample—i.e., flat, sufficiently large to fully contain the X-ray generation volume. In contrast, the P/B method exploits the fact that, to first order, the P/B ratio of intensities is independent of geometry and thus approximately equal for particle and bulk samples of identical composition20,26: Here, P and B denote peak and background intensities, with subscripts p and b referring to particle and bulk spectra, respectively. Rearranging Eq. 1 yields a geometry-corrected, bulk-equivalent peak intensity (Ii*) suitable for conventional quantification models developed for bulk, polished samples: While Pi,p and Bi,p are extracted directly from the measured particle spectrum, Bi,b—the background intensity for a hypothetical bulk sample of identical composition—is unknown and must be estimated. Pi,p can be accurately obtained through Gaussian fitting of characteristic peaks. In contrast, extracting Bi,p is more challenging due to the often complex background shape underneath the peaks, influenced by X-ray absorption edges and detector artifacts—particularly below 2 keV, as shown in Supplementary Fig. 6. Furthermore, in spectra with fewer than several hundred thousand counts, the background signal is low and suffers from poor signal-to-noise; this makes Bi,p prone to fitting errors that propagate directly into the computed P/B ratio and ultimately to the quantified elemental compositions. Accurate modeling of the background shape is therefore essential to the P/B method. To this end, AutoEMX employs physically and empirically grounded models that account for continuum X-ray generation34,35, X-ray absorption36–38, electron backscattering39, and detector response function40 (see “Methods”). To overcome the limitations of these standard models, we introduce two key refinements that significantly improve background fitting in the low-energy portion of the spectrum: (1) a revised absorption model that captures the geometry-dependent X-ray path lengths within particles (illustrated in Supplementary Fig. 7) and (2) an empirical attenuation term that avoids overestimation of continuum X-rays at low energies (E < 1 keV) for heavy elements, whose effect is discussed in Supplementary Note 1.6. These refinements enable significantly more accurate determination of Bi,p in particle EDS spectra and, critically, the quantification of light elements with low-energy characteristic X-rays, such as N, O, and F. Another key challenge in applying the P/B method lies in the accurate estimation of Bi,b. This quantity is typically derived from an empirical model for continuum X-ray generation fB, expressed as Bi,b(E)=fB(Z¯,E), where fB is a function of energy E and the sample’s average atomic number Z¯26,28,41. However, we find that commonly employed empirical formulations of fB, introduced in refs. 34,42–44, have been obtained neglecting the effect of the electron stopping power (S), which governs energy dissipation of the incident electron beam and strongly depends on Z¯. This omission introduces substantial inaccuracies in the estimation of Bi,b, thereby leading to large quantification errors when the compositions of the standard and the measured sample differ significantly (see “Methods” and Supplementary Note 1.7); this likely explains why previous implementations of the P/B method relied on sample-specific reference materials with strictly matched compositions24,25 or closely matched average atomic numbers Z¯23. Instead, we incorporate stopping power effects into the estimation of Bi,b, enabling accurate quantification even when standard and sample differ markedly in Z¯. This correction renders the P/B method scalable, enabling the use of a single experimental standard per element across samples of virtually any composition; only a one-time initial measurement of standards is required to establish a permanent reference set for all future analyses on the same instrument. To further facilitate this process, standard collection and calibration are also automated within AutoEMX. Automated spectral filtering is necessary because the P/B method assumes that the P/B ratio is unaffected by particle geometry. In practice, however, this ratio can be distorted by experimental factors, such as beam placement on the particle, surface roughness, tilt, and porosity25,45,46, occasionally resulting in non-negligible deviations from the P/B approximation. To address this, AutoEMX incorporates a rule-based filtering strategy to discard spectra likely to yield inaccurate measurements (Fig. 1f). The filtering criteria include excessive substrate signal contamination28 or X-ray absorption25, poor spectral fitting, and excessive deviation of the analytical total (∑iwi) from 100 wt%20,21. In particular, the latter serves as a critical built-in quality metric for assessing the reliability of the measured composition: a substantial deviation from 100 wt% trivially signals a quantification error, such as the presence of an unmeasured element. Notably, the analytical error metric is made possible by the accurate, standard-based EDS quantification in AutoEMX, which yields absolute mass fractions wi without the need for normalization to 100 wt%, contrarily to standardless quantification approaches. Filtered compositional data are clustered and analyzed to identify the distinct phase compositions present in the sample (Fig. 1g). AutoEMX applies an unsupervised k-means clustering algorithm to vectors of elemental fractions, grouping similar compositions under the assumption that each cluster corresponds to a unique phase or a two-phase mixture. The number of clusters k is selected by applying empirical dimensionality thresholds for single-cluster determination or, when multiple clusters are present, by maximizing the silhouette score47. As an example, the analysis of a single-phase wulfenite (PbMoO4) powder is reported in Fig. 2a. A single cluster (teal dots) is identified, with its centroid (red cross) representing the average composition. Measurement uncertainty is quantified by the standard deviations of elemental fractions within the cluster (σi), visualized as a red ellipse whose principal axes correspond to 2σi. We note that compositions discarded during filtering (black triangles) generally lie far from the cluster, indicating that filtering effectively reduces measurement errors, a trend supported by broader statistical evidence in Section “Effectiveness of Rule-Based Filtering.” When candidate phases with their compositions are provided as input (e.g., PbMoO4 in Fig. 2a, blue star), AutoEMX evaluates the correspondence between the measured cluster compositions and the candidate phases based on their Euclidean distances in compositional space, assigning a confidence score to each cluster-candidate pair. Because cluster compositions are directly measured rather than constrained by the reference inputs, any physical variations—such as dopants, off-stoichiometry, or unexpected impurity elements—are explicitly captured in the quantitative output. These compositional deviations increase the distance to the nominal reference phase, which is quantitatively reflected as a lower output raw confidence score (CSraw). A probabilistic confidence score for candidate phase matching (CScnd)—the ultimate metric utilized in an autonomous context—is then computed from both this compositional proximity and the presence of other neighboring potential candidate phases (see “Methods”). Examples of AutoEMX compositional analyses. 3D plots of AutoEMX compositional measurements for a a single-phase wulfenite mineral (PbMoO4) and b a (sub)micron-scale two-phase mixture of NaAlSiO4 and LiMn1.5Ni0.5O449. Axes represent elemental a atomic or b mass fractions of the plotted compositions (green dots = valid compositions; black triangles = discarded compositions). Cluster centroids, indicating the average composition within each cluster, are marked by red crosses. The light red uncertainty ellipsoid represents the standard deviations of elemental fractions (σi), with principal axes lengths equal to 2σi. The tables summarize the measured compositions and the RMS of point-to-centroid distances (dRMS), along with the corresponding phase or phase mixture identified by AutoEMX, and the associated confidence scores (CScnd for single candidate phases, CSmix for two-phase mixtures). In b, a subset of three elemental mass fractions is displayed, sufficient to illustrate the large standard deviations characteristic of mixed-phase measurements. Full measurements are reported in Supplementary Fig. 4a. Discarded compositions are omitted from this panel for clarity. The 2D projection onto the Si-Mn plane facilitates visualization of the compositional measurements in a two-phase mixture as a linear combination of the two parent phase compositions. The presented framework also enables the discrimination and resolution of clusters originating from a two-phase mixture of distinct phases, rather than from a single homogeneous phase. In some materials, different phases may intermix on length scales smaller than the X-ray generation volume, which typically spans depths between 50 nm and 4 μm at beam energies of 10–25 keV20. In such cases, the measured EDS spectra reflect the average composition within the probed volume of material48, which may therefore differ from the composition of any of the individual intermixed phases. An illustrative example is the (sub)micron-scale mixture of NaAlSiO4 and LiMn1.5Ni0.5O4 (see Supplementary Fig. 18), obtained from a solid-state reaction of spodumene mineral (LiAlSi2O6) with Na2CO3, MnO2, and NiO powder precursors49, and analyzed in Fig. 2b. The compositional cluster measured by AutoEMX exhibits a centroid offset from both parent phase stoichiometries and possesses a large root-mean-square (RMS) of point-to-centroid distances (drms = 10.8 wt%) compared with that of single-phase samples, e.g., wulfenite (drms = 2.1 at%). These are typical signatures of clusters originating from intermixed phases, where the local average composition fluctuates between the two endmembers. Hence, when a cluster cannot be confidently assigned to a single phase or displays a large spread, AutoEMX assumes it originates from a two-phase mixture and attempts to deconvolute it into its probable parent phases. This process leverages the fact that multiple measurement points statistically sample a linear combination of the endmember compositions, thereby populating the intermediate compositional space, as exemplified by the 2D projection shown in Fig. 2b. First, the cluster composition matrix is fitted via the non-negative least squares (NNLS) method with all combinations of pairs of input candidate phase compositions as vector bases, while constraining the coefficients to sum to 1. For each pair, the reconstruction error is exponentially weighted and converted into a mixture confidence score (CSmix) via a Gaussian decay function (see “Methods”). If no pair yields a satisfactory CSmix, non-negative matrix factorization (NMF) is employed to decompose the cluster composition matrix and infer compositional vector bases corresponding to the likely parent phases. In the example of Fig. 2b, using NNLS AutoEMX resolves the cluster into the correct phase mixture of NaAlSiO4 + LiMn1.5Ni0.5O4 with a high confidence (CSmix = 0.83). Similarly, despite no information on the original intermixed phase compositions, NMF yields a mixture of Na0.76(Mn0.10)Al0.87Si1.05O4 + (Na0.13)Mn2.07(Al0.05)Ni0.64O4 (excluding Li, which is undetectable in the employed SEM-EDS system). These compositions resemble the actual mixture components, particularly in terms of cation ratios—the 1:1:1 Na:Al:Si ratio is recovered as approximately 0.87:1:1.2, and the 3:1 Mn:Ni ratio as 3.2:1. These results suggest that NNLS and NMF are effective in identifying compositions that are likely to approximate the true parent phases in two-phase mixtures. The final output of AutoEMX (Fig. 1h) includes all clusters with their average compositions, uncertainties, and any matched or inferred phases, along with the associated confidence scores. Accuracy of composition measurements We demonstrate that using a single set of experimental standards, generally comprising one standard per element, AutoEMX consistently estimates compositions with relative deviations from the expected values below 5–10%. A total of 74 single-phase powder samples were analyzed, including commercial powders, standard minerals, and lab-synthesized materials, whose nominal compositions are listed in Table 1. The benchmark predominantly comprises oxide, phosphate, and silicate chemistries, spanning 38 elements from nitrogen (Z = 7) to bismuth (Z = 83), with the occurrence of each element reported in Fig. 3a. Per-element standard reference P/B values were obtained from bulk polished samples of the pure metallic form when available, or otherwise from simple binary or ternary compounds. The accuracy of AutoEMX is quantified using the relative deviation from expected value (RDEV) of the measured elemental atomic fraction (ni): where ni,nominal represents the atomic fraction extracted from the nominal compound stoichiometry. Each acquired spectrum thus yields multiple RDEV values—one per element detected. With the P/B method, sources of composition measurement errors are imprecise fitting, substrate signal contamination, and inherent limitations of the P/B approximation. Table 1Single-phase materials used to benchmark the accuracy of AutoEMX, discussed in Fig. 3Commercial materialsMineralsSynthetic samplesAl2O3MoO2Alamositea (PbSiO3)Bi2Fe4O9AlPO4Na2MoO4Albitea (NaAlSi3O8)Bi25FeO39Ba3(PO4)2Na4P2O7Anhydritea (CaSO4)CaCo(PO3)4bCo3O4NaNO3Anorthitea (CaAl2Si2O8)CaNaFeMg(SiO3)4bCuONi(OH)2Benitoitea (BaTiSi3O9)Hf2SbPb42O13bFe2O3NiOBornitea (Cu5FeS4)K2TiCr(PO4)3bGa2O3PbOChalcopyritea (CuFeS2)K4MgFe3(PO4)5bGeO2Sb2O3Co Olivinea (Co2SiO4)KNaTi2(PO5)2bHfO2ScPO4aFe Olivinea (Fe2SiO4)LaNbO4In2O3SiO2Fluorphlogopitea (KMg3(AlSi3O10)F2)MgCuP2O7bKClSnO2Jadeitea (NaAlSi2O6)MgTi2NiO6bK-412 NIST standard glassaTa2O5Labradoritea ((Ca0.65Na0.34)(Al1.66Si2.33)O8)MgTi4(PO4)6bLi3NiCoMnO6TiNMn Olivinea (Mn2SiO4)MnAgO2bLiCoPO4TiO2Nephelinea ((Na0.79K0.17)(Al0.95Si1.04)O4)NaGe2(PO4)3cLi2WO4WO3Orthoclasea ((K0.92Na0.08)(Al0.91Fe0.07)Si3O8)NaSn2(PO4)3cMgF2YIGa (Y3Fe5O12)Rhodonitea ((Mn0.59Fe0.20Ca0.18)SiO3)NaTiSn(PO4)3cMgOYPO4aWulfenitea (PbMoO4)NaZrTi(PO4)3cMnOZnONa0.6Zr1.4Ta0.6(PO4)3cMnO2Zr0.985O2dMn2O3aObtained from a set of EDS experimental standards used at the Earth & Planetary Science department at the University of California, Berkeley.bSamples synthesized via solid-state firing, details in ref. 80.cNASICON-type materials.dContains hafnium impurity (<2 wt% per manufacturer specification). Hf was measured at 0.5 at% by AutoEMX and subtracted from the nominal Zr content of 33.3 at%. Hf was excluded from the accuracy analysis due to the lack of a verified ground truth. Single-phase materials used to benchmark the accuracy of AutoEMX, discussed in Fig. 3 aObtained from a set of EDS experimental standards used at the Earth & Planetary Science department at the University of California, Berkeley. bSamples synthesized via solid-state firing, details in ref. 80. cNASICON-type materials. dContains hafnium impurity (<2 wt% per manufacturer specification). Hf was measured at 0.5 at% by AutoEMX and subtracted from the nominal Zr content of 33.3 at%. Hf was excluded from the accuracy analysis due to the lack of a verified ground truth. Performance of AutoEMX benchmarked on single-phase powder samples. a Periodic table showing the frequency of each element’s occurrence across all 74 benchmark single-phase samples; generated using pymatviz81. b Histogram of the relative deviation from expected value (RDEV) of the elemental atomic fractions (ni) measured in all 2483 spectra retained after AutoEMX's filtering step. Light-colored counts highlight measurements of low-Z elements (N, O, F); dark counts denote all other elements. Dark and light green bands indicate RDEV values within 5% and 10%, respectively; labeled percentages give the fraction of measured RDEV values falling within each band. c Histogram of RDEV values for ni extracted at cluster centroids, corresponding to the average compositions measured in each single-phase sample after principled filtering. d Histogram of absolute deviation from expected value (ADEV) for centroid compositions; hatched counts denote ni with RDEV > 10%. Dark and light green bands indicate ADEV values within 1 at% and 2 at%, respectively. A total of 5684 spectra were acquired and quantified. Figure 3b reports the distribution of 8226 RDEV values obtained from the 2483 individual spectra retained after AutoEMX filtering, showing that 61.3% (84.4%) of the measured ni exhibit RDEV < 5% (10%). A non-negligible tail with RDEV > 10% highlights the risk of outlier-driven errors when only a few spectra are analyzed per sample. In Fig. 3c, substantially improved measurement accuracy is achieved by extracting atomic fractions at the cluster centroids—i.e., the average composition within each cluster—where 75.8% (93.6%) of RDEV values fall below 5% (10%). This improvement underscores the advantage of the AutoEMX strategy, which aggregates multiple spectra in clusters to average their compositions, mitigating random variability and yielding more reliable estimates. Furthermore, we highlight that the 73 RDEV values obtained at cluster centroids from low-Z elements (N, O, F; lighter coloring) follow similar accuracy trends as heavier elements. We note that similar trends are observed in Supplementary Fig. 10 when analyzing the three sample groups separately (minerals, commercial powders, and lab-synthesized materials), indicating that any compositional inhomogeneity present in the lab-synthesized materials does not affect the reported observations. Absolute deviations from the expected value (ADEV, defined as = ni − ni,nominal) for centroid compositions are shown in Fig. 3d, with 71.2%/90.3%/95.8% of values measured within ADEV of 1/2/3 at%, indicating generally modest absolute errors. Typically, ADEV values are larger for binary compounds, as discussed in Supplementary Note 1.9. In Fig. 3d, we highlight that among the 15 reported centroid ni values with RDEV > 10% (hatched counts), 12 have ADEV < 1 at%; this suggests that large relative errors are primarily confined to small atomic fractions (<10 at%) where absolute deviations remain minimal (<1 at%). Finally, we assess the measurement uncertainty delivered by AutoEMX for single-phase samples. Excluding lab-synthesized materials to minimize the influence of compositional inhomogeneity (Supplementary Note 1.10), we find that 48.1% (91.2%) of measured ni exhibit standard deviations σi < 1 at% (<2 at%), corresponding to relative uncertainties below 5% (10%) in 66.2% (95.6%) of cases, as shown in Supplementary Fig. 12. Overall, these results demonstrate high compositional measurement accuracy for single-phase samples, providing robust experimental data for ML-based analyses to resolve phase compositions in multi-phase materials. Effectiveness of rule-based filtering To validate the effectiveness of the implemented filtering criteria, Fig. 4a shows the RDEV distributions of the spectra discarded by AutoEMX. The 3201 discarded spectra exhibit markedly poorer accuracy than the retained ones: only 39.7% (58.5%) of their RDEV values fall below 5% (10%), versus 61.3% (84.4%) in the retained set (Fig. 3b), confirming the benefit of the applied filtering strategy. A key contribution comes from the analytical total error ϵan: spectra discarded solely for exceeding the ϵan threshold are already substantially less accurate than the retained set (Fig. 4b versus Fig. 3b), establishing ϵan as an effective indicator of unreliable measurements. ϵan alone, however, is insufficient, as cancellation of large positive and negative elemental RDEV values can yield a deceptively low ϵan, masking unreliable measurements that pass the ϵan threshold. This occurs for 402 spectra (Fig. 4d), where only 41.4% (63.8%) of values fall below 5% (10%) despite their ϵan < 5 wt%; these spectra could be flagged as unreliable only by the remaining filtering criteria. These criteria—detailed in the “Methods” and targeting excessive X-ray absorption, insufficient background counts, substrate signal contamination, and poor spectral fitting (Fig. 4e–h)—also account for the largest deviations among all discarded spectra (Fig. 4c). Individually, each criterion yields RDEV distributions broader than that of the retained spectra in Fig. 3b, with poor fits (panel h) producing the largest quantification errors. Together, the ϵan threshold and these complementary filtering criteria are therefore both essential to achieving the demonstrated accuracy. Quantification error distribution in discarded spectra. Distributions of relative deviation from expected value (RDEV) values for atomic fractions (ni) quantified from spectra discarded by the AutoEMX filtering procedure. In all panels, dark and light green bands indicate RDEV values within 5% and 10%, respectively; labeled percentages give the fraction of measured RDEV values falling within each band. a All discarded spectra. b Spectra discarded only for exceeding the analytical total error threshold (ϵan > 5 wt%). c Spectra discarded for reasons other than ϵan, regardless of their ϵan value. d Subset of c with ϵan < 5 wt%. e–h Breakdown of d by failure mode (see “Methods”): excessive X-ray absorption, insufficient background counts, substrate signal contamination, and poor spectral fitting, respectively. Two further aspects are worth highlighting. First, the discarded spectra represent 56.3% of all acquired measurements. This degree of filtering—essential for reliable quantification—is feasible only with the large datasets enabled by automation. Second, the analytical total used to identify unreliable spectra is available only through standard-based quantification; this is an advantage over standardless EDS methods26–29, which require normalization of the measured fractions to 100 wt%50 and thereby forfeit access to ϵan22. Versatility across compositionally complex and diverse powders We showcase the versatility of AutoEMX on a series of representative samples, each posing a progressively greater analytical challenge—from multi-element single phases to incompletely reacted multiphase mixtures (Fig. 5). This robustness across diverse phase content and chemistry stems from combining quantitative accuracy (5–10 at%) with ML-based analysis of the large acquired compositional datasets. Representative examples demonstrating the diversity of sample types analyzable by AutoEMX. Results of AutoEMX compositional analysis. The 3D plots show the measured and discarded compositions (colored dots and black/gray triangles, respectively), together with the output of the clustering analysis, with the identified clusters distinguished by color. Tables report the average composition measured for the individual clusters, extracted at the centroids (red crosses), together with relative uncertainties computed as the standard deviations of the elemental fractions in the cluster. Also listed are the identified candidate phase or phase mixture and the corresponding confidence score: CScnd for a single-phase assignment or CSmix for a mixture, in some cases reported under the common header CS. a, d, e Display only selected elemental atomic fractions; full results are reported in Supplementary Table 4. Each panel presents a sample representing a distinct challenge (bold label), with ground-truth phases given in the panel subtitle: a complex multi-element compositions, e.g., the K-412 NIST glass standard (Fe: 3.1 at%, Mg: 10.6 at%, Ca: 6.0 at%, Al: 4.0 at%, Si: 16.8 at%, O: 59.4 at%). b Phases containing elements at low mass fractions (⪅ 10 wt%) that are undetectable by SEM-EDS, e.g., Li in Li3NiCoMnO6. c Samples with a dominant phase and a minor secondary phase, e.g., residual TiO2 precursor in a NaZrTi(PO4)3 lab-synthesized sample. d Mixtures of phases with similar compositions, e.g., MnO, Mn2O3, and Fe2O3. e Incompletely reacted samples, e.g., containing unreacted precursors (TiO2, ZrO2), intermediate products (Na3La(PO4)2), and a main phase with composition close to the XRD-refined Na3Zr2(SiO4)2(PO4) (NZSPO, Supplementary Fig. 21). Discarded compositions are omitted in this panel for clarity. Owing to its refined spectral fitting routines and standard-based EDS quantification, AutoEMX accurately measures complex multi-element compositions, such as the K-412 NIST standard (Fe: 3.1 at%, Mg: 10.6 at%, Ca: 6.0 at%, Al: 4.0 at%, Si: 16.8 at%, and O: 59.4 at%; Fig. 5a), where peak overlapping complicates accurate background fitting (Supplementary Fig. 6). The method also remains effective in the presence of undetectable elements in low weight fraction, such as Li in Li3NiCoMnO6 (Fig. 5b). Extending beyond single-phase chemical complexity, AutoEMX identifies distinct phase compositions with similar chemistries within multiphase samples. For example, the framework correctly resolves a three-phase mixture of MnO, Mn2O3, and Fe2O3 (Fig. 5c) despite the inclusion of chemically similar input candidates, such as MnO2, Mn3O4, and FeO. The close compositional proximity of Mn3O4 to the green cluster centroid reduces the confidence score (CScnd) computed for Mn2O3 (see “Methods”), yet the correct phase composition is identified. Additionally, a key strength of AutoEMX lies in its sensitivity to minority phases. By employing the k-means clustering algorithm, which is density-independent, clusters consisting of as few as one or two points can be isolated, enabling identification of phases present at low abundance. Highlighting this capability, Fig. 5d illustrates the successful detection of residual TiO2 precursor (3.1 wt% from XRD refinement, Supplementary Fig. 20d) in a NaZrTi(PO4)3 synthetic sample; this is achieved by identifying a two-point cluster and subsequently decomposing it via NNLS, resolving the TiO2 + NaZrTi(PO4)3 mixture with a high CSmix of 0.98. Ultimately, owing to these combined strengths, AutoEMX can discern different phase compositions in complex multiphase synthetic systems, such as the incomplete reaction product in Fig. 5e. For this sample, XRD Rietveld refinement (Supplementary Fig. 21) shows the presence of residual precursors TiO2 and ZrO2, an intermediate compound Na3La(PO4)2, as well as the sodium super ionic conductor (NASICON) major phase Na3Zr2(SiO4)2(PO4), although its composition could not be unambiguously identified solely via XRD diffraction. AutoEMX identified the main phase with a composition closely matching the XRD-refined Na3Zr2(SiO4)2(PO4); yet, in this cluster, La and Ti inclusions were measured, as well as a different Si-to-P ratio, leading to a CScnd = 0.64 that corresponds to a distance in compositional space of approximately 3 at% from the XRD reference phase. Single clusters of the intermediate product Na3La(PO4)2 and residual TiO2 were detected with high confidence (CScnd = 0.94 and 0.63, respectively, with the latter lowered by Zr and Na inclusions or intermixing). Lastly, residual ZrO2 was also found intermixed with the main NASICON phase with CSmix = 0.31. The low confidence score indicates that this Zr-rich cluster originates possibly from a mixture of more than two phases, which cannot be accurately decomposed into a two-phase cluster, or simply from different phases not included among the candidate compositions. For this cluster, NMF suggests a two-phase mixture of a Zr-Ti oxide and a Zr-rich NASICON phase with CSmix = 0.74 (not shown). More broadly, these observations demonstrate how spatially resolved chemical analysis complements powder diffraction techniques; by detecting minor inclusions and compositional deviations often absent from idealized XRD references, AutoEMX can cross-check and directly inform structural refinements, enabling a more robust characterization of complex multiphase systems. Discussion We introduce a framework for fully automated, high-throughput SEM-EDS compositional analysis of powder materials, implemented in the Python package AutoEMX. The workflow integrates a reengineered particle-based peak-to-background (P/B) EDS quantification scheme, automated spectral acquisition and filtering, and ML-based composition analysis. By requiring only a single experimental standard per element, the introduced P/B quantification scheme represents a practical, scalable advance over previous methods and enables accurate routine quantitative powder EDS analysis after a one-time reference standards collection. Validated across 74 single-phase samples comprising 38 different elements from nitrogen to bismuth, AutoEMX consistently quantifies atomic fractions with relative deviation from expected value (RDEV) below 10%, typically below 5%. In multiphase samples, unsupervised k-means clustering enables identification of different phase compositions, including minority phases, while NNLS and NMF algorithms prove valuable to discern phases intermixed at the sub-micrometer scale. The range of showcased powder analyses highlights the robustness and versatility of the introduced framework, supporting its suitability for automated analysis of diverse single-phase materials and compositionally complex, multiphase powders. Example application areas span high-entropy alloys, functional and structural ceramics, and powder materials for heterogeneous catalysis and electrochemical energy storage and conversion—classes of systems in which compositional complexity and phase heterogeneity make quantitative analysis both essential and challenging. Despite the irregular geometries typical of powder specimens, AutoEMX achieves compositional accuracy (5–10% RDEV) comparable to standardless P/B quantification of flat, polished bulk samples reported in the literature and commonly employed in commercial EDS software30,50–52. Crucially, this accuracy arises from the combination of an improved P/B quantification method and from automated filtering of unreliable spectra, the latter relying in part on the analytical total accessible only through standard-based quantification. While the ultimate precision in SEM-EDS remains the 2–5% relative error achieved on polished bulk specimens using matrix-matched experimental standards21,22, reaching 5–10% accuracy directly on raw particles bridges a critical gap. This level of performance, attained without particle resin embedding and polishing, challenges the long-standing assumption that powder samples inherently preclude quantitative SEM-EDS compositional analysis. Furthermore, in this work, light elements, such as N, O, and F, are directly quantified—not inferred from mass balance—with accuracy in line with benchmarked bulk analyses using experimental standards53, marking a notable advance in the practical capabilities of the P/B method30. Although carbon was excluded due to the use of a C-tape substrate, its quantification is expected to become feasible with alternative low-Z supports, such as beryllium54 or boron55. In addition, all measurements in this study were conducted using a benchtop SEM-EDS instrument with a 28.5∘ detector take-off angle, a suboptimal configuration that increases X-ray absorption path lengths. While this underscores the effectiveness of the introduced EDS quantification scheme, further gains in accuracy are expected with higher-performance systems offering larger take-off angles and improved vacuum conditions. We argue that automation plays a key role in enabling the achieved performance. Beyond cutting operator time, it enables the acquisition of multiple tens of spectra per sample—an otherwise impractical manual task. This larger dataset makes it possible to apply stringent spectral filtering and average across multiple measurements, substantially reducing quantification errors arising from irregular particle morphologies and the P/B approximation (Fig. 4), while also enabling data-driven ML analyses that go beyond simple compositional averaging (Fig. 5). In addition, the absence of operator bias in EDS spot selection ensures a more representative sampling of the analyzed powders. We highlight that although this work focuses on powders measured in automated mode, the framework is not restricted to this application. The introduced EDS quantification scheme is instrument-agnostic and can directly process spectra exported from commercial SEM-EDS systems (see Supplementary Note 1.3), with detector-specific recalibration required only to achieve optimal compositional accuracy. Additionally, AutoEMX operates seamlessly on flat, bulk specimens and supports manually guided selection of EDS measurement locations for arbitrary sample geometries, broadening its applicability beyond powder-based workflows. For instance, pairing manually targeted quantitative spot analyses with conventional qualitative EDS maps enables robust verification of reference compositions across the entire mapped region. While effective, AutoEMX presents opportunities for improvement. First, the current implementation expects the probed particles to be a few micrometers or larger, as it does not account for size-dependent effects or substrate interactions during EDS quantification. Applying such corrections, for example, those proposed by Essani et al.28, could extend applicability to sub-micron particles—where substrate contributions are more pronounced—and reduce data loss from spectra discarded due to substrate signal contamination. Second, particle identification is currently based on intensity thresholding, which can lead to inconsistent sampling. Integration of ML-based segmentation56,57 would enable more robust and adaptive particle recognition. Alongside this, implementing periodic beam realignment and tracking strategies during acquisition would help detect and mitigate beam-induced artifacts, particularly in beam-sensitive materials. A further limitation is the requirement to define the elements of interest in advance. While suitable for materials science workflows where the constituting elements are generally known, incorporating automated peak-identification routines58 would support application to less constrained domains, such as mineralogy59, forensics60, and environmental particulate analysis61, where elemental content may be unknown during particle composition identification. Similarly, while k-means clustering provides a computationally efficient solution for differentiating the distinct material classes analyzed here, the highly heterogeneous samples found in these fields may require more sophisticated clustering approaches, potentially going beyond on Euclidean-distance-based partitioning62. Because AutoEMX is designed as a modular Python framework, users can readily substitute the k-means module with density-based algorithms (e.g., DBSCAN, available through scikit-learn63), or methods based on compositional data analysis and Aitchison geometry64. Finally, although the spectral fitting routine yields parameter uncertainties via the least-squares covariance matrix65, these are not currently propagated to estimate uncertainties in measured atomic fractions. Including this information could enable uncertainty-weighted clustering66 and more rigorous confidence score estimation, further strengthening the framework’s quantitative robustness. To conclude, we establish a fully automated, high-throughput framework for quantitative SEM-EDS analysis of powders, making phase-level compositional information—systematically obscured in conventional sample- and particle-averaged measurements—directly accessible. As a result, powder compositional characterization can be performed routinely alongside XRD, enabling robust multimodal phase identification to inform subsequent experimental steps. The AutoEMX framework is released under a non-commercial license and can be integrated into existing SEM-EDS systems with minimal calibration, facilitating adoption across a broad range of instruments and laboratories. Beyond SEM-EDS, the modular software architecture of AutoEMX allows the automated processing and clustering pipelines to be adapted for related techniques, such as scanning transmission electron microscopy (STEM)-EDS and wavelength-dispersive X-ray spectroscopy (WDS), broadening its applicability to platforms offering enhanced spatial or compositional resolution. By delivering robust, high-throughput, and automated compositional analysis across chemically diverse materials, AutoEMX enables seamless integration of quantitative powder characterization into autonomous laboratory workflows, accelerating systematic exploration of composition-property relationships for materials discovery and development. Methods AutoEMX workflow Software overview AutoEMX is a Python package designed to run locally on the SEM computer, featuring a modular architecture compatible with any microscope model that offers a Python-based application programming interface (API). As shown in Fig. 1a, it requires minimal user input: the position of the sample stub on the SEM stage and a list of elements potentially present in the sample. Optionally, users may provide the compositions of expected phases to enable candidate-based phase assignment. Automated SEM-EDS acquisition We employ a Thermo Fisher Phenom XL G2 benchtop SEM-EDS instrument equipped with a Python-accessible API and a Ametek FAST SDD Ultra High Performance silicon drift detector (SDD). All image processing operations are implemented using functions from the OpenCV library67. AutoEMX initiates analysis by locating the C-tape on the sample stub using the navigation camera (Fig. 1b), enabling tolerance to off-centered tape sticking. Canny edge detection and Hough circle transforms are used to identify the circular C-tape region. This area is divided into a grid that defines stage positions and frame magnifications for particle analysis. Frames are analyzed in random order to ensure spatial representation of the sample. The SEM is operated at 15 kV in backscattered electron detector (BSD) mode to provide Z-contrast. As visible in Supplementary Fig. 1a, due to the low atomic number of carbon, particles appear bright on a dark background, while topographic contrast from the rough C-tape substrate is minimized. This facilitates robust particle segmentation via intensity thresholding55. Consistent segmentation performance is ensured by the automatic brightness, contrast, and focus functions provided by the SEM software API, applied routinely at both frame and particle levels. Within each frame, particles are segmented using a fixed intensity threshold of 100 on 8-bit greyscale SEM images (i.e., maximum intensity of 255) (Fig. 1c). Only particles with a projected area greater than 4 μm2 are retained to minimize the mass effect illustrated in Supplementary Fig. 1b. For each segmented particle, selected in a random order, AutoEMX recenters and zooms the live SEM view so that the particle occupies approximately two-thirds of the frame, maximizing spatial resolution (Fig. 1d). EDS spectra are acquired at individual points (i.e., spot spectra), rather than via rastering, to preserve spatial resolution and capture intraparticle compositional heterogeneity. Up to five pixels are selected within each particle, restricted to regions at least 1 μm from the edge to minimize substrate signal contamination, which can be caused by side scattering or reduced thickness at the particle edges (Fig. 1d). Spots are also constrained to be at least 1 μm from one another to minimize redundant sampling of the same material volume, and they are selected randomly to avoid bias toward any particular phase. Spot spectra are acquired at 15 kV with a target of 50,000 total counts, typically yielding acquisition times of 6–15 s depending on sample composition and particle morphology. This moderate total count minimizes both measurement time and carbon deposition, which results from the 0.1 Pa vacuum in the employed SEM-EDS system. A maximum measurement time of 30 s is set to interrupt the collection of a spectrum in the event of particle segmentation errors, after which the next particle is selected, and the analysis proceed. AutoEMX iterates through the described workflow (Fig. 1c–e) until 100 spectra are collected or no further particles are found, requiring 20–45 min per sample. Due to hardware constraints, in this study, spectral fitting, quantification and ML-based composition analysis were performed offline on a separate workstation. Nevertheless, AutoEMX supports real-time analysis and can terminate acquisition autonomously based on confident assignment of all compositional clusters to user-provided candidate phases. Fitting of EDS spectra Spectra are fitted via non-linear least-squares minimization using the LMFIT package65. Characteristic X-ray peaks are modeled as Gaussian functions to capture detector noise broadening68. The model fits the intensities of the primary reference peaks for each element and X-ray emission series (K, L, M), while the relative intensities of secondary peaks are fixed according to weights from the NIST EPQ library (github.com/usnistgov/EPQ; accessed December 2024), calibrated against our experimental standards. To account for detector incomplete charge collection (ICC), peak shapes incorporate low energy tails: below 1.18 keV they are represented by skewed Gaussian functions (following Osán et al.54, without the shelf component), and above 1.84 keV—corresponding to the Si detector absorption edge—they follow the model by Redus and Huber40. Between these energies, a convolution of both models is applied (Supplementary Note 1.11). Peak ICC shape parameters, calibrated on bulk, polished EDS standards, are fixed during fitting as a function of characteristic peak energy (Supplementary Note 1.11). Background fitting is a critical step in the P/B method, where misestimation of continuum X-ray intensity can lead to significant quantification errors. The background intensity measured at the EDS detector B(E) is modeled as where E is the X-ray energy, fB describes the continuum intensity generated within the sample, R accounts for backscattered electrons that do not contribute to X-ray generation, f(χ) is the fraction of generated X-rays that escape the material without being absorbed, and η is the detector efficiency. The contribution of these components to the background is illustrated in Supplementary Fig. 1. The detector efficiency η(E) is provided by the SEM manufacturer, and R is modeled following Love et al.39. The continuum generated by the C-tape contributes minimally to the overall background due to the low atomic number of carbon23, and is therefore neglected. Where this approximation does not hold, spectra are discarded from the compositional analysis during the AutoEMX filtering step (see Filtering of Compositional Data). The absorption term f(χ) is computed using the ionization depth distribution function Φ(ρz) originally proposed by Packwood and Brown36, with coefficients modified by Riveros and Castellano38 and Tirira Saa et al.38: Here, μ/ρ is the mass absorption coefficient (cm2/g), ρz is the mass depth (g/cm2), and Ψ is the X-ray take-off angle, fixed at 28.5∘ in the employed SEM-EDS system. Mass absorption coefficients are computed using atomic scattering factors from Henke et al.69, updated via the E. Gullikson database (henke.lbl.gov/optical_constants/; accessed: February 2025). In Eq. 5, the denominator represents the total number of X-rays generated within the material, while the numerator accounts for those that successfully escape the sample surface, assuming a flat, bulk geometry. Although originally developed for characteristic X-rays, this formulation remains valid for continuum X-rays under the P/B approximation, based on the similarity of their generation depths70. Yet, the X-ray path length ℓ(z) = zcscΨ in Eq. 5 assumes a flat surface geometry of the sample, which does not reflect the morphological complexity of irregular particles. To account for such topographic effects on X-ray absorption, we approximate the particle surface along the X-ray path to the EDS detector as an oblique plane. This yields a modified path length that captures surface tilt and offset with respect to the electron beam point of entry: Here, z0 and m are fitted geometrical parameters, with positive values corresponding to increased absorption relative to a flat sample and negative values indicating reduced absorption. Their geometric interpretation is illustrated in Supplementary Fig. 7a, b. The function fB is based on the empirical expression from Duncumb et al.34: where k is a time-scaling intensity factor, F and P are empirical parameters that depend on the electron beam energy (E0) and atomic number Z, and U = E0/E is the overvoltage. For compound materials, the average atomic number Z¯ is computed following the expression by Statham et al.35: where wi, Zi, and Ai are the mass fraction, atomic number, and atomic mass of element i, respectively. Accurate computation of Z¯ is essential for enabling the P/B method to operate with a single experimental standard per element. Alternative averaging schemes, such as a simple mass-weighted mean26 and the formulation from Markowicz et al.71, are outperformed by the Statham approach (Supplementary Note 1.12). We found that Eq. 4 systematically overestimates the continuum intensity at X-ray energies below 0.5 keV (Supplementary Note 1.6) when using fB = fB,Duncumb, especially for heavy elements with Z > 45. To address this, we introduce an empirical low-energy attenuation term, implementing a correction of the form: where β(Z) is an attenuation coefficient ranging from 0 to 0.35. For compound materials, β(Z) is computed as a mass-weighted average of elemental values of β. Expressions of F(Z), P(Z), and β(Z) were calibrated using bulk, polished standards (Supplementary Note 1.13), and fixed during spectral fitting. Finally, to accurately fit the background signal output by the EDS detector BD(E), we account for the full SDD response function using the following expression: Here, the detected background intensity B(E) is convolved with the detector’s Gaussian broadening function σ(E) and the detector ICC response function nicc(E). The energy-dependent broadening σ(E) is computed using the expression from Ritchie72, while nicc(E) follows the model by Redus and Huber40. An empirical Gaussian term ng(E), centered at E = 0 is added to account for the excess low-energy counts observed below 0.5 keV, attributed to EDS detector artifacts such as the zero-energy strobe peak20. Quantification of EDS spectra Elemental mass fractions wi are computed using the expression derived by Lábár and Török26 (see Supplementary Note 1.14): Here, Pi and Bi are the peak and background intensities for element i, measured in the particle p and experimental standard std, respectively. The electron backscattering (Rc) and X-ray absorption (Ac) correction factors account for subtle differences in the generation volumes of characteristic and continuum X-rays, typically contributing only a few percent26. Fc is a correction for secondary fluorescence and can be neglected due to its negligible impact on spectra acquired from micron-sized particles24,26,27. The dominant correction, Zc, accounts for differences in the continuum intensity generated within the sample and standard, which directly impact the measured P/B ratio for a fixed wi. Zc is defined as (Supplementary Note 1.14): where Bgen is the continuum X-ray intensity generated in a bulk, flat sample with average atomic number Z¯, and free from matrix composition effects. Depending on the composition difference between the sample and the standard—i.e., the difference in average atomic number Z¯—Zc can vary between 20% and 500%, making accurate estimation of Bgen critical in the P/B quantification method. However, this has often been complicated by a common misinterpretation in the literature, in which Bgen is erroneously equated with the function fB. Historically, empirical expressions of fB have been derived from spectra corrected only for detector response, backscattering, and absorption, as in Eq. 4; these derivations did not account for the stopping power correction S, which is instead typically included in matrix corrections for characteristic X-rays20. As a result, while fB is often interpreted as a proxy for generated continuum X-rays26,28, it is in fact affected by matrix-dependent stopping power effects and does not represent the true matrix-free generation term Bgen. Hence, in AutoEMX, Bgen is calculated as: where S is the stopping power correction term from Love et al.39, and fB is computed from Eq. 9, with parameters F(Z), P(Z), and β(Z) calibrated against elemental experimental standards, spanning carbon (Z = 6) to bismuth (Z = 83) (Supplementary Note 1.13). The emended formulation of the Zc correction term enables the use of a single experimental standard per element within the P/B method, as detailed in Supplementary Note 1.7. In Eq. 11, Pi is the integrated intensity of the Gaussian peak fitted to the element’s reference line, taken as Kα for elements with Z ≤ 30, Lα for 30 < Z ≤ 76, and Mα for heavier elements. The background intensity Bi is obtained by evaluating the fitted background model B(E) from Eq. 4 at the reference line energy Ei. To allow comparison across detectors with different channel widths ΔE, Bi is normalized as Bi = B(Ei)/ΔE, in units of counts/eV. P/B ratios for standards are retrieved from an experimental dataset that includes one standard per element (except for oxygen and indium, for which two consistent measurements were averaged), acquired using bulk, polished materials comprising pure metals and selected compounds: GaN, BaSO4, MgO, CaF2, NaCl, InP, KBr, and LaB6. Each standard P/B value is obtained by averaging over fifteen 250,000-count EDS spectra. Because the fitted background B(E) is composition-dependent, the quantification of elemental mass fractions wi must be performed iteratively73: after each pass, the values of wi are recalculated using Eq. 11 and held fixed in the subsequent iteration. Additionally, the weights of secondary peak intensities—initially based off pure standards—are updated to account for changes in the attenuation function f(χ), which depends on the quantified composition (wi) and the fitted particle geometry parameters (m and z0 from Eq. 6). The procedure is considered converged when the change in wi between two successive iterations falls below 0.01 wt% for all quantified elements. Filtering of compositional data Compositional data are discarded if any of the following conditions are met: The total spectrum counts are lower than 50,000, indicating the maximum acquisition time was reached before the target count could be acquired. This is generally a sign that the spectrum originates from the C-tape substrate due to a particle segmentation error. The total spectrum counts are lower than 50,000, indicating the maximum acquisition time was reached before the target count could be acquired. This is generally a sign that the spectrum originates from the C-tape substrate due to a particle segmentation error. The carbon peak contributes more than 10% of total counts, suggesting substantial signal contamination from the C-tape substrate, which compromises fitting and quantification of elements with low-energy reference lines. The carbon peak contributes more than 10% of total counts, suggesting substantial signal contamination from the C-tape substrate, which compromises fitting and quantification of elements with low-energy reference lines. The spectrum exhibits excessive X-ray absorption, which prevents reliable P/B ratio measurement25. Excessive absorption is identified when, relative to a flat sample, f(χ) increases by more than 70% within a 1-keV window centered on the lowest-energy reference peak. Spectra are also flagged when the low-energy region (<2 keV) contains more than 20 channels with fewer than 5 counts. The spectrum exhibits excessive X-ray absorption, which prevents reliable P/B ratio measurement25. Excessive absorption is identified when, relative to a flat sample, f(χ) increases by more than 70% within a 1-keV window centered on the lowest-energy reference peak. Spectra are also flagged when the low-energy region (<2 keV) contains more than 20 channels with fewer than 5 counts. A reference peak possesses statistically insufficient background counts, i.e., Bi < 0.5 cnts/eV. A reference peak possesses statistically insufficient background counts, i.e., Bi < 0.5 cnts/eV. The reduced chi-squared statistic indicates poor spectral fit (χν2<100). The reduced chi-squared statistic indicates poor spectral fit (χν2<100). The compositional quantification results in an analytical total error ϵan that exceeds ±5 wt%, where ϵan = 1 − ∑iwi quantifies the deviation of the analytical total from 100 wt%. The compositional quantification results in an analytical total error ϵan that exceeds ±5 wt%, where ϵan = 1 − ∑iwi quantifies the deviation of the analytical total from 100 wt%. The efficacy of these strategies is discussed later in the manuscript. Clustering algorithm Filtered compositional data are grouped using an unsupervised k-means clustering algorithm from the scikit-learn library63, with the matrix of elemental atomic fractions as input; mass fractions are used instead for samples with undetectable elements (H, He, Li, and Be) or with binary compositions. The number of clusters k is determined automatically a-priori using empirical thresholds combined with selection criteria from the yellowbrick package74. Specifically, k is set to 1 if, supposing k = 1, the RMS distance drms of the cluster points to its centroid is less than 3% (Supplementary Note 1.10), or, alternatively, if the average silhouette score s¯47 is <0.5 for k = 2. Conversely, if s¯>0.6, the data is considered to contain multiple clusters. In the intermediate s¯ regime (0.5 3%, Supplementary Note 1.10)—indicating an elongated or spread-out cluster—AutoEMX attempts to determine whether it arises from a two-phase mixture. A NNLS fit76 is performed on the cluster’s compositions using all possible pairs of candidate phases as basis vectors. The algorithm minimizes the Frobenius norm between the composition matrix X and its reconstruction WH, where W contains non-negative mixture coefficients constrained to sum to 1, and H encodes candidate phase compositions. The quality of the reconstruction is quantified using an exponential error metric ϵ: where α = 15 is an empirical penalization factor that increases sensitivity to poorly reconstructed compositions. The reconstruction error is normalized by the number of elements in X (m × n) to allow comparison across clusters of varying size. A Gaussian binary mixture confidence score (CSmix) for each phase pair is then computed as where σmix = 0.5 determines the rate of confidence decay. This formulation mirrors the behavior of CSraw, favoring reconstructions with low ϵ while non-linearly suppressing the score for poor fits. It yields probabilistic CSmix values of approximately 0.95, 0.78, 0.52, and 0.08 for average atomic fraction errors of 1%, 2%, 3%, and 5%, respectively, assuming uniformly distributed errors. Because of the exponential nature of ϵ, reconstructions with a few large deviations are penalized more heavily than those with uniformly distributed errors, even if the average deviation is the same. As such, the CSmix values above represent upper bounds for given mean errors. If no candidate mixture pair achieves CSmix > 0.5, AutoEMX attempts to identify the underlying parent phases using NMF77. In this ML-based algorithm, both the coefficient matrix W and the basis matrix H, which encodes the inferred phase compositions, are fitted to minimize the Frobenius norm ∥X − WH∥F, using alternating updates via the cvxpy solver78,79. The elemental fractions in both vector bases in H are constrained to be non-negative and to sum to 1, ensuring their physical interpretability. This approach allows recovery of compositions similar to those of the parent phases even in the absence of suitable input candidate phases. Samples Single-phase samples to evaluate measurement accuracy The measurement accuracy of AutoEMX was assessed using the curated set of 74 single-phase materials listed in Table 1, with chemistries spanning elements from nitrogen (Z = 7) to bismuth (Z = 83), summarized in Fig. 3a. This set includes commercial powders, natural minerals, and synthetic compounds. A fraction of the samples, mostly synthetic compounds, contained impurity phases, with impurity contents in all cases below 10 wt%. For such samples, when AutoEMX resolved multiple clusters, the spectra associated with impurity phase clusters were excluded from the analysis. We note that vanadium oxides were intentionally omitted from the sample dataset due to the strong overlap between the O Kα and V Lα lines, which hinders accurate extraction of peak intensities and, consequently, reliable quantification. All samples were prepared by dropping micron-sized powders on conductive C-tape for AutoEMX analysis. Mineral standards (asterisk superscript in Table 1) had been previously crushed using a mortar and pestle. Representative outputs of AutoEMX measurements are provided in Supplementary Fig. 22, with the full dataset available in the associated code repository (see Data Availability). The measured elemental atomic fractions were compared against the nominal compositions listed in Table 1 to compute the RDEV values shown in Fig. 3. Nominal compositions for commercial powders were taken from manufacturer specifications; the exact suppliers and product numbers are listed in Supplementary Table 3. The mineral samples are routinely used as EDS standards by the Department of Mineralogy at UC Berkeley and have well-established, precisely known compositions to within 0.01 wt%, which were taken as ground truth; trace elements below 0.5 wt% were intentionally excluded from the analysis. This group of samples also includes the K-412 NIST glass standard and the compounds ScPO4, YPO4, YIG (Y3Fe5O12), all marked with an asterisk in Table 1. Synthetic samples were prepared using the A-Lab automated solid-state synthesis platform80. Bi25FeO39 and Bi2Fe4O9 were synthesized by mixing stoichiometric amounts of Bi2O3 (Sigma-Aldrich, 90–210 nm) and Fe2O3 (Sigma-Aldrich, <50 nm) using a mortar and pestle. The resulting powders were thermally treated at 750 and 800 °C, respectively, for 12 h. For Bi2Fe4O9, an additional 12-h calcination at 800 °C was carried out to improve phase purity. LaNbO4 was synthesized by mixing stoichiometric amounts of La2O3 (Sigma-Aldrich) and Nb2O5 (Sigma-Aldrich) in ethanol with a Hauschild SpeedMixer for 10 min. The mixture was then heated at a rate of 2 °C/min to 1100 °C and held at that temperature for 2 h to obtain a single-phase material. Materials of NASICON type—marked by a double-dagger (‡) superscript in Table 1—were synthesized by mixing precursors from Sigma-Aldrich to stoichiometric amounts of each of the material compositions: Na2CO3 (10 wt% excess were used to compensate for Na loss), GeO2, NH4H2PO4, SnO2, ZrO2, Ta2O5, and TiO2. The precursor powders were mixed in ethanol with a Hauschild SpeedMixer for 10 min and dried at 80 °C for 2 h. The mixtures were then heated to 300 °C at a 2 °C/min ramping rate, followed by heating to 1100 °C with 5 °C/min ramping rate, and a 12-h dwelling. Samples were then left cooling to room temperature in the box furnace. For the synthesis of NaSn2(PO4)3, NaTiSn(PO4)3, and NaZrTi(PO4)3, 33 wt% excess of NH4H2PO4 were used, and a longer 12-h low-temperature dwelling at 150 °C was employed before heating to 1100 °C. Details on synthesis conditions and characterization of the remaining synthetic samples, indicated by the dagger (†) superscript, are reported elsewhere80. For all synthetic samples, the main reference phase was confirmed by Rietveld refinement of XRD data, shown in Supplementary Figs. 19 and 20. We acknowledge that commercial powders may exhibit slight deviations from their nominal stoichiometry and that Rietveld refinement alone does not provide sufficient precision to rigorously determine absolute composition or to assess compositional homogeneity in the lab-synthesized materials. To evaluate the potential impact of such uncertainties, in Supplementary Note 1.8, we analyzed the distributions of measured RDEV and ADEV values separately for the three investigated sample classes: EDS mineral standards with precisely known composition, commercial powders, and lab-synthesized materials. While minor differences are observed among the groups, the overall trends remain consistent. The EDS standards exhibit the highest accuracies, with 97.6% of cluster-centroid RDEV values below 10 and 98.8% of ADEV values below 2 at%. Commercial powders display slightly larger ADEV values, primarily reflecting the prevalence of binary compositions (see Supplementary Note 1.9). Lab-synthesized samples show broader RDEV tails above 10%, consistent with compositional inhomogeneity (Supplementary Note 1.10) and possible minor off-stoichiometry. Importantly, the highest accuracy is obtained for the EDS standards, whose compositions are known to a precision of 0.01 wt%. This indicates that uncertainties in nominal sample composition do not artificially inflate the reported performance in Fig. 3. If anything, residual uncertainty in the commercial and lab-synthesized samples seems to cause underestimation of the reported AutoEMX accuracy. We therefore present all sample classes together to emphasize the general applicability of AutoEMX across compositionally diverse and practically relevant materials. Multiphase samples to demonstrate AutoEMX versatility The wulfenite mineral in Fig. 2a and the synthetic samples in Fig. 5a, b, d belong to the list in Table 1 and have been described in the previous section. The ternary powder mixture in Fig. 5d (MnO, Mn2O3, and Fe2O3) was prepared by sequentially depositing commercial powders onto the SEM stub. The synthesis and characterization of the nano-scale mixture of NaAlSiO4 and LiMn1.5Ni0.5O4 in Fig. 2b are detailed in the work of Wang et al.49. The multi-component sample in Fig. 5e was produced using the A-lab robotic synthesis platform80 by heating a mix of Na2CO3, La2O3, ZrO2, TiO2, SiO2, and NH4H2PO4 with a ratio corresponding to the overall composition of Na3.238 La0.238 Zr1.117 Ti0.645 (SiO4)2 (PO4) with 10% Na excess. The heating profile follows the one described for the NASICON single-phase samples, except for the 12-h dwelling at 150 °C, which was skipped for this sample. Rietveld refinement of the resulting powder (Supplementary Fig. 21) confirmed the presence of the precursor phases TiO2 and ZrO2, as well as the intermediate compound Na3La(PO4)2, suggesting Na3Zr2(SiO4)2(PO4) as the major phase, although its composition could not be unambiguously identified. Supplementary information Supplementary Information Description of Additional Supplementary Files Supplementary Movie 1 Transparent Peer Review File Acknowledgements The authors thank John Grimsich, from the Earth & Planetary Science department at the University of California, Berkeley, and colleague S. Wang49 for providing samples employed in this work. A.G. acknowledges fruitful discussions with Prof. S.T. Oyakhire and Thermo Fisher engineer S. Stoks. Author contributions A.G. conceived this work with inputs from P.N., N.J.S., and G.C. A.G. designed the study and methodologies, wrote the Python code, and performed EDS measurements and analyses. Y.F. and B.R. carried out sample synthesis, XRD measurements and Rietveld refinements. G.C. supervised the work. A.G. wrote the manuscript, with contributions and editing from all authors. Peer review Peer review information Nature Communications thanks Nicholas Ritchie and the other anonymous reviewer(s) for their contribution to the peer review of this work. A peer review file is available. Funding Statement This work was intellectually led with funding from the D2S2 program within the U.S. Department of Energy, Office of Basic Energy Sciences, Materials Sciences and Engineering Division under Contract No. DE-AC02-05-CH11231 (D2S2 programme, KCD2S2), supporting A.G., Y.F., P.N., N.J.S., and G.C. A.G. was mainly supported by the Swiss National Science Foundation (SNSF, project #P500PN_222166). B.R. acknowledges support from the Energy Storage Research Alliance “ESRA" (DE-AC02-06CH11357), an Energy Innovation Hub funded by the U.S. Department of Energy, Office of Science, Basic Energy Sciences. Data availability The experimental data generated in this study have been deposited in the paper_data directory at the GitHub repository at https://github.com/CederGroupHub/AutoEMX (https://doi.org/10.5281/zenodo.20882118). The data comprises SEM particle images annotated with the measurement locations, EDS spectral data, and quantified compositions, along with the corresponding analysis code employed to generate the histograms shown throughout the manuscript. Additional analyses are provided in the Supplementary Information file. Code availability The AutoEMX source code is available on GitHub at https://github.com/CederGroupHub/AutoEMX (https://doi.org/10.5281/zenodo.20882118) under a free non-commercial-use license. Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Contributor Information Andrea Giunto, Email: agiunto@lbl.gov. Gerbrand Ceder, Email: gceder@berkeley.edu. Supplementary information The online version contains supplementary material available at https://doi.org/10.1038/s41467-026-76633-x. References Associated Data Supplementary Materials Supplementary Information Description of Additional Supplementary Files Supplementary Movie 1 Transparent Peer Review File Data Availability Statement The experimental data generated in this study have been deposited in the paper_data directory at the GitHub repository at https://github.com/CederGroupHub/AutoEMX (https://doi.org/10.5281/zenodo.20882118). The data comprises SEM particle images annotated with the measurement locations, EDS spectral data, and quantified compositions, along with the corresponding analysis code employed to generate the histograms shown throughout the manuscript. Additional analyses are provided in the Supplementary Information file. The AutoEMX source code is available on GitHub at https://github.com/CederGroupHub/AutoEMX (https://doi.org/10.5281/zenodo.20882118) under a free non-commercial-use license.