Skip to main content

Advanced electron optics simulation platform for TEM/STEM/SEM column design

Project description

ColumX

Advanced Electron Optics Simulation Platform for TEM/STEM/SEM Column Design

ColumX is a comprehensive Python library for electron optics simulation, covering paraxial ray tracing, aberration calculation, wave optics, multislice propagation, crystal potentials, and full TEM/STEM column modeling. It is designed for researchers and engineers working on electron microscope column design, beam physics analysis, and image simulation.

Features

ColumX provides 20 physics modules organized into four layers:

Ray Opticsparaxial, ray3d, glaser, aberration, electrostatic_paraxial Magnetic and electrostatic lens modeling with Glaser analytical fields, adaptive-power Seidel aberration integrals (Cs < 0.04%, Cc < 0.02% vs MEBS), 5th-order aberration framework (C5, S5, Krivanek naming), and 3D relativistic Lorentz ray tracing.

Wave Opticswave, multislice, crystal Contrast transfer function with spatial/temporal coherence envelopes, STEM probe formation, FFT-based multislice propagation engine, and crystal structure module with Kirkland scattering factors for 7 built-in crystal presets (Si, Ge, GaAs, SiC, MgO, Al, Au).

Advanced Imagingstem, cbed, eels, hrtem, dpc STEM imaging chain (probe, annular detectors BF/ADF/HAADF, Z-contrast), convergent beam electron diffraction with HOLZ lines, EELS spectrum simulation with thickness measurement, HRTEM imaging (WPOA linear and multislice nonlinear), and differential phase contrast with electric/magnetic field reconstruction.

Column & Infrastructurecolumn, lens_cascade, multipole, source, deflection, coulomb, fem2d, field, instruments, constants Full TEM column simulator, multi-lens cascade with Conrady aberration propagation, multipole elements, electron gun models (thermionic/field emission/Schottky), scanning deflection, space charge and Boersch effect, 2D FEM field solver, and instrument presets (Titan, Themis, ARM200F, ARM300F2).

Documentation

See the User Guide for detailed API reference, code examples for all 20 modules, web API endpoints, and GUI usage instructions.

For the desktop GUI manual, see ColumX GUI Manual.

Installation

# Core library
pip install columx

# With GUI (PySide6)
pip install "columx[gui]"

# With web API (FastAPI)
pip install "columx[api]"

# Everything
pip install "columx[all]"

From Source

git clone https://github.com/allen-li1231/ColumX.git
cd ColumX
pip install -e ".[all]"

Quick Start

Glaser Lens

from columx import GlaserLens

lens = GlaserLens(V=200e3, B0=0.5, a=3e-3, z0=-30e-3, zf=60e-3)
print(f"Focal length: {lens.analytical_efl()*1e3:.2f} mm")
print(f"Magnification: {lens.analytical_magnification():.3f}")
print(lens.summary())

CTF and Probe

from columx import ContrastTransferFunction, STEMProbe

ctf = ContrastTransferFunction(V=200e3, Cs=1.2e-3, Cc=1.2e-3, defocus=-50e-9)
print(f"Scherzer resolution: {ctf.scherzer_resolution()*1e10:.2f} A")

probe = STEMProbe(V=200e3, Cs=1e-3, alpha=10e-3)
print(f"Probe FWHM: {probe.probe_size()*1e10:.2f} A")

Multislice Simulation

from columx import MultisliceEngine
from columx.multislice import phase_grating_potential
import numpy as np

V = np.stack([phase_grating_potential(
    nx=128, ny=128, Lx=5e-9, Ly=5e-9,
    period=1e-9, amplitude=10.0
)] * 20)

engine = MultisliceEngine(V=200e3, nx=128, ny=128, Lx=5e-9, Ly=5e-9, dz=0.5e-9)
psi_exit = engine.run(V)
dp = engine.diffraction_pattern(psi_exit)

Crystal Potential

from columx import CrystalStructure, projected_potential

si = CrystalStructure.from_preset("Si")
V_proj, info = projected_potential(si, nx=256)
print(f"MIP: {info['MIP_V']:.1f} V")

Web API

Start the REST API server:

python run_web.py
# → http://127.0.0.1:8000 (interactive frontend)
# → http://127.0.0.1:8000/docs (OpenAPI documentation)

Endpoints: POST /api/glaser/compute, POST /api/wave/ctf, POST /api/wave/probe, POST /api/multislice/simulate, POST /api/crystal/potential, POST /api/stem/probe.

Desktop GUI

Launch the PySide6 desktop application with 20 interactive panels:

python gui/columx_gui.py

Testing

cd tests
python test_all.py        # Core modules (13 modules)
python test_new_physics.py # v2.0+ modules
python test_crystal_stem.py # Crystal + STEM + CBED + EELS + HRTEM + DPC

269 tests covering all 20 modules.

Architecture

columx/
├── columx/           # 20 physics modules (13,000+ lines)
├── api/              # FastAPI REST API layer
├── web/              # Vue3 + Plotly.js frontend
├── gui/              # PySide6 desktop GUI (20 panels)
├── tests/            # 269 tests across 8 test files
└── docs/             # Architecture documentation

Validation

ColumX has been systematically validated against MEBS (Munro's Electron Beam Software):

  • Paraxial: M and theta accuracy 0.006%
  • Aberrations: Cs < 0.04%, Cc < 0.02% (200 kV, objective lens)
  • 5th order: C5 verified against Krivanek analytical values
  • MEBS compatibility: match_mebs=True mode replicates MEBS mixed relativistic convention

References

  1. Glaser, W. Grundlagen der Elektronenoptik (Springer, 1952)
  2. Hawkes, P.W. & Kasper, E. Principles of Electron Optics (Academic Press, 1989)
  3. Reimer, L. Transmission Electron Microscopy 5th ed. (Springer, 2013)
  4. Krivanek, O.L. et al. Ultramicroscopy 110 (2010) 571-585
  5. Kirkland, E.J. Advanced Computing in Electron Microscopy 2nd ed. (Springer, 2010)

License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

columx-2.3.1.tar.gz (247.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

columx-2.3.1-py3-none-any.whl (207.5 kB view details)

Uploaded Python 3

File details

Details for the file columx-2.3.1.tar.gz.

File metadata

  • Download URL: columx-2.3.1.tar.gz
  • Upload date:
  • Size: 247.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for columx-2.3.1.tar.gz
Algorithm Hash digest
SHA256 a8439ee3af28c737b2aefc24ab90b7980dab2958904f3a7e720e582c19ac3d02
MD5 2dee8f46e177b8ce739168c7e39300c3
BLAKE2b-256 442a602df197f535ed08cbfea896de9c44ac0441912dd9422f9fd6d04a2bf25e

See more details on using hashes here.

File details

Details for the file columx-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: columx-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 207.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for columx-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f316021e0b832b97800b55b21c5c2a0ffd4b236b81a67cbb8200ffacfb761379
MD5 41f8b41192829415208f478f527403ab
BLAKE2b-256 507e4b982c3c2e779e870a2a1b0605a1e0e7db2dd77dab0ce05da35e52f07d66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page