The Advanced Photon Source
a U.S. Department of Energy Office of Science User Facility

HiSPoD: Undulator White-beam Diffraction Analysis Software

Ultrafast white-beam diffraction has been developed as a complementary tool for the high-speed imaging instrument at 32-ID-B. The simultaneous ultrafast imaging and diffraction technique provides users the unique capability to study non-repeatable and/or irreversible material behaviors, which cannot be captured by the conventional pump-probe technique. In order to achieve sufficiently high temporal resolution, a polychromatic white beam is usually required for both imaging and diffraction purposes. Compared with conventional diffraction approaches using a monochromatic beam, there are two major challenges when one deals with undulator white-beam diffraction patterns recorded using an optically coupled detector:  First, the signal-to-noise ratio of the diffraction data is relatively low, necessitating the radial integration to extract 1D intensity profile for discerning the diffraction peaks. Second, peaks associated with different photon harmonic energies may co-exist on a diffraction pattern, which makes it challenging for quantitatively analyzing the data, particularly when phase transformation occurs in a sample. Further, detector placement at an oblique angles and/or placement of the detector so that the incident beam direction would not intercept the detector both complicate analysis.

To address these issues, HiSPoD was developed and the major functions of this GUI include:

  • Simulation of 2D diffraction pattern from a sample with a given set of experiment parameters
  • Analysis of 2D diffraction patterns:
  • Estimate transmission beam position
  • Define region of interest
  • Calculate map of reciprocal wavevector Q
  • Extract 1D intensity profiles I(2theta) and I(Q) via radial averaging with a given range of the azimuthal angles
  • Index (hkl) and harmonic peaks
  • Conduct batch analysis for a series of data
  • Perform curve fitting to quantify strain and phase content

HiSPoDI provides an effective tool to users of the ultrafast white-beam diffraction technique for (1) designing experiments by predicting sample diffraction patterns before the visit to the synchrotron facility, (2) optimizing parameters and adjusting work plan by quickly analyzing the experiment data on site, and (3) fully understanding the data and quantifying the results by curve fitting when back to home institution.


Distribution & Impact

HiSPoD is a stand-alone program that can run in any consumer desktop or laptop with Windows, Mac, or Linux systems with Matlab installed. The Matlab Imaging Processing Toolbox is needed in order to use all the functions of this GUI.

Source code is available for download. See the documentation ( for more details.


Funding Source

This project has been produced using operational funding from the APS, contract DE-AC02-06CH11357.


Please Cite
T. Sun and K. Fezzaa, HiSPoD: a program for high-speed polychromatic X-ray diffraction experiments and data analysis on polycrystalline samples, J. Synchrotron Rad. (2016). 23, 1046-1053. doi: 10.1107/S1600577516005804
Related Publications

M. Hudspeth, T. Sun, N. Parab, Z. Guo, K. Fezzaa, S. Luo, W. Chen, “Investigation of Material Deformation Mechanisms During High-Rate Loading via Simultaneous X-ray Diffraction and Phase Contrast Imaging”, Journal of Synchrotron Radiation, 22, (2015), 1

D. Fan, L. Lu, B. Li, M. L. Qi, J. C. E, F. Zhao, T. Sun, K. Fezzaa, W. Chen, and S. N. Luo, “Transient x-ray diffraction with simultaneous imaging under high strain-rate loading”, Review of Scientific Instruments, 85, (2014) 113902


Future Development Work

Functions for simulating and analyzing diffraction patterns from single-crystalline samples will be the major future development for HiSPoD. These functions will facilitate beamline experiments by predicting the optimum diffraction geometry, and help users analyze diffraction patterns via indexing diffraction spots, calculating lattice strain, and quantifying grain rotation and refinement.



GUI Modules:
  • “Experiment parameter”: users input the parameters associated with the detector and diffraction geometry.
  • “Sample structure”: users input the standard powder diffraction intensities of the sample. Such information can be obtained from the International Centre for Diffraction Data, in-house diffraction experiments, literature, or simulation using other software.
  • “Load files”: users load the raw diffraction data, detector background file, energy spectrum, and/or sample absorption file.
  • “Tools”: this module contains multiple tools for users to perform data analysis and simulation.

 Prerequisite parameters

  • Detector: pixel size, and data dimension
  • Sample: crystal structure, lattice parameter, and reference XRD intensities
  • Photon energy spectrum: flux versus energy
  • Sample absorption: transmission (%) versus energy. This is only needed when the experiment is in transmission geometry

 Adjustable parameters

  • Sample-to-detector distance: the shortest distance from the sample to the detector plane
  • Detector angle: the angle from incident direction to the detector plane surface normal
  • Direct beam X and Y pixel positions: typically X is negative and Y is positive
  • Number of harmonic: meaning how many x-ray harmonic energies users would consider when simulating “Schematic” diffraction pattern and labeling I(tth) curve
  • Scaling factor: meaning n by n image binning when doing data analysis and simulation. The smaller the number, the faster the processing and yet the lower the resolution


  • 2D diffraction pattern under the given experiment condition (without noise). The “schematic” pattern show only peak positions with counting the selected harmonic energies, while the “realistic” pattern will consider the energy spectrum, reference diffraction intensity, and absorption effect.
  • 1D intensity profiles I(tth) and I(q) with all peaks labeled