TemGym Basic
TemGym Basic is a ray-tracing software that models and visualises the first order behaviour of components inside a transmission electron microscope.
The interactive models we generate are designed with a focus on educating new users on how the basic alignments work inside a TEM. Our code is also capable of producing publication quality ray diagrams with a single function call.
Features
Interactive TEM models generated with pyqtgraph & PyQt5.
Ready-made example direct alignment models that enable users to learn at their own pace in an offline manner.
Generate interactive models of a transmission & scanning electron microscope.
Easy to use python code which allows users to create their own models by naming components inside a python list.
Generate publication quality ray diagrams of electron microscope experimental setups with one function call.
Component Overview
Our python code consists of 8 different electron microscope components which can be combined to create a model microscope.
Lens
Astigmatic Lens
Deflector
Double Deflector
Aperture
Stigmator
Biprism
Sample
We can easily create an example model containing all of these components by first importing the required packages into a python script.
from temgymbasic import components as comp
from temgymbasic.model import Model
from temgymbasic.run import run_pyqt
from PyQt5.QtWidgets import QApplication
import sys
Then we add the components into a list, and specify their position inside the microscope on the z-axis.
#Create List of Components
components = [comp.AstigmaticLens(name='Astigmatic Lens', z=1.2),
comp.Lens(name='Lens', z=1.0),
comp.Quadrupole(name='Quadrupole', z=0.9),
comp.DoubleDeflector(name='Double Deflector', z_up=0.70, z_low=0.65),
comp.Deflector(name='Deflector', z=0.6, defx=0, defy=0),
comp.Biprism(name='Biprism', z=0.4),
comp.Aperture(name='Aperture', z=0.1, aperture_radius_inner=0.05)]
#Generate TEM Model
model_ = Model(components, beam_z=1.5, beam_type='point',
num_rays=32, beam_semi_angle=0.03)
Then input the model into our pyqt function that creates the interactive 3D viewer and automatically populates the GUI.
viewer = run_pyqt(model_)
which generates an interactive window on your PC.