Scanning Precession Electron Diffraction (SPED) data processing pipeline, developed as part of TFY4520 Nanotechnology Specialization Project at NTNU. This code base was developed as part of my project thesis, and has dynamically grown as I needed functionality. More documentation and code refactoring might or might not happen.
Run python factorize.py <parameter file.txt>
to run the processing steps defined in <parameter file.txt>
of which some examples are included in the runs
directory. The script splits the input SPED data file into sections of size given by the parameter file and processes them one by one. Each section is preprocessed as specified in the parameter file (currently background removal with the gaussian difference method or a h-dome subtraction, and applying an affine transform). Then the data is characterized by each of the processing methods (defined in the methods
directory). See the docstring for each of the methods for which parameters they require. The resulting factorization (or phase/orientation data for template matching) is saved for each chunk individually. https://github.com/shogas/sped_project_thesis_figures can then be used to create figures for analysis.
The currently implemented methods are (1) Non-negative Matrix Factorization (NMF), optionally after applying a cepstrum transform, (2) clustering using UMAP for dimensionality reducton and HDBSCAN for clustering, and (3) template matching using the functionality implemented in pyXem. I have a Jupyter notebook implementing some of the same functionality for a quick introduction to the methods.