Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Practical guidance for 4D-STEM

In four-dimensional scanning transmission electron microscopy (4D-STEM), we scan a focused or nearly-parallel electron probe over a two-dimensional grid of positions on the sample, and record a full two-dimensional diffraction pattern at every position Ophus (2019). The result is a four-dimensional dataset: two real-space scan dimensions and two reciprocal-space detector dimensions.

A converged electron probe rastered over a WS2 crystal, recording a full diffraction pattern on a direct electron detector at every scan position

A 4D-STEM experiment: a converged probe is rastered over the sample (here a WS₂ monolayer with islands of additional layers), and a full diffraction pattern is recorded at every probe position.

Almost every analysis in this course (strain mapping, orientation mapping, virtual imaging, polymer orientation, pair distribution functions) starts from the same kind of measurement, and the quality of every one of them is set at the microscope, before any software is involved. Where conventional STEM integrates each pattern down to one number per detector per position, 4D-STEM keeps everything:

Conventional STEM geometry with bright field and annular dark field detectors

Conventional STEM integrates the scattered signal on monolithic bright field and annular dark field detectors. A 4D-STEM camera replaces (or supplements) these with a full image of the diffraction plane.

The fundamental trade-off: probe size vs. angular resolution

The convergence semi-angle α of the probe controls both the real-space probe size and the size of the diffracted Bragg disks. A large convergence angle gives a small probe (better spatial resolution) but large, potentially overlapping disks; a small convergence angle gives sharp, well-separated diffraction spots but a wider probe. Disk overlap begins when 2α exceeds the Bragg angle separation of adjacent reflections, so for disk-registration methods such as strain mapping we typically choose α from a fraction of a milliradian up to a few milliradians: the “nanobeam” regime, with probe sizes of roughly 1–5 nm.

Mean and single diffraction patterns recorded at convergence angles from 24 mrad down to 1.5 mrad

Mean (top) and single (bottom) diffraction patterns as the convergence semi-angle is stepped from 24 mrad down to 1.5 mrad: large angles overlap the disks into an interference-rich pattern, small angles give sharp, well-separated nanobeam spots.

Things to consider when choosing probe conditions:

Diffraction patterns with a 40 micron and a 2 micron condenser aperture, showing sharper spots and better signal-to-noise with the small aperture

Aperture choice in practice: stepping from a 40 μm to a 2 μm condenser aperture sharpens the reflections, increasing the peak signal-to-noise for the same total dose.

Detectors and cameras

Modern 4D-STEM is enabled by fast direct electron detectors Nord et al. (2020). Relevant camera parameters:

An oversaturated primary beam next to a properly exposed diffraction spot

Dynamic range in one frame: exposure that saturates the primary beam (left) can still be needed to make the weakest diffraction spots (right) countable. Check both ends before starting a scan.

Practical checklist

  1. Align the microscope and select the nanobeam aperture (often a 10–50 μm condenser aperture, or a dedicated microprobe mode).

  2. Check the probe in real space (size, shape) and the diffraction pattern (disk sharpness) before starting a scan.

  3. Set camera length so all reflections of interest fall on the detector; check the corners, not just the center.

  4. Verify counts: no saturation in the central beam, adequate signal in the weakest disks you need.

  5. Acquire calibration data: a vacuum probe image (for disk-template methods), a known calibration standard (e.g., gold nanoparticles) for pixel size and elliptical distortion, and a scan-rotation calibration.

  6. Record all metadata (accelerating voltage, camera length, convergence angle, dwell time, probe current); your future self doing the analysis will thank you.

The software ecosystem

A healthy ecosystem of open-source Python packages has grown up around 4D-STEM analysis. They overlap in places, and that is a feature: you can move data between them, cross-check results, and pick the tool whose workflow fits your problem. This module gives a whirlwind tour of the packages used in this course.

py4DSTEM

py4DSTEM Savitzky et al. (2021) is an open-source Python package for 4D-STEM analysis, developed at Lawrence Berkeley National Laboratory and by a broad community of contributors. It covers the full pipeline used in this course: file I/O across many vendor formats, calibration, virtual imaging, Bragg disk detection, strain mapping, automated crystal orientation mapping (ACOM), fluctuation microscopy, and phase contrast imaging methods including ptychography. Most of the hands-on Colab sessions today use py4DSTEM.

quantEM

quantEM is a newer open-source toolkit for quantitative electron microscopy built on PyTorch, so the same analysis code runs on CPUs and GPUs and integrates naturally with deep learning workflows. It spans imaging, diffraction, ptychography, tomography, and spectroscopy, and is under active development by several of the course instructors and collaborators (code on GitHub).

