Scripting Resources for DigitalMicrograph™ |
PyJEM: Auto Func | |
Function |
A Python script which provides access to a range of JEOL automatic alignment functions. |
Version |
version:20220921, v1.0 |
Author |
D. R. G. Mitchell |
Acknowledgements |
- |
Comments |
JEOL provide a number of automatic alignment routines - Auto Focus, Auto Stigmation, Auto Z, Auto Contrast and Brightness and Auto Orientation. This script provides a dialog which allows these functions to be accessed on a per detector basis. In the case of STEM, the relevant alignment can be carried out using either the bright field or dark field signal. In the case of TEM mode, only the BF alignment buttons work and operate on the (JEOL) camera signal. The usefulness of these Auto routines for experienced users is marginal. I can do the alignment both better and faster than the Auto routine. However, for inexperienced users, they may have some merit, at least in terms of getting the alignment in the right ballpark. Typically, these routines are quite slow (10-20s). They can be sped up by using a small scan area. The dialog also provides controls for changing scan mode and for starting and stopping the live scan. In STEM mode, the bright field signal is generally the best for auto tuning the focus, the z height and the stigmation. The Auto Contrast Brightness (ACB) function works well with bright field. For dark field it always makes the signal too bright (vacuum regions show intensity when they should not). However, at least it gets the signal into the right ball park, and from there minor manual adjustment is quick and easy. After you launch the script (see below), you can leave it running behind the TEM Centre window. Then, whenever you need to use it, just select it from the Windows Task Bar and away you go. |
System Requirements |
Written in Spyder in Anaconda3. Requires a PyJEM-equipped JEOL microscope. The script can be opened in Spyder and run from there. Alternatively, double clicking on the script will run it in Python. If the downloaded script appears as a generic grey file icon it does not have Python set as the default application to open it. Right click on it and set Python to always open it. Python lives in the C://Anaconda3 folder. When you launch the Auto Func script by double clicking on it, a Console window will also appear. The script will report diagnostic information in that Console. However, you do need to refer to this window during use. You can minimise the Console, but you must not close it. If you encounter any problems, the Console will tell you which operations were the last to be successfully completed before the script stopped. The script can be used as is. There are no specific hardware configurations needed or other dependencies. This script was tested on a JEOL F200. |
Known Issues |
This is my third (recent) major Python scripting project. Having become familiar with PyJEM and Python, I focused on writing this correctly, using Classes and Class Methods. This avoids the plethora of global variables which litter my first scripting effort (ApCon). If you are going to write PyJEM scripts of any length, you should do it this way, not as I have done in ApCon.. This script is provided in good faith. The author provides no warranty as to its fitness for purpose. Users of this script do so entirely at their own risk. The author accepts no responsibility for any losses or damages which may arise from its use. Users are advised to consult with their microscope manager before using PyJEM scripts.
Troubleshooting: Major Errors: During the early stages of development of this script I did encounter several major script errors due to untrapped exceptions. These resulted from attemping to run an auto routine with the microscope in Spot rather than Scan or Area mode. These errors involved the microscope beeping, but no error message popup occurred in TEM Centre. In the error log a cryptic error message appeared. Script interaction with TEM Centre stopped - TEM Centre continued to work normally. I have since included traps in the script to avoid these errors, and the script now works fine. In the unlikely event that you do encounter any issues with this or other PyJEM scripts, these troubleshooting tips may be useful: Step 1: Right click on the TEM icon (bottom right of TEM Centre window) to bring up the Emergency panel. This shows LEDs which indicate error states. None will be lit. Click on Stop Alarm in the bottom right of the Emergency window. Normal operation should resume. Step 2: If the above does not work, then in TEM Centre switch from Scanning to TEM mode (or vice versa) and then back again. If scripting was blocked, you might find that the script dialog would not appear. Doing the above STEM to TEM to STEM shuffle causes it to reappear, and normal operation is resumed. Step 3: The above two steps have resolved all the major errors I have encountered. However, had they not, then restarting TEM Centre would have been the last thing to try. |
Supported |
Yes |
Included Files |
Main script file. |
Source Code |
zip archive containing the script. |