The scattering of light, X-rays, electrons or neutrons by matter is used widespread for structural characterization from atomic to macroscopic length scales. With the advent of high-brilliance beam sources and the development fast, large area pixelated detectors, scattering patterns are now acquired at unprecedented frame rates and frame sizes. The slow analysis of these scattering patterns has evolved into a severe bottleneck retarding scientific insight.
Here, we present an algorithm that is based on the use of hypergeometric functions to rapidly compute 1D- and 2D-scattering data. Hypergeometric functions provide a simple mathematical description of geometrical objects, have analytical Fourier transforms, and can be rapidly computed via series and asymptotic expansions with recursive coefficients. Compared to numerical integration schemes we observe gains in computation speed of > 10^5. The algorithms can be efficiently implemented in GPUs for further acceleration.
The algorithm provides the necessary computational speed to calculate scattering patterns on timescales required for real-time experiment feedback, the analysis of large volumes of scattering data, and for the generation of training data sets for machine learning. It enables the computation of 2D scattering patterns at > 1 fps even for current 4k pixel detectors.