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


Drift Measurement

Script which periodically captures CCD or STEM images and uses cross correlation to measure the specimen drift. A cross correlation image, a vector plot (showing the direction and magnitude of the drift) and a plot of the instantaneous drift rate is displayed.

version:20150427, v2.1
D. R. G. Mitchell
Thanks to VIncent Hou for showing how to run a background thread from within a dialog.

Use this script to quantify the drift performance of your microscope and see if it meets specification. Microscope engineers typically use this type of software at installation to check the stage performance. This is useful for identifying when a goniometer is not performing as it should. Typical rates for modern instruments are of the order of <1nm/min after 30mins or so of settling. The script may also be useful for troubleshooting other sources of drift such as fluctuations in chilled water temperature or air conditioning cycling.

Updated in v2.1 to fix some minor bugs and to output the absolute drift in x and y and the drift direction.

System Requirements
Tested on GMS 2 running on a JEOL ARM200F with a Gatan Ultrascan camera and a DigiScan II under GMS 2.3 64bit. It will probably work with most types of Gatan CCD cameras. It may work with the older DigiScan. You may still use this script if you have only one or other bits of Gatan hardware (CCD Camera or DigiScan). Just avoid selecting the option you do not have. It will probably throw an error if you do, but may hang DigitalMicrograph. Ensure all work and DM settings have been saved before testing.
Known Issues

The script excises the largest 2^n x 2^n region from within the camera image (where n is an integer) to use for cross correlation. For non-square camera formats such as from an Orius - square images will be obtained. This script uses the newer Camera Manager functions. I am not sure when these were introduced, but compatibility with older CCD systems may be limited. Compatibility can be tested by simply having a live view image on the screen (to ensure camera communication is working), then start this script. If an error occurs or an image is not acquired, the script is not compatible with your system. It is trivial to swap out the new camera acquisition code for the older - more backwardly compatible - CCD acquisition commands. Contact the author if you encounter issues.

I find that theDigiScan II plugin software I have is very brittle. Even the Gatan demonstration code can cause DM to crash. It is recommended that you stick to STEM image sizes which are 2^n square (eg 512 x 512, 1024 x 1024 etc). The image exposure time is the total exposure time, so using large image sizes means very short dwells. Such images may become noisy and accuracy may suffer.

Included Files
Main script file.
Source Code

See attached script.