  STEM XEDS spectrum images can be drastically denoised by application of the
principal component analysis (PCA). This paper looks inside the PCA workflow
step by step on an example of a complex semiconductor structure consisting of a
number of different phases. Typical problems distorting the principal
components decomposition are highlighted and solutions for the successful PCA
are described. Particular attention is paid to the optimal truncation of
principal components in the course of reconstructing denoised data. A novel
accurate and robust method, which overperforms the existing truncation methods
is suggested for the first time and described in details.
