  We present the development of a new algorithm which combines state-of-the-art
energy-dispersive X-ray (EDX) spectroscopy theory and a suitable machine
learning formulation for the hyperspectral unmixing of scanning transmission
electron microscope EDX spectrum images. The algorithm is based on non-negative
matrix factorization (NMF) incorporating a physics-guided factorization model.
It optimizes a Poisson likelihood, under additional simplex constraint together
with user-chosen sparsity-inducing and smoothing regularizations, and is based
on iterative multiplicative updates. The fluorescence of X-rays is fully
modeled thanks to state-of-the-art theoretical work. It is shown that the
output of the algorithm can be used for a direct chemical quantification. With
this approach, it is straightforward to include a priori knowledge on the
specimen such as the presence or absence of certain chemical elements in some
of its phases. This work is implemented within two open-source Python packages,
espm and emtables, which are used here for data simulation, data analysis and
quantification. Using simulated data, we demonstrate that incorporating
physical modeling in the decomposition helps retrieve meaningful components
from spatially and spectrally mixed phases, even when the data are very noisy.
For synthetic data with a higher signal, the regularizations yield a tenfold
increase in the quality of the reconstructed abundance maps compared to
standard NMF. Our approach is further validated on experimental data with a
known ground truth, where state-of-the art results are achieved by using prior
knowledge about the sample. Our model can be generalized to any other scanning
spectroscopy techniques where underlying physical modeling can be linearized.
