Partially coherent start-to-end simulations of ptychography at synchrotron light sources
Abstract
We present improvements in the Synchrotron Radiation Workshop code enabling efficient modeling of start-to-end ptychography imaging experiments, explicitly addressing partial coherence and source and optics instabilities. Leveraging enhancements to SRW’s GPU-accelerated computing support, we simulate the full experiment – from radiation generation to iterative reconstruction – under realistic conditions, with models supporting both storage-ring and x-ray free-electron laser sources. Partial coherence effects, critical for storage ring-based beamlines, are modeled using electrodynamics calculations and coherent mode decomposition in SRW with 2D simulations, while XFEL cases employ the Genesis code for calculation of fully coherent, polychromatic 3D pulses from the source. Radiation propagation through realistic beamline and diffractive optics is performed via SRW’s physical optics methods in both cases. The computational cost of these simulations is driven by the large wavefront meshes required by diffractive optics, together with repeated propagation over many coherent modes or three-dimensional source wavefronts and hundreds of ptychographic scan positions. We characterize GPU implementations of the dominant large-mesh SRW operations, including free-space propagation, zone plate propagation, and wavefront resizing. On an NVIDIA A100 GPU, the dominant propagation operations are accelerated by two to three orders of magnitude relative to a single CPU core, while roofline and memory measurements identify memory bandwidth and capacity as important limits to further scaling. A complete synthetic ptychographic scan and reconstruction demonstrates the start-to-end workflow. These developments provide the computational foundation for detailed studies of partial coherence and beamline instabilities and enable higher-fidelity physical-optics modeling for experiment and beamline design at storage-ring and XFEL light sources.