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.

Machine-learning clustering for phase and domain mapping

A 4D-STEM dataset from a complex microstructure can contain thousands of distinct diffraction patterns: different phases, orientations, domains, and overlaps. Designing virtual detectors by hand (as in the previous module) works when you know what you are looking for; unsupervised machine learning lets the data tell you what distinct patterns exist and where they occur, with no prior assumptions about the structures present Martineau et al. (2019).

The idea

Treat each probe position as one observation (a vector of detector-pixel intensities) and ask: what small set of characteristic patterns, mixed in varying proportions, explains the whole dataset? Two families of methods are widely used:

Comparison of many clustering algorithms applied to toy 2D datasets, showing how each algorithm partitions differently shaped clusters

No single “right” clustering algorithm: the scikit-learn comparison grid shows how k-means, spectral, agglomerative, DBSCAN, Gaussian-mixture, and other methods partition the same toy datasets very differently. The same is true for diffraction data.

A typical workflow: preprocess (align the zero beam, mask the central disk or take a log/power scaling so weak reflections count, optionally bin) → reduce dimensionality → decompose or cluster → inspect the component patterns as diffraction patterns and interpret them crystallographically → refine.

Why this works so well for diffraction data

Unlike natural images, diffraction patterns from a given phase/orientation are highly reproducible; the “signal manifold” is low-dimensional. Clustering therefore tends to recover physically meaningful classes: distinct phases, orientation variants, ordered vs. disordered regions, and even subtle symmetry-breaking distortions that are hard to see by eye Kalinin et al. (2022). The output is a phase/domain map plus a library of representative patterns, obtained in minutes from datasets far too large to inspect manually:

A grid of mean diffraction patterns for each cluster found in a 4D-STEM dataset

The payoff: each cluster’s mean diffraction pattern, extracted automatically from a 4D-STEM scan. Each class corresponds to a distinct diffraction condition (a phase, orientation variant, or overlap), ready for crystallographic interpretation.

Caveats

References
  1. Martineau, B. H., Johnstone, D. N., van Helvoort, A. T. J., Midgley, P. A., & Eggeman, A. S. (2019). Unsupervised machine learning applied to scanning precession electron diffraction data. Advanced Structural and Chemical Imaging, 5(1). 10.1186/s40679-019-0063-3
  2. Kalinin, S. V., Ophus, C., Voyles, P. M., Erni, R., Kepaptsoglou, D., Grillo, V., Lupini, A. R., Oxley, M. P., Schwenker, E., Chan, M. K. Y., Etheridge, J., Li, X., Han, G. G. D., Ziatdinov, M., Shibata, N., & Pennycook, S. J. (2022). Machine learning in scanning transmission electron microscopy. Nature Reviews Methods Primers, 2(1). 10.1038/s43586-022-00095-w