Scripting Resources for DigitalMicrograph™


Dave Mitchell's DigitalMicrograph™ Scripting Website

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


Assign ROI as EELS Background
Uses an ROI on an EELS spectrum to fit an exponential background which can be adjusted dynamically.
version:20150110, v1.0
D. R. G. Mitchell
Thanks to Steffen Meyer for advice on event listening and Vincent Hou for his really useful DMSUG example code showing how to use event maps to listen for ROI changes and removal.

This script emulates the DM EELS function of a similar name, in that it uses an ROI to fit an exponential background to an EELS spectrum and extract the edge signal. Moving the ROI will dynamically update the background fit/extracted edge. Deleting the ROI will delete the background fit and the extracted edge. This script uses two listeners. One to listen for changes in the position of the ROI, and another to listen for the ROI being deleted.

System Requirements
Tested on GMS 2.3, but should be compatible with GMS 1.x. This is designed to be used on EELS spectra.
Known Issues

On DM systems in which the Gatan EELS plugin is installed Control + clicking and dragging on a spectrum will cause an ROI and a background to be fitted automatically. This script is designed for installations which do not have the EELS plugin installed. Simply draw on the ROI by clicking and dragging on the desired region of the spectrum, then run this script to fit the background. Reposition/resize the ROI to adjust the fit.

Included Files
Single script file.
Source Code

See attached script file.