Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

EELS Spectral Difference Minimiser
Function
Scales and shifts the front slice of a spectrum containing two overlaid spectra, to minimise the difference between them and display the difference.
Version
version:20150907, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments
Often it is of interest to overlay two EELS spectra to highlight the differences between them. Due to thickness variations the intensities are different and HT drift may cause the edges to appear at different energies. These can be readily corrected for in the DM interface, but computing the difference between two spectra after such correction is not a simple subtraction, as the spectral data are unchanged, only the energy origin and intensity offsets are changed. This script requires an EELS spectrum in which two background subtracted EELS edges are overlaid. A region of interest (ROI) is drawn over the area of the spectrum in which a match is required. This is most likely to be the leading edge of the energy loss feature, as thickness variations make matching the trailing edge problematic. The script does an approximate scaling based on total intensity in the spectra. It then shifts the front spectrum relative to the back spectrum to align the two roughtly. It then does a Monte Carlo iteration to match intensity within the ROI, and a final energy shift to minimise the difference between the two spectra within the ROI. After alignment, the script will display the net difference between the spectra (back minus front).

 

System Requirements
This script should be compatible with all recent versions of DigitalMicrograph.
Known Issues
This generally works well if the spectra are very similar with a small energy shift. If they vary significantly, it may be necessary to use a wide ROI to span equivalent features in both spectra. Once a reasonable match is achieved, the ROI can be tightened up and the process repeated as many times as necessary to obtain a good match. Shifting and scaling one spectrum relative to another within the DM interface does not change the raw data. It only adjusts the energy origin and intensity scaling. This script does modify the data of the front spectrum.
Supported
Yes.
Included Files
Main script.
Source Code

see attached script