pyxem / HyperSpy

pyxem is a 4D-STEM analysis library built on the HyperSpy multi-dimensional data framework. It is particularly strong for scanning (precession) electron diffraction workflows: template-matching orientation mapping Cautaerts et al. (2022), virtual imaging, and vector-based diffraction analysis, with lazy/out-of-core processing for datasets larger than memory via Dask.

Kelvin_STEM

Kelvin_STEM is a set of fast 4D-STEM analysis tools developed by Ian MacLaren’s group at the University of Glasgow, used in this course for virtual imaging, digital dark field, and clustering workflows on large datasets.

abTEM

abTEM Madsen & Susi (2021) simulates TEM and STEM experiments from first principles: multislice and PRISM image simulation directly from atomic models, entirely in Python. Simulation matters for 4D-STEM analysis: it lets you generate test data with known ground truth, design experiments (convergence angle, thickness, tilt sensitivity), and build the diffraction template libraries used in orientation mapping.

Which tool should I use?

TaskGood starting points
Load / browse / calibrate 4D datapy4DSTEM, pyxem, quantEM
Virtual imaging (BF/ADF/custom masks)any of the above; Kelvin_STEM for speed on large data
Strain mappingpy4DSTEM, pyxem, quantEM
Orientation / phase mappingpy4DSTEM (ACOM), pyxem (template matching)
ML clustering / decompositionpyxem + scikit-learn, Kelvin_STEM
Amorphous / PDF analysispy4DSTEM, quantEM
SimulationabTEM
Ptychography / phase retrievalquantEM, PtyRAD, phaser
References
  1. Ophus, C. (2019). Four-Dimensional Scanning Transmission Electron Microscopy (4D-STEM): From Scanning Nanodiffraction to Ptychography and Beyond. Microscopy and Microanalysis, 25(3), 563–582. 10.1017/s1431927619000497
  2. Bustillo, K. C., Zeltmann, S. E., Chen, M., Donohue, J., Ciston, J., Ophus, C., & Minor, A. M. (2021). 4D-STEM of Beam-Sensitive Materials. Accounts of Chemical Research, 54(11), 2543–2551. 10.1021/acs.accounts.1c00073
  3. Nord, M., Webster, R. W. H., Paton, K. A., McVitie, S., McGrouther, D., MacLaren, I., & Paterson, G. W. (2020). Fast Pixelated Detectors in Scanning Transmission Electron Microscopy. Part I: Data Acquisition, Live Processing, and Storage. Microscopy and Microanalysis, 26(4), 653–666. 10.1017/s1431927620001713
  4. Tate, M. W., Purohit, P., Chamberlain, D., Nguyen, K. X., Hovden, R., Chang, C. S., Deb, P., Turgut, E., Heron, J. T., Schlom, D. G., Ralph, D. C., Fuchs, G. D., Shanks, K. S., Philipp, H. T., Muller, D. A., & Gruner, S. M. (2016). High Dynamic Range Pixel Array Detector for Scanning Transmission Electron Microscopy. Microscopy and Microanalysis, 22(1), 237–249. 10.1017/s1431927615015664
  5. Savitzky, B. H., Zeltmann, S. E., Hughes, L. A., Brown, H. G., Zhao, S., Pelz, P. M., Pekin, T. C., Barnard, E. S., Donohue, J., Rangel DaCosta, L., Kennedy, E., Xie, Y., Janish, M. T., Schneider, M. M., Herring, P., Gopal, C., Anapolsky, A., Dhall, R., Bustillo, K. C., … Ophus, C. (2021). py4DSTEM: A Software Package for Four-Dimensional Scanning Transmission Electron Microscopy Data Analysis. Microscopy and Microanalysis, 27(4), 712–743. 10.1017/s1431927621000477
  6. Cautaerts, N., Crout, P., Ånes, H. W., Prestat, E., Jeong, J., Dehm, G., & Liebscher, C. H. (2022). Free, flexible and fast: Orientation mapping using the multi-core and GPU-accelerated template matching capabilities in the Python-based open source 4D-STEM analysis toolbox Pyxem. Ultramicroscopy, 237, 113517. 10.1016/j.ultramic.2022.113517
  7. Madsen, J., & Susi, T. (2021). The abTEM code: transmission electron microscopy from first principles. Open Research Europe, 1, 24. 10.12688/openreseurope.13015.1