In this work, we demonstrate the first implementation and validation of the GPSR methodology for complete 6-dimensional phase space reconstruction using standard beamline elements commonly available at accelerator facilities2,40,41, including accelerating cavities and dipole magnets. Through both simulation and experiment at the user facility, Pohang Accelerator Laboratory X-ray Free Electron Laser (PAL-XFEL)6,7,42, we show that a combination of quadrupole scans, dispersive measurements, and the accelerating cavity phase scans provides sufficient information to reconstruct the detailed 6-dimensional phase space distribution of the beam including complex and nonlinear features. Furthermore, we conduct the first experimental validation of the reconstruction methodology by accurately predicting independent, downstream experimental measurements of the beam phase space, such as a longitudinal phase space (LPS) and transverse-energy correlations at the end of the beamline (located approximately 27 m from the reconstruction region) excluded from the training process. These downstream observations are the best evidence of GPSR predictive accuracy, revealing that the reconstructed phase space closely approximates the ground truth physical distribution. This work shows that the reconstruction framework enables efficient, high-fidelity 6-dimensional phase space diagnostics using only standard elements, and establishes a foundation for predictive diagnostics in a wide range of accelerator facilities.
Previous 6-dimensional phase space reconstructions relied on the dipole magnets and TCAVs to directly measure the longitudinal correlations. In contrast, we show in this demonstration that these correlations can be extracted using only the dipole magnets and accelerating cavity readily available in most accelerator facilities. Here, we should note that the methodology is not limited to this particular setup, but can be adapted to other standard beamline configurations that establish phase space correlations.
The key insight of the methodology can be conceptualized as a decomposition of the full reconstruction process into several components, each informed by physical measurements along the beamline. First, the 4-dimensional transverse phase space is reconstructed using quadrupole scans and transverse beam distributions measured at a screen along the straight beamline. Here, we note that 6-dimensional phase space of the beam is described by with , where indicates normalized momentum in (x, y, z) plane; normalized by where indicates the electron mass. where is the reference particle's longitudinal momentum. Subscripts i and f denote initial and final states, associated with the beam before and after the propagation to the beamline. The reconstructed transverse phase space is then adopted as a constraint in the analysis of the dispersive measurements. Accordingly, the horizontal beam distribution observed at the same screen with the bunch compressor dipole magnets activated allows inference of the fractional energy deviation through the dispersive measurement, as described in Eq. (1).
where , are transfer matrix components and is a dispersion, which are all determined by the beamline optics. Therefore, through the GPSR process with measurements in straight line and dispersive section, 5-dimensional phase space becomes resolved.
To recover the longitudinal coordinate , we utilize the energy modulation generated by the accelerating cavity. As the beam propagates through the cavity, its energy evolves as
where and are wavenumber and phase of the accelerating cavity, respectively. and are initial and final energy distributions. By activating or deactivating the accelerating cavity, we can clearly obtain the change of the beam energy that is related to the fractional energy deviation . This enables reconstruction of the 1-dimensional projected distribution associated with .
To further resolve the correlation between and including longitudinal phase space information, we perform RF phase scans. These phase scans modulate the energy gain along the beam as depicted in Fig. 1b, leading to the longitudinal phase space rotation that allows the extraction of second-order moments. This procedure is conceptually analogous to quadrupole scans in the transverse plane, where beam envelope evolution is used to calculate the transverse emittance. Finally, by incorporating the quadrupole and cavity phase scans into the GPSR training process, we can achieve full 6-dimensional phase space reconstruction using only standard beamline elements.
In particular, since the 5-dimensional phase space is explicitly determined by measurements, the reconstruction of the longitudinal coordinate is strongly constrained by the intrinsic correlations described in Eq. (2). Thus, this reconstruction process enables recovery of additional correlations associated with , yielding a solution that closely approximates the 6-dimensional phase space of the beam. Thus, it has direct implications regarding prediction accuracy and uncertainty of the reconstruction. We will investigate these factors with independent downstream measurements in the following sections.
A schematic of the beamline elements used in the demonstration is shown in Fig. 1c. We used an X-band RF accelerating cavity (XLIN) to obtain controlled energy modulations, which is typically used to linearize the nonlinear energy chirp and compensate for nonlinearity in bunch compressors. For the transverse phase space rotation, we used Q1 quadrupole magnet. We used the first two dipole magnets in the bunch compressor (BC) section. Particularly, the BC is mounted on the movable stage support, allowing it to be configured into a straight line. In this configuration, we can measure the projected (x, y) beam distributions at the straight and dispersive sections with the screen 1 (See Methods for more details on the experimental setup).
Downstream of the GPSR section [see Fig. 1d] comprises 3 quadrupole magnets, S-band TCAV, spectrometer magnet, and the screen. This section is mainly used to measure the longitudinal phase space [e.g., Fig. 1e] and other position-momentum correlations to investigate the prediction accuracy with independent downstream measurements. It should be highlighted that that all downstream measurements are not included in the training process and used solely for validation. Total length of the beamline from the Q1 to screen 2 is roughly 27 m.
In the data acquisition, we sampled beam distributions using a combination of 16 Q1 magnet strengths and 8 XLIN phase settings (see Methods for more details of the setup). An additional setting with the XLIN cavity turned off was included to obtain the initial correlations of the beam before manipulation by the XLIN cavity. Accordingly, there are a total of 9 XLIN phases. For each beamline configuration, we took 15 shots at a repetition rate of 2 Hz with a charge window within % of the nominal bunch charge of 250 pC. The measured images were then averaged, and then resulting beam distribution was used as a data sample for the reconstruction process. The total number of data samples was , where the factor of 2 corresponds to the configuration of the bunch compressor dipole magnets (BC ON/OFF). It was then split in half to create a training dataset (144 samples) which was used to reconstruct the beam distribution, and a test dataset used to validate the accuracy of reconstruction predictions.
The training dataset generated during the experiment was then combined with a differentiable model. The differentiable beam dynamics simulation was built using the Bmad-X Python library, which implements up to second order beam tracking through the RF and magnetic elements using backwards differentiable calculations in PyTorch. In this simulation, collective effects such as space charge or coherent synchrotron radiation (CSR) effects were neglected, as simulations using the elegant code indicated that these effects have negligible impact in this region of the beamline.
Initial training was performed using the full set of 144 training samples with 2,400 iterations (See Methods for details of the reconstruction setup). We subsequently confirmed that the comparable GPSR performance can also be achieved using a reduced dataset and training iterations; it took approximately 30 minutes for 1,000 iterations on an NVIDIA A100 GPU at NERSC, where we used the dataset from only 5 XLIN phases (80 samples). Accordingly, we will show the reconstruction results using reduced number of data samples.
Prior to the experimental demonstration, we conducted a simulation-based validation of the reconstruction methodology using the beamline configuration described above. We evaluated the accuracy on three representative 6-dimensional phase space distributions: i) a coupled Gaussian beam distribution, ii) a nonlinearly structured beam containing a double-horn energy profile, and iii) a realistic beam distribution obtained from upstream beam dynamics simulations of the nominal PAL-XFEL beamline. We found that the reconstruction methodology under the similar parameter scan conditions as in the experiment was able to accurately reconstruct qualitative and quantitative features of the beam. The simulated data analysis are shown in the Supplementary Figs. 4-15. In addition, we emphasize that the prediction of particle samples from a 6-dimensional phase space distribution is produced through the reconstruction process, which can be used to make predictions of beam dynamics or beam properties at different beamline settings or at different locations along the beamline.
First, Fig. 2 shows a comparison between experimental measurements and reconstruction predictions for a subset of training and test settings at the screen 1. In this figure, the colormap image in a(b) represents the measurement(prediction) [see Supplementary Figs. 1,2 for comparisons of full datasets]. In case of the dispersive measurements with the XLIN turned off (top row), small discrepancies are observed between the predicted and measured distributions, likely due to the low signal-to-noise ratios (SNR) or RF phase drift of accelerating cavities upstream of the demonstration section. However, these small deviations do not compromise the ability of the trained model to capture detailed features of the beam, and they further demonstrate the robustness of the methodology in the presence of measurement noise.
Overall, the reconstructed beam distribution successfully reproduces shape and density of the measured distributions, including nonlinear features such as asymmetric tails. In addition, we observed a clear modulation of the beam centroid position as the XLIN cavity phase varies. This modulation indicates the energy-dependent change in beam trajectory with the fixed magnetic field of the dipole magnets, which highlights capabilities of the reconstruction methodology to infer the energy changes associated with the longitudinal coordinate from transverse beam measurements only.
In addition to analyzing the training and test datasets, a critical component of validating the methodology is the comparison of reconstructed beam characteristics with independent downstream measurements that are completely excluded from the training process. We propagated the reconstructed 6-dimensional distribution through the remainder of the beamline using the elegant simulation code, which takes into account collective and nonlinear optical effects such as such as wakefields in RF cavities, coherent synchrotron radiation, and chromatic aberrations. The resulting predicted beam distributions were then compared with experimental measurements at the screen 2, located 27 m downstream from the reconstruction point. These measurements were obtained using a combination of quadrupole magnets, S-band TCAV, and spectrometer dipole as shown in Fig. 1c.
Figure 3 presents a comparison between simulated predictions and experimental measurements of the longitudinal phase space and correlations under a variety of beamline conditions (see Methods for details on screen 2 measurements and Supplementary Fig. 3 for additional comparisons). The image observed at the screen 2 represents the projected distribution in the transverse plane by means of the TCAV and spectrometer magnet. This implies that focusing effects by quadrupole magnets located around the diagnostic region introduce additional transverse correlations on the beam, distorting the projected mapping. Thus, the measured image is a result of both longitudinal and transverse phase space projections.
Despite these inherent complexities of downstream measurements, the reconstructed beam distribution accurately predicts the 1-dimensional projected histograms along the longitudinal coordinates z and , showing excellent agreement with experimental measurements. In addition, the 2-dimensional phase space densities obtained from the reconstruction almost match the measured distributions, successfully capturing nonlinear correlations and rotation of the longitudinal phase space. The reconstruction also recovers key features of the beam before the manipulation by the XLIN cavity including bunch length compressions, when the entire bunch compressor section is active (see horizontal axis z in Fig. 3a-j).
Furthermore, the reconstruction successfully reproduces transverse-longitudinal correlations as shown in Fig. 3k-o, which were obtained by turning off the TCAV [see also Supplementary Figs. 6, 10, and 14, which illustrate other correlations from simulated demonstrations, such as and ]. Although slight discrepancies between predicted and measured 1- and 2-dimensional projections are observed in some cases, these are minor relative to the overall beam structure. Whether such deviations originate from the trained model or imperfections in the simulation of the beamline compared to the actual experimental setup remains a subject of future work as an uncertainty quantification of the reconstruction. In particular, it is expected that consideration of collective effects in RF cavities and bunch compressors during the training process would provide more accurate reconstruction, leading to the improvement of the uncertainty when the beam is propagated to the downstream beamline for prediction.
Nevertheless, these results confirm that the reconstruction methodology is able to accurately predict independent downstream measurements, demonstrating not only the robustness of the predictive diagnostics, but also that the initially reconstructed distribution can be considered close approximation to the actual physical beam. Thus, this validation indicates that predictive diagnostics are applicable at any beamline locations along the reconstruction section. In addition, the reconstructed phase space can be used with non-differentiable simulations that fully consider nonlinear collective effects; it can be used as a target or an input to calibrate the simulation model of the upstream beamline and further downstream lattice for the predictive diagnostics.
Finally, Fig. 4 illustrates the reconstructed 6-dimensional phase space of the beam at the entrance to the Q1 magnet. Figure 4a shows 2-dimensional projections of the beam distribution, providing a comprehensive view of the correlations among all beam coordinate axes, while Fig. 4b shows a subset of 3-dimensional projections along coordinate axes. The reconstruction predicts non-linear tails in the transverse dimensions and accurately reproduces the nonlinear energy chirp, as observed by direct measurements shown in Fig. 3. In case of the phase space regarding , the center position is slightly shifted by 0.07%, which corresponds to 0.2 MeV energy deviation compared to the reference energy of 260.5 MeV (See Methods on how to determine the reference energy). Therefore, this reconstruction suggests that a more accurate phase space can be obtained by slightly adjusting the reference energy of the beam, such that the reference energy and longitudinal position of the reconstructed phase space are shifted toward the center.
We also calculated ensemble-averaged quantities of the beam as summarized in Table 1. These predicted values of the 6-dimensional reconstruction are quantitatively consistent within 10% of those obtained by 4-dimensional phase space reconstructions using the GPSR analysis procedure outlined in Ref.. For the longitudinal phase space at the end of the beamline, the reconstructed values agree well with conventional calculations of longitudinal bunch properties, such as the RMS longitudinal bunch length, momentum deviation, and emittance (where uncertainty estimates come from systematic uncertainties in image thresholding, see details in Methods). Finally, the RMS slice energy spread-a critical quantity of interest for XFELs-is predicted to be 0.01%, which is consistent with typical values observed during normal operations at the PAL-XFEL.
In addition, we investigated the uncertainty of the reconstructed phase space by performing multiple training runs under different configurations of the number of iterations and data samples. We considered 3 cases additionally: i) training with all 144 datasets for 2,400 iterations, ii) training with the same datasets for 1,200 iterations, and iii) training with 80 datasets using different XLIN phase settings for 1,000 iterations. The reconstructed beam parameters listed in Table 1 in parentheses indicates the averaged values with standard deviation . In addition, contour lines in Fig. 4a show specific percentiles of the phase space distributions. In the third case, correlations regarding x are somewhat deviated compared to the other cases, implying that the chosen cavity phases may not have been optimal to get beam correlations during the training. Nevertheless, the overall results show that the reconstruction methodology provides well converged values, exhibiting low sensitivity to random seeding variations. Furthermore, we found that the predicted beam distributions for those cases also remain in qualitative agreement with the experimental measurements.