- Open Access
diffpy.morph: Python tools for model-independent comparisons between sets of one-dimensional functions
Phys. Rev. Materials 10, 113801 – Published 5 November, 2026
DOI: https://doi.org/10.1103/t39r-v3lx
Abstract
diffpy.morph addresses a need to gain scientific insights from one-dimensional (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, nontrivial 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 pair distribution function data from x-rays and neutrons, though we note that it may be applied to any 1D function in principle.
Physics Subject Headings (PhySH)
Article Text
Supplemental Material
References (63)
- R. E. Dinnebier and S. J. L. Billinge, in Powder Diffraction, edited by R. E. Dinnebier and S. J. L. Billinge (Royal Society of Chemistry, Cambridge, 2008), pp. 1–19.
- T. Egami and S. J. L. Billinge, Underneath the Bragg Peaks: Structural Analysis of Complex Materials, 2nd ed., Pergamon Materials Series Vol. 16 (Elsevier, Amsterdam, 2012).
- S. J. L. Billinge and K. M. Ø. Jensen, Atomic Pair Distribution Function Analysis—A Primer, International Union of Crystallography Texts on Crystallography (Oxford University Press, Oxford, England, 2024).
- K. Pearson and F. Galton, VII. Note on regression and inheritance in the case of two parents, Proc. R. Soc. London 58, 240 (1895).
- See Supplemental Material at http://link.aps.org/supplemental/10.1103/t39r-v3lx for more physical and mathematical justifications for when one can apply the various morphs, which also contains Refs. [6, 7, 8, 9, 10, 11].
- J. M. Léger, A. Pereira, J. Haines, S. Jobic, and R. Brec, Phase transformations of polymeric -type under high pressure, J. Phys. Chem. Solids 61, 27 (2000).
- P. J. Brown, A. G. Fox, E. N. Maslen, M. A. O'Keefe, and B. T. M. Willis, Intensity of diffracted intensities, in International Tables for Crystallography Volume C: Mathematical, Physical and Chemical Tables, edited by E. Prince (Springer Netherlands, Dordrecht, 2006), pp. 554–595.
- M. L. Boas, Mathematical Methods in the Physical Sciences (Wiley, Hoboken, NJ, 2006).
- R. E. Dinnebier and S. J. L. Billinge, Overview and principles of powder diffraction, in International Tables for Crystallography (International Union of Crystallography, 2019), Vol. H, Chap. 1.1, pp. 2–23.
- L. A. Feigin, D. I. Svergun, and G. W. Taylor, General principles of small-angle diffraction, in Structure Analysis by Small-Angle X-Ray and Neutron Scattering, edited by G. W. Taylor (Springer US, Boston, 1987), pp. 25–55.
- L. C. Evans and R. F. Gariepy, Measure Theory and Fine Properties of Functions, 1st ed., Textbooks in Mathematics (Chapman and Hall/CRC, Boca Raton, FL, 2015).
- G. Tomasi, F. van den Berg, and C. Andersson, Correlation optimized warping and dynamic time warping as preprocessing methods for chromatographic data, J. Chemom. 18, 231 (2004).
- P. H. C. Eilers, Parametric time warping, Anal. Chem. 76, 404 (2004).
- Q. P. He, J. Wang, J. A. Mobley, J. Richman, and W. E. Grizzle, Self-calibrated warping for mass spectra alignment, Cancer Inform. 10, 65 (2011).
- J. Kieffer and D. Karkoulis, PyFAI, a versatile library for azimuthal regrouping, J. Phys.: Conf. Ser. 425, 202012 (2013).
- B. H. Toby and R. B. Von Dreele, GSAS-II: The genesis of a modern open-source all purpose crystallography software package, J. Appl. Crystallogr. 46, 544 (2013).
- O. Arnold, J. Bilheux, J. Borreguero, A. Buts, S. Campbell, L. Chapon, M. Doucet, N. Draper, R. Ferraz Leal, M. Gigg, V. Lynch, A. Markvardsen, D. Mikkelson, R. Mikkelson, R. Miller, K. Palmen, P. Parker, G. Passos, T. Perring, P. Peterson, et al., Mantid—Data analysis and visualization package for neutron scattering and SR experiments, Nucl. Instrum. Methods Phys. Res. Sect. A 764, 156 (2014).
- Regents of the University of California, The 3-clause BSD license (1989), https://spdx.org/licenses/BSD-3-Clause.html.
- A. Yang, C. L. Farrow, C.-H. Liu, L. Kitsu, and S. J. L. Billinge, diffpy.morph (PyPI package), 2025, https://pypi.org/project/diffpy.morph.
- conda-forge community, diffpy.morph (Conda-forge package), 2025, https://anaconda.org/channels/conda-forge/packages/diffpy.morph/overview.
- N. Lazarević, E. S. Bozin, M. Šćepanović, M. Opačić, H. Lei, C. Petrovic, and Z. V. Popović, Probing crystal symmetry by polarized Raman scattering, Phys. Rev. B 89, 224301 (2014).
- Y. Liu, H. Lei, K. Wang, M. Abeykoon, J. B. Warren, E. Bozin, and C. Petrovic, Thermoelectric studies of ( ), Phys. Rev. B 98, 094519 (2018).
- J. J. Yang, Y. J. Choi, Y. S. Oh, A. Hogan, Y. Horibe, K. Kim, B. I. Min, and S.-W. Cheong, Charge-orbital density wave and superconductivity in the strong spin-orbit coupled , Phys. Rev. Lett. 108, 116402 (2012).
- S. Pyon, K. Kudo, and M. Nohara, Superconductivity induced by bond breaking in the triangular lattice of , J. Phys. Soc. Jpn. 81, 053701 (2012).
- R. Yu, S. Banerjee, H. C. Lei, R. Sinclair, M. Abeykoon, H. D. Zhou, C. Petrovic, Z. Guguchia, and E. S. Bozin, Absence of local fluctuating dimers in superconducting , Phys. Rev. B 97, 174515 (2018).
- I.-K. Jeong, R. H. Heffner, M. J. Graf, and S. J. L. Billinge, Lattice dynamics and correlated atomic motion from the atomic pair distribution function, Phys. Rev. B 67, 104301 (2003).
- R. Yu, S. Banerjee, H. Lei, M. Abeykoon, C. Petrovic, Z. Guguchia, and E. S. Bozin, Phase separation at the dimer-superconductor transition in , Phys. Rev. B 98, 134506 (2018).
- C. L. Farrow, P. Juhás, J. W. Liu, D. Bryndin, E. S. Božin, J. Bloch, T. Proffen, and S. J. L. Billinge, PDFfit2 and PDFgui: Computer programs for studying nanostructure in crystals, J. Phys.: Condens. Matter 19, 335219 (2007).
- B. Frandsen, L. Yang, and S. J. L. Billinge, pdfttp_data, 2023, https://github.com/Billingegroup/pdfttp_data.
- E. Grüneisen, Theorie des festen Zustandes einatomiger Elemente, Ann. Phys. 344, 257 (1912).
- Y. Chang, On the temperature dependence of the bulk modulus and the Anderson-Grüneisen parameter of oxide compounds, J. Phys. Chem. Solids 28, 697 (1967).
- D. Schroeder, An Introduction to Thermal Physics (Oxford University Press, 2021).
- O. L. Anderson, Derivation of Wachtman's equation for the temperature dependence of elastic moduli of oxide compounds, Phys. Rev. 144, 553 (1966).
- S. V. Ushakov, A. Navrotsky, R. J. K. Weber, and J. C. Neuefeind, Structure and thermal expansion of YSZ and above from neutron diffraction on levitated samples, J. Am. Ceram. Soc. 98, 3381 (2015).
- P. Aldebert, Neutron and X-ray experiments at high temperature, Rev. Phys. Appl. (Paris) 19, 649 (1984).
- M. I. Ahmad, D. G. Van Campen, J. D. Fields, J. Yu, V. L. Pool, P. A. Parilla, D. S. Ginley, M. F. A. M. Van Hest, and M. F. Toney, Rapid thermal processing chamber for in-situ X-ray diffraction, Rev. Sci. Instrum. 86, 013902 (2015).
- H. Hayashi, T. Saitou, N. Maruyama, H. Inaba, K. Kawamura, and M. Mori, Thermal expansion coefficient of yttria stabilized zirconia for various yttria contents, Solid State Ion. 176, 613 (2005).
- J. A. Krogstad, Y. Gao, J. Bai, J. Wang, D. M. Lipkin, and C. G. Levi, In situ diffraction study of the high-temperature decomposition of t'-zirconia, J. Am. Ceram. Soc. 98, 247 (2015).
- M. Goyal and M. Singh, Size and shape dependence of optical properties of nanostructures, Appl. Phys. A 126, 176 (2020).
- S. H. Tolbert and A. P. Alivisatos, Size dependence of a first order solid-solid phase transition: The Wurtzite to rock salt transformation in CdSe nanocrystals, Science 265, 373 (1994).
- C. L. Farrow and S. J. L. Billinge, Relationship between the atomic pair distribution function and small-angle scattering: Implications for modeling of nanoparticles, Acta Crystallogr. A 65, 232 (2009).
- S. Banerjee, A. Zangiabadi, A. Mahdavi-Shakib, S. Husremovic, B. G. Frederick, K. Barmak, R. N. Austin, and S. J. L. Billinge, Quantitative structural characterization of catalytically active nanoparticles, ACS Appl. Nano Mater. 2, 6268 (2019).
- S. Banerjee, C.-H. Liu, K. M. Ø. Jensen, P. Juhás, J. D. Lee, M. Tofanelli, C. J. Ackerson, C. B. Murray, and S. J. L. Billinge, Cluster-mining: An approach for determining core structures of metallic nanoparticles from atomic pair distribution function data, Acta Crystallogr A 76, 24 (2020).
- S. Tao, J. Billet, J. De Roo, and S. J. L. Billinge, Rapid modeling of the local structure of metal oxide nanoparticles from PDF data: A case study using nanoparticles, Chem. Mater. 36, 10912 (2024).
- A. S. Masadeh, E. S. Božin, C. L. Farrow, G. Paglia, P. Juhás, S. J. L. Billinge, A. Karkamkar, and M. G. Kanatzidis, Quantitative size-dependent structure and strain determination of CdSe nanoparticles using atomic pair distribution function analysis, Phys. Rev. B 76, 115413 (2007).
- B. Guzelturk, J. Portner, J. C. Ondry, S. Ghanbarzadeh, M. Tarantola, A. Jeong, T. Field, A. M. Chandler, E. Wieman, T. R. Hopper, N. E. Watkins, J. Yu, X. Cheng, M.-F. Lin, D. Luo, P. L. Kramer, X. Shen, A. H. Reid, O. Borkiewicz, U. Ruett, et al., Ultrafast symmetry control in photoexcited quantum dots, Adv. Mater. 37, 2414196 (2025).
- Y. Noda, K. Masumoto, S. Ohba, Y. Saito, K. Toriumi, Y. Iwata, and I. Shibuya, Temperature dependence of atomic thermal parameters of lead chalcogenides, PbS, PbSe and PbTe, Acta Crystallogr. Sect. C 43, 1443 (1987).
- A. Yang, C. L. Farrow, C.-H. Liu, L. Kitsu, and S. J. L. Billinge, diffpy.morph, 2025, https://github.com/diffpy/diffpy.morph.
- https://groups.google.com/g/diffpy-users.
- A. Jeong, J. Portner, C. P. N. Tanner, J. C. Ondry, C. Zhou, Z. Mi, Y. A. Tazoui, B. Lee, V. R. K. Wall, N. S. Ginsberg, and D. V. Talapin, Colloidal dispersions of sterically and electrostatically stabilized PbS quantum dots: Structure factors, second virial coefficients, and film-forming properties, ACS Nano 18, 33864 (2024).
- J. Kieffer, J. Orlans, N. Coquelle, S. Debionne, S. Basu, A. Homs, G. Santoni, and D. De Sanctis, Application of signal separation to diffraction image compression and serial crystallography, J. Appl. Crystallogr. 58, 138 (2025).
- P. Juhas, T. Davis, C. L. Farrow, and S. J. L. Billinge, PDFgetX3: A rapid and highly automatable program for processing powder diffraction data into total scattering pair distribution functions, J. Appl. Crystallogr. 46, 560 (2013).
- F. Bertolotti and I. Robinson, Scientific opportunities with very hard XFEL radiation, XFEL.EU WR-2024-002 (2024).
- A. F. Sapnik, P. A. Chater, D. S. Keeble, J. S. O. Evans, F. Bertolotti, A. Guagliardi, L. J. Støckler, E. A. Harbourne, A. B. Borup, R. S. Silberg, A. Descamps, C. Prescher, B. D. Klee, A. Phelipeau, I. Ullah, K. G. Medina, T. A. Bird, V. Kaznelson, W. Lynn, A. L. Goodwin, et al., High-quality ultra-fast total scattering and pair distribution function data using an X-ray free-electron laser, IUCrJ 12, 531 (2025).
- T. Fuchs, S. P. Culver, P. Till, and W. G. Zeier, Defect-mediated conductivity enhancements in (Pn = P, Sb) using aliovalent substitutions, ACS Energy Lett. 5, 146 (2020).
- W. Decking, in Brilliant Light in Life and Material Sciences, edited by V. Tsakanov and H. Wiedemann (Springer Netherlands, Dordrecht, 2007), pp. 21–30.
- A. Galler, W. Gawelda, M. Biednov, C. Bomer, A. Britz, S. Brockhauser, T.-K. Choi, M. Diez, P. Frankenberger, M. French, D. Görries, M. Hart, S. Hauf, D. Khakhulin, M. Knoll, T. Korsch, K. Kubicek, M. Kuster, P. Lang, F. Alves Lima, et al., Scientific instrument femtosecond X-ray experiments (FXE): Instrumentation and baseline experimental capabilities, J. Synch. Radiat. 26, 1432 (2019).
- K. Kodama, S. Iikubo, T. Taguchi, and S.-i. Shamoto, Finite size effects of nanoparticles on the atomic pair distribution functions, Acta Crystallogr. A 62, 444 (2006).
- M. Lei, A. M. R. de Graff, M. F. Thorpe, S. A. Wells, and A. Sartbaeva, Uncovering the intrinsic geometry from the atomic pair distribution function of nanomaterials, Phys. Rev. B 80, 024118 (2009).
- DiffPy team, Diffpy - atomic structure analysis in Python (2025), https://www.diffpy.org/.
- P. Juhás, C. L. Farrow, X. Yang, K. R. Knox, A. Yang, and S. J. L. Billinge, diffpy.utils, 2025, https://github.com/diffpy/diffpy.utils.
- https://diffpy.org/diffpy.morph/.
- diffpy.morph authors, Data used for figures in diffpy.morph manuscript [Data set], Zenodo, 2026, https://doi.org/10.5281/zenodo.20680507.