## 1 Introduction
### State of the Art. Data Handling and Synergic Applications  
The data collected through an MA-XRF analysis are a \(x\times y\times N\) matrices, where \(x\times y\) are the pixels (sample points) collected and \(N\) are the channels of the ED-XRF (Energy Dispersive-XRF) spectra. The analysis of each spectrum is not different from the analysis of the same data collected with other XRF methods, i.e., punctual XRF, thus the data treatment of each spectrum can follow the same protocol both for a qualitative and for a quantitative analysis. Yet, we have to face two main problems: the amount of data to be analyzed, and the inhomogeneity of the data itself, that is the variation of the data caused by other parameters than sample composition, as variation in the spectrometer-sample distance, shadowing (of the source and the detectors) due to the sample shape, and changes in the roughness of the surface [39; 40; 41]. These sources of error must be taken into account to perform a proper data reduction without compromising their correct evaluation. Some instruments can automatically maintain a constant distance between the spectrometer and the sample: this is particularly important when dealing with large paintings, usually warped, or when analyzing 3D objects, like jewels or other kinds of artifacts [27; 28; 29]. Indeed, if the distance is allowed to vary, a post-processing of the spectra is required, especially if we need to analyze light elements, highly affected by air absorption. A way to correct the data is proposed by [PERSON] et al. [13], exploiting the argon signal, due only to the interaction of X-rays with air and, as a first approximation, proportional to the sample-detector distance. Even if this method has been applied to stitch multiple MA-XRF images of the same paintings, it may also be used to correct small variations in the acquisition distance. The data correction for the shadowing effect is more complex: when the analyzed spot is partially hidden from the detector due to the morphology of the artifact, the artifact itself causes a reduction of the solid angle of the detector/source, lowering the signal. Some spectrometers mount two detectors in opposite directions [24] that partially mitigate this effect. If some of these sources of errors can neither be corrected in the post-processing of the spectra, they must be taken into account during the data analysis, with particular attention to the morphology of the sample. As already said, the amount of data collected in a MA-XRF scanning is a cubic matrix with hundreds of spectra; it is obvious that an operator cannot analyze all the spectra. A data reduction process is thus necessary and can be performed both as a channel data reduction (reducing the matrix along the \(N\) axis) or as a sample data reduction (reducing the matrix along the \(x\times y\) axes). The channel data reduction is probably the simplest to perform, for instance, converting the spectra into their fitted data, retrieving only the net area of the peaks. This process can be performed through the analysis of the sum spectrum of all the \(x\times y\) sample points, to evaluate the elements present in the whole scanning to be fitted in the following spectral analysis. The matrix thus obtained can then be treated by simple statistical methods, such as Principal Component Analysis (PCA), probably one of the most used techniques for data reduction, especially thanks to the low data loss that it provides. The \(N\) channels can then be represented in a k-dimensional space (where k is lower than \(N\)) and grouped into clusters. Different approaches relying on clustering methods can be used for sample data reduction. Most of these methods aim to cluster similar spectra in groups: each group can then be represented by an endmember, which summarizes the characteristics (the chemical composition) of the whole group.