Note
Go to the end to download the full example code.
Explore STEM zone axes with lines and spots#
Load a crystal, rotate it, and follow geometric Kikuchi lines toward a zone axis while watching the kinematic spot pattern. Both layers share a forward gnomonic projection and can be switched on or off independently.
No master pattern or transport calculation is needed. Intensities are relative elastic kinematic values, not a quantitative simulation of STEM Kikuchi contrast, thickness-dependent dynamical diffraction, or convergent-beam discs.
Use a live Jupyter notebook for the controls and linked rotation. A standalone HTML figure is a snapshot: its camera can move locally, but recalculating the linked patterns requires a Python kernel or application bridge.
import de_ebsd as de
Silicon uses a symmetry-expanded diamond structure. Lengths are in nm; the explorer’s beam-energy control is explicitly in keV.
crystal = de.Crystal.from_parameters(
a=0.5431, space_group=227, atoms=[("Si", (0.125, 0.125, 0.125))]
)
explorer = crystal.explore(energy_kev=200, dmin=0.1)
explorer.set_zone_axis((0, 0, 1))
explorer
/home/runner/work/de-ebsd/de-ebsd/.venv/lib/python3.13/site-packages/diffsims/utils/discretise_utils.py:86: SyntaxWarning: invalid escape sequence '\m'
.. math:: y\mapsto sum_i a[i]*exp(-b[i]*|y|^2)
/home/runner/work/de-ebsd/de-ebsd/.venv/lib/python3.13/site-packages/diffsims/utils/discretise_utils.py:616: SyntaxWarning: invalid escape sequence '\m'
Continuous atom is represented by: `y\mapsto sum_i a[i]*exp(-b[i]*|y|^2)`
CrystalExplorer(energy_kev=200, dmin=0.1, orientation=[1.0, -3.0616169978683824e-17, 3.0616169978683824e-17, 9.373498641636607e-34])
Hosts such as SpyDE can mount this same native anyplotlib figure and retain the explorer object to keep its Python callbacks alive.
figure = explorer.figure
figure
The same controls are available from Python. These small tilts move away from [001]; reset returns to the starting orientation. Setting roll rotates the screen basis about the beam, and the two layers stay registered.
explorer.set_fine_tilt(tilt_x_deg=0.2, tilt_y_deg=-0.1)
explorer.set_roll(15)
explorer.set_show_lines(False)
explorer.set_show_lines(True)
explorer.reset()
CrystalExplorer(energy_kev=200, dmin=0.1, orientation=[1.0, 0.0, 0.0, 0.0])
Total running time of the script: (0 minutes 0.596 seconds)