de-ebsd#
Differentiable, GPU-accelerated dynamical EBSD master-pattern simulation in PyTorch, with a composable object-oriented API inspired by abTEM.
A master pattern is the backscattered-electron intensity as a function of
crystal direction, stored on the square-Lambert grid. de-ebsd builds it from
first principles – crystal, structure factors with absorption, reflections,
Bloch-wave dynamical matrix, depth-integrated dynamical solve – with every
intermediate stage inspectable and the whole chain refinable. The physics is
ported from EMsoft
[Callahan and De Graef, 2013], which remains the validation oracle; de-ebsd does
not call EMsoft at runtime. de_ebsd.index then matches measured patterns
back to orientations, by dictionary or by spherical cross-correlation
[Lenthe et al., 2019].
User guide
Install de-ebsd, learn how the layers compose, and find the conventions the whole library depends on.
Examples
Executable end-to-end workflows: simulate a master pattern from a CIF, and index a scan back to orientations.
API reference
Every public module, class and function, generated from the docstrings, with links to the source.
Contributing
Run the tests, add an example, and understand what validation a physics change has to pass.
Install#
Python 3.11 or newer. torch comes from the CUDA 12.4 index configured in
pyproject.toml:
git clone https://github.com/directelectron/de-ebsd.git
cd de-ebsd
uv sync
See Installation for CPU-only installs and the optional groups.
import de_ebsd as de
crystal = de.Crystal.from_parameters(
a=0.5431, space_group=227, atoms=[("Si", (0.125, 0.125, 0.125))]
)
microscope = de.Microscope(energy=20e3, sample_tilt=70.0)
sim = de.MasterPatternSimulator(crystal, microscope, npx=500, dmin=0.05)
master = sim.compute(device="cuda")