diffpy.morph: Python tools for model independent comparisons between sets of 1D functions
Andrew Yang, Christopher L. Farrow, Pavol Juhás, Luis Kitsu Iglesias, Chia-Hao Liu, Samuel D. Marks, Vivian R. K. Wall, Joshua Safin, Sean M. Drewry, Caden Myers, Dillon F. Hanlon, Nicholas Leonard, Cedomir Petrovic, Ahhyun Jeong, Dmitri V. Talapin, Linda F. Nazar, Haidong Zhou, Samuel W. Teitelbaum, Tim B. van Driel, Soham Banerjee, Emil S. Bozin, Michael F. Toney, Katharine Page, Naomi S. Ginsberg, Simon J. L. Billinge
TL;DR
diffpy.morph delivers a fast, model-free framework for comparing 1D spectra by applying morphs to align a morphed dataset with a target. The approach covers scaling, stretching, smearing, shifting, shape, and grid transformations, and can be chained within a regression framework to minimize residuals $R_w$ while preserving physically meaningful information. Its applications span phase-transition detection, thermal-property extraction (e.g., $\beta$ and Debye temperature), in situ thermometry, nanoparticle-shape analysis, and high-throughput data processing, all demonstrated on diffraction and PDF data from X-rays and neutrons. By avoiding explicit structural models, diffpy.morph enables real-time, interpretable insights and is extensible to other 1D signals beyond PDFs and $I(Q)$, making it a versatile tool for 1D spectral analysis. The work also provides theoretical underpinnings for lattice-expansion effects and practical guidance for using morphs in calibration, data-reduction, and rapid exploratory analysis.
Abstract
diffpy.morph addresses a need to gain scientific insights from 1D scientific spectra in model independent ways. A powerful approach for this is to take differences between pairs of spectra and look for meaningful changes that might indicate underlying chemical, structural, or other modifications. The challenge is that the difference curve may contain uninteresting differences such as experimental inconsistencies and benign physical changes such as the effects of thermal expansion. diffpy$.$morph allows researchers to apply simple transformations, or "morphs", to one of the datasets to remove the unwanted differences revealing, when they are present, non-trivial differences. diffpy$.$morph is an open-source Python package available on the Python Package Index and conda-forge. Here, we describe its functionality and apply it to solve a range of experimental challenges on diffraction and PDF data from x-rays and neutrons, though we note that it may be applied to any 1D function in principle.
