WORK IN PROGRESS Toolbox for the automated analysis of large EELS datasets e.g. time series or spectrum images. The toolbox comprises several steps and lets you choose between different alignment methods, background models and deconvolution models. I hope it can help you with the automation of your data analysis. I have tested several datasets, but I greatly appreachiate feedback about problems with your specific dataset so that I can adjust the functions accordingly.
If you recorded a spectrum image using Gatan Digital Micrograph Version GMS3.4 I recommend the dm3Reader provided by NCEM to convert the dataset to a python script. The functions expect your data as an array with the form [xaxis, (yaxis,) spectrum].
Alignment of the dataset. In dependence of the nature of your dataset different methods are available. Method 1: If your spectra contain the zero-loss peak (ZLP) you can directly use the ZLP to align you data. The function requires the dispersion (eV/channel) and a threshold value for the intensity of the ZLP maximum.
[EELSaligned, energyscale, appliedShifts] = eels.ZLPalignment(EELSdata, Dispersion, IntensityZLP)
Method 2: If you recorded the spectra in Dual-EELS mode you can use the ZLP spectra to align your high-loss data.
[EELSaligned, energyscale, appliedShifts] = eels.ZLPalignment(EELSdata, Dispersion, IntensityZLP)
Method 3: If your data do not contain the ZLP, but all contain the same edge (whose shape doesn't change dramatically, e.g. C-K edge) you can use this edge to align your data using cross-correlation of your spectra. This requires a little more adjustements as described in the following.
Different models to subtract the background from the EELS dataset are available. The background is fitted within a small energy window defined close to the onset of the elemental edge (startBkg and endBkg). The powerlaw ('PL') model works best for most high-loss edges, while the polynomial models fit low-loss data best. The underlying mathematic equations are summarized in the following together with the respective literature reference. Especially for the functions 'Poly1' and 'Poly2' starting parameters (fitpara) and bounds (fitbounds) should be provided, otherwise the fitting most likely fails.
Keyword | Equation | Literature reference |
---|---|---|
'PL' | A*x^(-r) | |
'Poly1' | A*(x + m)^(-r) + b | |
'Poly2' | A*(x + m)^(-r-(c*x)) | |
'Linear' | A*x + t |
Bkg_fit(EELSdata, EnergyValues, startBkg, endBkg, BkgModel, fitpara, fitbounds)
Method 1: Deconvolution of the spectra
Method 2: Energy window between the peaks is fixed, well suited for spectra where the ZLP data are not available and slight shifting of the peaks during the acquisition must be compensated. Doesn't currently work for spectrum images, but I will add this functionality as soon as possible.