PyLorentz
Python package for Lorentz TEM simulation, phase reconstruction, and ML-based analysis.
Paper: Understanding complex magnetic spin textures with simulation-assisted Lorentz transmission electron microscopy, Physical Review Applied (2021) · Code: github.com/PyLorentz/PyLorentz
PyLorentz is an open-source Python codebase for Lorentz transmission electron microscopy (LTEM). I am the original author and have maintained the package since 2020. It is widely used in the LTEM community for:
- Simulation: computing the electron phase shift of an arbitrary magnetization, such as the output of a micromagnetic simulation, with either the Mansuripur algorithm or our linear superposition method. Realistic LTEM images are then simulated with a partially coherent microscope transfer function.
- Phase reconstruction: transport-of-intensity (TIE) reconstruction from through-focal series, including separating the magnetic and electrostatic phase with flipped-sample series, single-image TIE, and automatic-differentiation reconstruction with a deep image prior (SIPRAD).
- ML-based analysis: self-supervised and simulation-trained approaches to quantitative magnetic imaging.
Simulation matters for LTEM because integrated induction maps are easy to over-interpret. They show the magnetic induction integrated along the beam, including stray fields, and are not necessarily representative of the magnetization itself.
For a taste of what PyLorentz simulates, try the interactive Lorentz TEM demo.