pyTEMlib , a pycroscopy library
Important Formulas¶
a pycroscopy ecosystem package
Notebook by
Gerd Duscher and Darel Pates
Materials Science & Engineering
Joint Institute of Advanced Materials
The University of Tennessee, Knoxville
Collection of usefull Formulas
%matplotlib widget
import matplotlib.pylab as plt
import numpy as np
import scipy
import pyTEMlib
pyTEMlib.__version__'0.2025.12.0'The formula for relativistic corrected wavelength is:
with
h: Planck constant
m_e: rest mass of electron
: kinetic energy of electron (after acceleration)
c: speed of light
# --- Input ----
e0 = 60000 # acceleration voltage in eV
# ---------------
def get_wavelength(e0: float) -> float:
"""get deBroglie wavelength of electron accelerated by energy e0 (in eV)
Parameters
----------
e0 : float
acceleration voltage in eV
Returns
-------
float
wavelength in meters
"""
e_kin = scipy.constants.e * e0
m_e = scipy.constants.m_e
c = scipy.constants.c
h = scipy.constants.h
return h / np.sqrt(2 * m_e * e_kin * (1 + e_kin / (2 * m_e * c**2)))
h = get_wavelength(e0)
print(f"wavelength is {h*1e12:.2f} pm for {e0/1000:.0f} keV")wavelength is 4.87 pm for 60 keV
help (get_wavelength)Help on function get_wavelength in module __main__:
get_wavelength(e0: float) -> float
get deBroglie wavelength of electron accelerated by energy e0 (in eV)
Parameters
----------
e0 : float
acceleration voltage in eV
Returns
-------
float
wavelength in meters
# --- Input ----
e0 = 200000 # acceleration voltage in eV
convergence_angle = 10 / 1000 # convergence angle in radians
# ---------------
def depth_of_focus(acceleration_voltage: float, convergence_angle: float) -> float:
"""calculate depth of focus
Parameters
----------
acceleration_voltage : float
acceleration voltage in eV
convergence_angle : float
convergence angle in radians
Returns
-------
float
depth of focus in meters
"""
wavelength = get_wavelength(acceleration_voltage)
return wavelength / convergence_angle**2
focus_depth = depth_of_focus(e0, convergence_angle)
print(f"Depth of focus is {focus_depth*1e9:.2f} nm for convergence angle {convergence_angle*1000:.1f} mrad at {e0/1000:.0f} keV")Depth of focus is 25.08 nm for convergence angle 10.0 mrad at 200 keV
Particle Flux and Current¶
It is important todetermine the order of magitude of how many electrons are hitting the sample.
The defition of an Ampere:
That definition is enough to calculate the number of electrons per time unit (flux).
# ------- Input ----
current = 150e-12 # current in Ampere
# ---------------
def current_to_number_of_electrons(current: float) -> float:
"""convert current in Ampere to number of electrons per second
Parameters
----------
current : float
current in Ampere
Returns
-------
float
number of electrons per second
"""
return current / scipy.constants.elementary_charge
number_of_electrons = current_to_number_of_electrons(current)
print(f"Number of electrons per second for {current*1e12:.1f} pA is {number_of_electrons:.2e} electrons / second")
print(f'\n at {current*1e12:.1f} pAan electron will hit the sample every {scipy.constants.elementary_charge/current * 1e9:.2f} ns ')Number of electrons per second for 150.0 pA is 9.36e+08 electrons / second
at 150.0 pAan electron will hit the sample every 1.07 ns
