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

 

Faux Microscope Library
Function
A library of faux microscope control functions to enable offline script development for microscope-based scripts.
Version
version:20200718, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments

Writing scripts which access microscope hardware can be difficult, since this normally has to be done on the computer attached to the microscope/hardware. Typical instruments are heavily booked and this often entails script developers working long after hours. Code which invokes microscope control commands, will only work on DM installations attached to a microscope, since the microscope control plugin extends the scripting language to include the additional commands to address the hardware. Running code which calls hardware on an offline DM installation with no such plugin/hardware will create errors and the code will not run because the script commands are not present.

This library contains all the microscope control commands. If installed as a library in an offline version of DM, then scripts which invoke microscope control commands can be run without generating errors. This allows the initial development of microscope-based scripts to be done offline. Only when the script is reasonably finalised is it necessary to move to the microscope to test and finalise timings and responses. Install this script as a Library (File/Install Script - choose the Library option).

Microscope settings are included in a set of tags which these library commands can acccess (as if there were a real microscope attached). These can be monitored and edited using the Faux Hardware Settings script.

 

System Requirements
Should be compatible with all recent versions of DigitalMicrograph and has no external dependencies.
Known Issues

This script will produce quasi-sensible responses to microscope control calls. However, it will not be the same as having a microscope attached. In general, the idea is that you incorporate all the microscope-based code into your offline script and get it working in a reasonable form. Customisation of the library command responses is possible via use of the Faux Hardware Settings script. Where commands return taggroups or objects - these will be empty. You would need to add temporary code to simulate the contents of such objects, if this is necessary during script development.

The default settings which come with this script are, in part, based on the author's experience. However, in some instances the response are either unknown, or are likely to vary with hardware. Do not trust the default values here to be typical of what your system might use. Read the header on the Faux Hardware Settings script to get tips on how to test your hardware to see what values might be used, and then edit the default settings to match. In most cases, this is not important during the offline development stage, and can be worked out quickly, once the script is migrated to the microscope-based installation.

Supported
Yes.
Included Files
Main script.
Source Code

See attached source code