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. 2022 Jul:237:113517. doi: 10.1016/j.ultramic.2022.113517. Epub 2022 Mar 29.

Abstract

This work presents the new template matching capabilities implemented in Pyxem, an open source Python library for analyzing four-dimensional scanning transmission electron microscopy (4D-STEM) data. Template matching is a brute force approach for deriving local crystal orientations. It works by comparing a library of simulated diffraction patterns to experimental patterns collected with nano-beam and precession electron diffraction (NBED and PED). This is a computationally demanding task, therefore the implementation combines efficiency and scalability by utilizing multiple CPU cores or a graphical processing unit (GPU). The code is built on top of the scientific Python ecosystem, and is designed to support custom and reproducible workflows that combine the image processing, template library generation, indexation and visualization all in one environment. The tools are agnostic to file size and format, which is significant in light of the increased adoption of pixelated detectors from different manufacturers. This paper details the implementation and validation of the method. The method is illustrated by calculating orientation maps of nanocrystalline materials and precipitates embedded in a crystalline matrix. The combination of speed and flexibility opens the door for automated parameter studies and real-time on-line orientation mapping inside the TEM.

Keywords: GPU acceleration; Open source; Orientation mapping; Precession electron diffraction; Scanning/transmission electron microscopy; Template matching.