2025 AIChE Annual Meeting

(588bu) Peakyfinders: Data-Agnostic Tool for Grain Segmentation, Defect Detection and Strain Analysis in Crystalline Materials

Defects play a critical role in defining the physical properties of materials—from semiconductors to nanoparticle superlattices. Despite the ubiquity and importance of these imperfections, their analysis remains challenging due to the inherent complexity of self‐assembled crystals and the limitations of conventional characterization techniques. In this work, we introduce peakyFinders, an open‐source, Python‐based framework that exploits diffraction-based analysis to segment crystalline grains and detect defects with high spatial and temporal resolution. Our approach bridges the gap between experimental imaging and computational simulation by providing a generalizable tool capable of processing both two-dimensional and three-dimensional inputs, whether derived from particle coordinates or directly from standard image formats.

Our approach leverages Fourier-space representation to mitigate the challenges posed by thermal noise. Initially, the raw image data is converted to grayscale prior to computing the Fourier spectrum through discrete fast Fourier transforms. A key aspect of our framework is its flexible and easily tunable peak detection algorithm, which reliably identifies Bragg peaks in both two- and three-dimensional systems. By integrating a one-dimensional peak search approach with distance-based neighbor searches and network clustering, the algorithm effectively discards superfluous peaks and consolidates overlapping ones. These detected peaks are then used for grain segmentation and for analyzing strain and defects.

Once the appropriate Bragg peaks are isolated, peakyFinders applies Bragg peak filtering to user-selected peaks. This process requires zeroing out most of the image except for the target Bragg peak. and then computing the inverse Fourier transform of the filtered Bragg peak. The resulting inverse Fourier transform reveals which image segments align with the filtered Bragg peak. To segment grains, the magnitude of the inverse Fourier transform is mapped onto a sigmoid function that normalizes the output and creates domain masks delineating individual crystalline grains associated with the filtered peak. This step enables the segmentation of order associated with the selected filtered peak and facilitates the segregation of grains from the same or different crystals, or even from disordered states. Masking the original image with these domain masks allows us to obtain a clean image of the single-grained crystal, and subsequently compute a single-grain Fourier spectrum for detailed defect and strain analysis.

Defect analysis in peakyFinders follows a similar workflow based on Bragg peak filtering. Users select specific peaks for filtering, and the resulting inverse Fourier transform can be analyzed in two different ways. Phase analysis is highly sensitive to minor displacements and can detect subtle strain fields, while magnitude-based analysis offers robustness against slight inaccuracies in peak centering and can be mapped directly to particle positions for per-particle strain evaluation. In effect, we extend the well-established geometric phase analysis from electron microscopy to a broader range of systems, while introducing a magnitude-based method inspired by dark-field imaging techniques.

We demonstrate the versatility and robustness of peakyFinders through multiple case studies involving both computational and experimental datasets. Our results demonstrate effective identification of simple point defects as well as more complex disclinations and grain boundaries. The framework successfully segments grains in heterogeneous systems—including mixtures of different crystalline domains and interfaces with disordered, liquid regions—and generalizes from 2D images to 3D reconstructions without requiring system-specific modifications. Furthermore, the approach performs well on systems with non-spherical, anisotropic particles, underscoring its broad applicability.

The minimal parameter tuning requirements and the flexibility in input formats—from advanced electron microscopy images and molecular simulation snapshots to everyday phone photographs—make peakyFinders a powerful, automated tool for analyzing structural order in complex materials. Its open-source Python implementation encourages community-driven enhancements and customizations, and future developments will include a graphical user interface to further facilitate adoption by experimentalists in materials science, nanotechnology, and soft matter physics. In conclusion, peakyFinders provides a streamlined, transparent, and user-friendly approach to diffraction-based analysis for grain segmentation and defect detection. Its broad applicability across diverse systems and compatibility with both experimental and computational data make it a valuable resource for future studies investigating the relationship between structure and function in crystalline and quasicrystalline materials.