This section is devoted to Python scripts written for PyJEM-equipped JEOL microscopes. Any JEOL microscopes installed within the last few years should have this capability, including models such as the ARM, F200, 2100, 1400+ and 2800. PyJEM is a really exciting development, because it makes available to the coder a huge array of commands with which to source/set microscope parameters and to configure things like lenses, deflectors, detectors etc. It can also be used to acquire data directly. This enables users to customise their microscopes and to develop niche capabilities. This brings back the functionality of the old JEOL internal command line - which was lost about 15 years ago, when the transition from serial to ethernet communication occurred. This meant that anyone wishing to control a microscope externally was then limited to the command set exposed to the user through the TEM Con plugin and the DigitalMicrograph (DM) scripting language. For controlling Gatan hardware, the DM scripting language is excellent and provides a huge range of functionality. However, for controlling a microscope, the set of commands is limited, due to the need to keep the commands vendor-agnostic, and because different vendors make different functionality available or hidden. I greatly lamented the fact that on an antique microscope, like the 2000FXII (1990s vintage) I could control absolutely everything on the microscope using text commands sent from an external computer, whereas on modern microscopes, like the ARM200F, I could not - until now.
Currently, I am developing some Python scripts for a JEOL F200, which was commissioned in the EMC at UoW about 6 months ago. PyJEM came installed with this machine, and I am now getting around to kicking the tyres. I also have an ARM200F which was installed about 7 years ago. This does not (currently) have PyJEM installed, and it is not clear to me whether this functionality can be fitted retrospectively. I certainly hope so. Watch this space.
I am a complete novice at Python. Despite being a proficient coder, it took me some time to get up to speed. A couple of weeks of exasperation, endless trawls through help pages, and the invention of some new swear words, and I am now able to turn out Python code which works (eventually). There is a GitHub site for PyJEM, but it is currently, very sparsely populated. Hopefully, as more folks become aware of PyJEM, that will expand and other repositories will pop up. Another very interesting development is the fact that the latest version of DigitalMicrograph supports Python. I do not have this on my microscopes sadly, but it would be wonderful to be able to develop and run Python code alongside DM script. If DigitalMicrograph ends up being able to access the functionality in PyJEM directly, that would be a real back to the future moment.
I will create a repository here of working Python scripts, tutorials, examples etc. This is primarily for my own edification and to ensure that I can access stuff from anywhere. Hopefully, some of these tools are of use to others. Watch this space as I add resources in the coming months. All PyJEM scripts, even very simple short ones, will be compressed into a zip archive. This is because Python scripts (extension .py) are often flagged by browsers/email servers etc as potentially malicious and are blocked by policy.
All scripts and information provided here is done so in good faith. The author provides no warranty as to the fitness for purpose of the supplied material. The author accepts no responsibilty for any losses or damages which may arise from its use. Anybody contemplating using Python scripting with a microscope, should seek approval from the instrument manager beforehand.
Examples and Tutorials
PyJEM: How To: A PDF guide which outlines how to install PyJEM and write some simple scripts.