Introduction

X-ray free-electron lasers, with brilliance ten orders of magnitude higher than synchrotrons, continuous tunability over the soft and hard x-ray regimes and sub-femtosecond pulse duration1, have emerged as a powerful tool both to explore fundamental nonlinear x-ray interactions in isolated atomic and molecular systems2,3,4,5,6,7 and, to follow photoinduced electronic and nuclear dynamics on their intrinsic femtosecond timescales via pump/probe techniques8,9. For the latter objective, core-level x-ray transient absorption (XTAS) with ultrafast x-ray pulses has become a workhorse - it projects core electronic states onto unoccupied valence/Rydberg states, thereby capturing the evolution of valence electronic motion following an excitation pulse. However, the realization of XTAS is challenging at x-ray free-electron lasers (XFELs) where the x-ray pulses with bandwidth ΔE/E ~ 1%, typically produced by self-amplified spontaneous emission (SASE), have spiky temporal and spectral profiles that vary stochastically on a shot-by-shot basis10,11,12,13,14. The traditional approach for XTAS with XFELs is to monochromatize the SASE beam15,16 and scan the monochromatic beam (ΔE/E ~0.01%) across the desired spectral range. This makes inefficient use of the full XFEL beam, imposes limits on-time resolution via the uncertainty principle, and, by reducing the pulse intensities, hampers the realization of nonlinear x-ray spectroscopies. An alternative approach is to monitor the incident and transmitted intensity to obtain an absorption spectrum, IT(ω)/I0(ω), across the entire SASE bandwidth. With this approach, one may realize experimental techniques employing correlation analysis that take advantage of the intrinsic stochastic nature of XFELs pulses17,18,19,20. By using pulses with uncorrelated fluctuations one can leverage the noise such that each repetition of the experiment, i.e., each XFEL shot, represents a new measurement under different conditions. As an example, spectral ghost imaging has been applied to obtain an absorption spectrum with an energy resolution better than the averaged SASE bandwidth21,22. In general, the characterization of the incident pulses is essential to this class of covariance spectroscopies as previously demonstrated in the UV regime23.

Several diagnostic tools have demonstrated well-resolved spectral measurements on a single-shot basis without compromising the quality of the x-ray beam. A commonality is the use of optical elements to split the incident x-ray beam into reference and sample beams. Beamsplitters for hard x-rays use crystal Bragg diffraction24,25 while diffraction gratings are used for soft x-rays26,27. An alternative is to use photoionization of dilute target gas and measure the kinetic energy of ejected photoelectrons to retrieve the incident photon spectrum via the photoelectric effect28,29,30. Indeed, the use of an array of 16 electron time-of-flight spectrometers (eTOFs) radially distributed about the propagating x-ray beam and hereafter referred to as the photoelectron spectrometer array, (PES array) has enabled the measurement of the position, polarization, and central energy of an x-ray photon beam as demonstrated at the PETRA-P04 beamline28. At XFELs, while it is straightforward to measure the central photon energy with the PES array29 as has been demonstrated for two-color x-ray pulses31 and to obtain simultaneously polarization diagnostics32,33, it is more challenging to obtain single-shot spectra with an energy resolution comparable to a grating spectrometer.

Here we use a ghost-imaging algorithm to improve the energy resolution of the raw PES array measurements. Thousands of SASE spectra were measured simultaneously by the PES array and a grating spectrometer and ghost imaging was applied to compute the response matrix of the PES array. The response matrix was then used to reconstruct the x-ray spectrum with energy resolution improved from ~1 to 0.5 eV at central energy of 910 eV for a resolution of ΔE/E ~1/2000 under the present conditions. This response matrix derived from ghost imaging also provides predictive power for the spectral profile of yet-to-be-measured XFEL pulses.

Results

Spectral ghost imaging

Ghost imaging is an experimental technique, which uses statistical fluctuations of an incident beam to extract information about an object using a beam replica that has not physically interacted with the object34. It can be used in the spatial35,36,37, temporal18, and spectral21,22 domains. Traditional ghost imaging requires a beamsplitter to separate the incident beam into two replicas, the object beam and the reference beam. The object beam interacts with the sample and a low-resolution detector is used to measure the signal whose intensity is proportional to the interaction and the incident beam. The reference beam is directly measured by a high-resolution detector to extract knowledge of the incident beam. The incident light source varies shot-by-shot and numerous measurements are carried out to calculate the correlation function between the two signals from the object and the reference beams. The correlation function of the measurements is analyzed to extract information about the sample. The advantage of ghost imaging is that the object beam does not necessarily need to be strong—thus protecting the samples from radiation damage. In addition, due to the fluctuations of the light source and correlation analysis, ghost imaging is robust to noise and background signals.

Ghost imaging essentially maps the high-resolution signal onto the low-resolution one, making it an ideal tool to calibrate devices with high resolution. The correlation function generated by ghost imaging contains information on the response of a device to the different incident signals. This extracted information can be further used to correct defects or discrimination present in a device. The ghost imaging calibration method reconstructs a high-quality signal that achieves resolution beyond the low-resolution instrumental limit. The stochastic nature of a SASE XFEL makes it well-suited for ghost imaging in the temporal and spectral domains. Here, ghost imaging is used to calibrate the eToFs of the PES array and obtain a response matrix, which is then applied to reconstruct a more accurate incident x-ray spectrum. One challenge for applying the ghost imaging method in the x-ray regime is the requirement of a beamsplitter. Although x-ray beamsplitters are available as mentioned above, the noninvasive gas-target measurement is suitable to replace the function of the beamsplitter.

Experimental procedure

The energy spectrum of the incident x-ray beam was characterized noninvasively by photoionization of dilute neon gas at the center of an array of 16-eToFs, i.e., the PES array29 as shown in Fig. 1. The arrival times of Ne 1s photoelectrons were measured by the eToFs located in the plane perpendicular to the beam propagation direction (see Supplementary Note 1). The ion and electron optics program SIMION was used to carry out trajectory simulations given the drift tube length and retardation voltages and thus establish a traditional calibration between the electron time-of-flight and kinetic energy, Ek. The incident photon energy was derived by adding the Ne 1s binding energy, 870 eV, to the measured Ek. The spectrum obtained by the PES array for several random shots using this traditional method is shown in Fig. 1 as the object measurement. Under the present experimental conditions, the energy resolution achievable by the PES array was around 1 eV, which is not comparable to the high-resolution grating spectrometer measurement where 0.2 eV FWHM (ΔE/E) can be readily achieved.

Fig. 1: Schematic of the experimental layout and elements of ghost imaging.
figure 1

Self-amplified spontaneous emission (SASE) x-ray free-electron laser (XFEL) pulses first interact with dilute neon gas in the photoelectron spectrometer (PES) array where the kinetic energies of 1s photoelectrons are measured by the array of electron time-of-flight spectrometers (eToFs). These kinetic energies are used to produce the electron-derived spectrum that forms the object measurement. The transmitted x-ray pulse is then focused on the variable-line spacing (VLS) grating by a spherical mirror and dispersed on a YAG:Ce crystal. The induced fluorescence is recorded by a charge-coupled device (CCD) as a 2D image from which we extract the single-shot reference measurement.

After passing through the PES array, the same FEL beam was characterized by a spectrometer based on a VLS grating and a Ce:YAG screen as shown in Fig. 1 as the reference measurement. The PES array contains very dilute gas which does not attenuate or otherwise alter the x-ray beam. Thus, ideally, the same spectrum would be obtained from the electron (PES array) and photon (grating spectrometer) measurements. However, the measurement of a single random shot reveals differences. The grating spectrometer resolution is much higher than the resolution of the PES array, thus creating a large deviation between the two spectra. The use of ghost imaging to retrieve a response matrix which is then used to improve the performance of the PES array measurements is demonstrated in the following.

Principle of reconstruction

Theoretically, the photoelectron signal c (after normalization to the gas density) is proportional to the incident photon spectrum s as measured by the spectrometer

$$c=As$$
(1)

where A relates the PES array signals to the incident photon spectrum, is an (m × n) matrix with the PES array time-of-flight (ToF) points m = 137 and the spectrograph pixels n = 1900 in the region of interest between 895 and 920 eV. This equation resembles the basic equation in ghost imaging and is usually used to obtain sample information by solving for A. However, in order to predict the incident spectrum based on PES array measurements, we formally write equation (1) as

$$s=Rc$$
(2)

where the response matrix R is related to matrix A. R maps the low-resolution PES array measurements to high-resolution grating spectrometer measurements. In other words, R is a calibration matrix that contains information on the characteristics of the eToFs. After retrieving the response matrix R, according to equation (2), it can be used to generate a high-resolution spectrum with the intrinsic defects and broadening of the PES array removed.

Ghost imaging reconstructed spectrum

To solve equation (2), we take advantage of the N independent measurements obtained. Each shot gives a realization of si and cj in equation \({s}_{i}=\mathop{\sum }\nolimits_{j = 1}^{m}{R}_{ij}{c}_{j}\) with m unknown variables Rij. Combining all measurements gives N independent linear equations which can be solved to uniquely determine the unknown variables if N > m. Instead of directly solving these equations, the response matrix elements are determined by least square regression, i.e. by minimizing the quantity s − Rc2. Single-photon Ne 1s ionization exhibits a dipole angular distribution pattern due to the linear (horizontal) polarization of the x-rays and the spherical 1s electron orbital. To increase the signals, we combined six eToFs near the polarization direction which have strong 1s peaks, to form the PES array measurement vector c with dimension m = 6 × 137 = 822.

The calculated PES array response matrix using all shots (N = 15,337) is shown in Fig. 2. Compared with the traditional calibration function, which just maps ToFs onto kinetic energy, here we retrieved a matrix whose values represent the sensitivity of the PES array to photons of different energy. As expected, there are six different calibration lines connecting the eToFs to spectrograph pixels. The lineshape, with both positive and negative contributions, corrects the instrumental broadening. One eToF does not work well and gives relatively small signals. We tried different regression optimizers and got essentially the same response matrix, demonstrating the robustness of our method. As discussed below, the response matrix can be used to obtain a better spectrum. Note that one can quickly obtain the traditional calibration lines of eToFs, by fitting the lines within a nonconverged response matrix obtained by using only 1500 shots.

Fig. 2: The response matrix for the photoelectron spectrometer (PES) array.
figure 2

The response matrix, R (Eqn. (2)), was computed with data from six electron time-of-flight spectrometers (eToFs), the corresponding photon spectra from the variable-line spacing (VLS) spectrometer and all the available shots N = 15,337. Each of the eToFs produces a distinct curve (red line) mapping the time-of-flight to the photon energy measured by the VLS spectrometer. The intensity at specific photon energy, i.e., spectrograph pixel, is comprised of contributions (positive and negative) from each of the six eToFs.

It is reasonable to assume the response matrix of the PES array does not change for given photon energy, gas target, photoelectron energy range, and PES array configuration (fixed retardation, bias voltage...); thus R can be used to predict the spectra of new shots. Higher-resolution electron spectra sr can be reconstructed by multiplying the response matrix R by the PES array measurement c according to equation (2). As illustrated in Fig. 3, the peak profile and intensities of the PES array data (a) are changed after multiplying the matrix with the PES array measurement (b).

Fig. 3: Improved single-shot spectral retrieval using the ghost-imaging algorithm.
figure 3

Single-shot electron spectra before (a) and after ghost-imaging reconstruction (b) are shown in blue compared to photon spectra in red. Top panel (a) shows the raw electron-based spectrum from a single eToF (blue dashed line) and grating-based photon spectrum (red solid line). Lower panel (b) shows the ghost-imaging-reconstructed electron spectrum (blue dot-dashed line) and the photon spectrum after convolution with a Gaussian (\({e}^{-{x}^{2}/(2{\sigma }^{2})}\) with σ = 0.2 eV (red solid line).

The photon spectrum in Fig. 3b was convolved with a Gaussian function with σ = 0.2 eV to compare with the ghost-imaging-reconstructed spectrum. The σ was derived by considering the number of data points in the PES array versus the spectrometer measurement. There are 1900/137 ≈ 14 spectrograph pixels between two eToF points; multiplying by the 0.013 eV/pixel dispersion of the spectrometer gives 0.2 eV which we take to be σ. One function of reconstruction is to remove instrumental broadening. Thus one observes the higher resolution of the reconstructed spectrum, which matches well with the convolved grating spectrometer measurement. This also indicates that in our case the resolution of the reconstructed spectrum is limited by the number of data points within the Ne 1s photoelectron peak of the PES array signal.

To quantify the performance of the reconstruction, we calculated the standard deviation of the difference signal between the electron-derived and the photon spectra si

$${{\Delta }}{\sigma }_{{{{{{{{\rm{e-p}}}}}}}}}=\sqrt{\frac{\mathop{\sum }\nolimits_{i = 1}^{n}| ({c}_{i}-{s}_{i})-(\bar{c}-\bar{s}){| }^{2}}{n}}$$
(3)

where \(\bar{s}\) and \(\bar{c}\) are the mean value of spectrometer and PES array measurement, respectively, n is the number of spectrometer pixels. Depending on the situation, the value of ci is either interpolated PES array data of one eToF or the ghost imaging reconstructed spectrum. As shown in Fig. 4 the deviation Δσe-p of the reconstructed spectrum drops to half of the original value, which indicates the improvement after reconstruction. In addition, the smaller fluctuation of the deviations means that the reconstructed spectrum is stable and more reliable than the raw electron-derived spectrum. The significantly better matching of the spectrum after ghost-imaging is further confirmed by a good correlation between reconstructed and photon spectrum i.e., averaging 0.72 Pearson correlation coefficient across the spectrum (see Supplementary Note 2).

Fig. 4: Statistical measure of improved spectral characterization using the ghost-imaging algorithm.
figure 4

Δσe-p (Eqn. (3)), the standard deviation of the difference between electron-based and direct photon measurements, is plotted against pulse number. The Δσe-p are shown before (blue, open square) and after (red, solid dot) the ghost-imaging reconstruction. The response matrix R used here was determined using data from six electron time-of-flight spectrometers (eToFs) and all N = 15,337 shots. The results for 1000 shots are shown here.

Predictive power and performance analysis

One of the most interesting aspects of the ghost-imaging method is its predictive power for future shots. This requires numerous “learning” shots to obtain a converged response matrix. Data from six eToFs were used and the response matrix learned from a different number of shots is then used to predict the spectra for 100 new shots that were not used in the regression. As shown in Fig. 5, when fewer shots are used, the deviation of the learning shots is small because the regression is under-determined. Meanwhile, the deviation for the new shots is large, indicating a poor predictive power of an unconverged response matrix. As the information from more shots are included in the regression process, the deviation of learning shots rises, whereas the deviation for the new shots decreases indicating the gain of predictive power. The regression converges when the deviation of learning and prediction meets around 8000 shots (roughly ten times the number of unknown variables i.e., PES array vector elements). It is important to note that as more shots are used the error bar for the prediction, which measures the fluctuation of the deviation, also decreases, which means the prediction becomes more stable.

Fig. 5: Predictive capability of the ghost-imaging algorithm.
figure 5

Δσe-p (Eqn. (3)), the standard deviation between the ghost-imaging reconstructed and the true photon spectrum, is plotted as a function of the number of shots used in the regression to determin the response matrix R. Prediction refers to Δσe-p for 100 shots not used in the learning regression. The accuracy of the prediction increases (i.e., Δσe-p decreases) as the number of learning shots increases. The error bars represent standard deviations of Δσe-p. The inset at 1433 learning shots shows a marked difference between prediction and learning (0.6 vs 1.4), whereas the inset at 7568 learning shots shows a relatively small difference (0.9 vs 1.1).

Combining electron spectra from several eToFs increases the signal intensities and suppresses the noise. However, the eToF signals cannot be added on top of each other directly, due to the different calibrations of each eTOF. As mentioned before, we put the signals from different eToFs together to form a larger vector and differences in eToFs are automatically taken into account when calculating the response matrix. The upper panel and the lower panel of Fig. 6 show the spectrum of a random shot where one eToF with the strongest signal and six eToFs are used, respectively. Comparison with the Gaussian convolved spectrometer measurement clearly indicates the advantages of using six eToFs. The inset plot shows that the normalized deviation drops gradually from 1 for one eToF to 0.87 with six eToFs. The data from different eToFs complement each other and improve the correlation with the spectrometer measurement thus resulting in a better overall reconstructed spectrum.

Fig. 6: Improved single-shot reconstruction as a function number of electron time-of-flight spectrometers (eToFs) used.
figure 6

The reconstructed spectrum and Gaussian convolved spectrum using one eToF (a) and six eToFs (b). All the shots are used to get a converged result. The inserted plot shows the decrease in Δσe-p (Eqn. (3)) when more eToFs are used.

Our analysis indicates that the performance of the ghost-imaging reconstruction depends on experimentally controllable parameters, the number of shots used and the number of eTOFs used. Ghost imaging is based on the correlation between the object measurement and the reference measurement, i.e., the sensitivity of the PES array signals to the fluctuations of the incident spectrum as measured by a grating spectrometer. Obtaining a better correlation function and reconstruction, i.e., response matrix and spectrum with higher resolution, requires more data points within the Ne 1s photoelectron peak as well as a high signal-to-noise ratio. More data points in the eTOF spectrum can be obtained by increasing the retardation voltages to slow the electrons, using larger drift length tubes, or, more simply by increasing the digitizer sampling rate which is presently 2 GHz. In addition, the increased detection sensitivity can be readily achieved by using more eToFs or by increasing the gas density to produce more photoelectrons and a higher signal-to-noise ratio (see discussion in Supplementary Note 3).

Discussion

Despite the considerable improvement to achieve resolution ΔE/E ~1/2000, the ghost-imaging reconstruction of a single-shot XFEL spectrum under the current experimental conditions cannot characterize completely the SASE structure containing inter-spike spacings down to ~0.1 eV, corresponding to a required resolution of ΔE/E ~1/10,000. This is simply due to the relatively sparse sampling rate (0.5 ns) and the relatively short flight path of the current eTOF spectrometer array29. We note that there is a three-fold increased flight path in the PES array30 at the Linac Coherent Light Source1. The increased flight path will yield a corresponding increase in the number of eTOF sampling points and resulting resolution. Compared to the current demonstration, a twofold increased sampling rate combined with a twofold increased time-of-flight yield a fourfold increase in resolution— giving ~120 meV FWHM for a resolving power of 8000. For this particular case using the Ne 1s photoelectron, the width of the final state Ne 1s−1 of 0.27 eV represents another barrier that ghost imaging can circumvent.

For other applications, the ability to reconstruct an averaged spectral profile with high accuracy is of considerable interest. High-precision incident spectra obtained by averaging are extremely useful for transient absorption measurements, e.g., when a dispersive spectrometer is placed after the sample one can extract spectral features below the SASE bandwidth, as was done previously in the XUV spectral range to observe strong-field induced modifications of the lineshape of a doubly-excited state in He38. This averaging method is very common for pump/probe transient absorption experiments, e.g., with broadband soft x-ray high-harmonic generation (HHG) sources where single-shot spectra sequentially taken with pump-on and pump-off configurations are averaged to obtain spectral transients39,40. With the present transparent beamsplitter, this can be extended to soft x-ray energies that are difficult to access with HHG.

The effect of shot averaging for ghost-imaging reconstruction is shown in Fig. 7 where the deviation between the ghost-imaging-reconstructed spectrum and the grating spectrum is shown. These deviations were evaluated as follows: measurements were randomly selected to form seven groups of spectra with X shots in each group. The spectra within each group were then ensemble-averaged. Figure 7a shows the result for X = 1000 shots with the lower panel displaying the normalized deviations (Δs/s) for photon energies, i:

$$| {{\Delta }}s/s{| }_{i}=\frac{\mathop{\sum }\nolimits_{k = 1}^{X}\left|{c}_{i}^{k}-{s}_{i}^{k}\right|/{s}_{i}^{k}}{X}$$
(4)

where the upper index k denotes the shot number. The deviation for one group is shown as a gray-dashed line, and that for the average of seven groups is shown as a black solid line.

Fig. 7: Averaged ghost-imaging-reconstructed versus averaged photon spectra.
figure 7

a Upper panel shows the averaged spectrum for a group of 1000 shots for photon (red solid line), ghost-imaging reconstructed (blue dashed line), and electron-derived, i.e., without application of ghost-imaging (green dot-dashed line). Note the electron-derived spectrum fails to reproduce the averaged photon spectrum in contrast to the ghost-imaging reconstruction. The spectrum is divided into regions 1–4, going from low to high photon energies. The lower panel shows the corresponding spectral percentage deviation between the ghost-imaging reconstructed and true photon spectra for a single 1000-shot group (dashed) and averaged over seven 1000-shot groups (solid). b The normalized deviation Δs/s (Eqn. (4)) for each spectral region 1–4 as a function of the number of averaged shots. The error bars represent the standard deviation of Δs/s.

The deviations show a spectral dependence as is clear from the lower panel of Fig. 7a. The data were divided into four regions separated at 901.75, 907.5, and 913.25 eV. The percentage deviations (Δs/s) for each region are shown in Fig. 7b as a function of the number of shots averaged. The Δs/s decreases from around 28% for single-shot to 3% and 1% for 100 and 1000 shots, respectively. It is clear that the ghost imaging reconstructed spectrum matches significantly better with the grating spectrum after averaging hundreds of shots. This demonstrates the accuracy of the calculated response matrix. If the single-shot deviation comes from random noise, the deviation after averaging X shots will be proportional to \(1/\sqrt{X}\). The log-log plot inset in Fig. 7b clearly shows a negative power relationship. A curve fit of the data in region (2) yields a function of 1/X0.45, which is close to the expected \(1/\sqrt{X}\). We note that the deviation is somewhat larger in the region (1) which corresponds to the low-photon-energy, low-photoelectron-kinetic-energy region. This may be due to the small PES array signals (corresponding to a low signal-to-noise ratio) for electrons with lower kinetic energy. Region (1) also has a relatively small 0.53 Pearson coefficient (see further discussion in Supplementary Note 2). Averaging to achieve a ~1% precision after ~1000 shots (requiring only 1 ms at MHz repetition rates using the noninvasive photoelectron spectroscopy scheme) can foster the realization of transient absorption measurements at FELs38.

Returning to the single-shot spectral profile measurements, the ghost-imaging reconstruction demonstrated here is easy to apply for better calibration and resolution improvement of other instruments designed for XFEL diagnostics such as the newly inaugurated angle-resolved photoelectron spectroscopy (ARPES) instrument at LCLS30. After a training period using multiple eTOFs in conjunction with a high-resolution spectrograph to obtain a converged response matrix, spectral profiles of new shots with enhanced resolution can be obtained at MHz repetition rates. The processing time to obtain the response matrix for the current dataset was ~20 min using a single core and can be readily sped up for rapid implementation during an XFEL beamtime. From an XFEL-machine perspective, the enhanced energy resolution for an ARPES-based x-ray photon diagnostic, which has already demonstrated characterization of spatial, temporal, and polarization properties, is a sought-after breakthrough since it enables a deeper understanding of the machine operation and allows for a fast-feedback on SASE-formation characteristics.

From a scientific perspective, the high-resolution, noninvasive single-shot incident x-ray spectrum characterization described here represents a step forward for techniques that require incident spectral characterization such as s-TrueCARS19 and others that take advantage of the intrinsic stochastic nature of XFEL pulses17,18,20. Our ghost-imaging-inspired gaseous beamsplitter will allow such experiments at high repetition rates (MHz) and also in the soft x-ray regime. For example, it will enable photon-in/photon-out transient multidimensional spectroscopy at XFELs to explore nonlinear effects arising from propagation through dense absorbing media41. Moreover, an incident pulse spectral characterization should enable a greater depth of understanding for processes where the SASE-pulse structure can play an important role, such as the recently-discovered transient resonance phenomena in core-hole dynamics in gaseous media which rely on mapping out narrow energy levels of highly elusive states of matter7, SASE-FEL studies of chiral dynamics using photoelectron circular dichroism which have been compromised by averaging over subtle dynamics due to the large bandwidth42 and resonance-enhanced scattering for single-particle imaging43.

In summary, the use of a ghost-imaging algorithm with a photoelectron spectrometer array as a transparent beamsplitter, as is currently available, can provide the incident SASE XFEL spectrum at high resolution on a single-shot basis and averaged SASE spectra at high precision. The single-shot spectra, combined with polarization information from the eTOF array28,30, will allow users to extract complete two-dimensional spectra in a few thousand shots at high repetition rates and high intensities for studies of nonlinear, polarization-dependent x-ray phenomena using correlation techniques. The averaged spectra can be used to obtain high precision transient absorption spectra with resolution much higher than the SASE bandwidth. The combination of ghost imaging with a photoelectron spectrometer array is expected to be a powerful asset for both the technological and scientific development of x-ray spectroscopies at XFELs.

Methods

XFEL photon delivery

Our experiment was performed on the SQS (Small Quantum Systems) branch of the SASE3 beamline at the European XFEL44,45 with SASE soft x-rays at 910 eV central photon energy. The averaged FWHM bandwidth of the XFEL pulses was 9 eV and the standard deviation of pulse energy fluctuation was 3% for an average pulse energy of 3.8 mJ as measured with an x-ray gas monitor detector (XGM). The XFEL ran at a 10 Hz repetition rate over a 25 min data acquisition time to obtain N = 15,337 shots.

Electron measurement—photoelectron spectrometer array

The PES array is located far from any x-ray focus points and the SASE beam spot size was estimated to be ~5 mm in diameter, ensuring the photoionization remains within the linear regime. The number of photoelectrons generated is proportional to the product of the gas density and the photoionization cross-section. The base background gas pressure in the chamber is 1 × 10−8 mbar and the pressure of the gas injected was adjustable from 1 × 10−7 mbar to 1 × 10−5 mbar. The gas density was set to 2.5 × 10−7 during our experiment. The retardation voltage of 30 V slowed photoelectrons with 40 eV initial kinetic energy to 10 eV. The total time-of-flight for Ne 1s photoelectrons from the interaction region to the detector is ~60 ns (see ToF signals in Supplementary Note 1). The detector signals from the microchannel plate (MCP) stack were recorded every 0.5 ns. The electrons were slowed in order to create a 1s photoelectron peak with more ToF sampling points while keeping the signal well above the background.

Photon measurement—grating spectrograph

The FEL beam (3.8 mJ/pulse) was attenuated prior to the spherical mirror with Kr gas (transmission = 35.5%); combined with the grating efficiency of 36%, 0.49 mJ was incident on the screen. The VLS grating has a groove density of 150 lines/mm, length of 120 mm, and incidence angle of 12.3 mrad, with the imaging screen located at 99 m distance from the grating, in the focus of the spherical premirror. The present VLS grating intercepted the central portion of the x-ray beam, which for the spatially unchirped beam expected here under standard XFEL operating conditions, is representative of the energy spectrum of the full beam. Slitting options upstream of the PES array are available to account for special chirped XFEL operating modes. The emitted fluorescence from the Ce:YAG screen was detected by a camera to produce the photon spectrum31. The spectral range recorded on the YAG screen was from 895.5 to 919.8 eV and was spread over 1900 pixels. The estimated resolving power for the spectrometer, based on independent measurements, is EE = 10,00046. This allows resolving the single SASE spikes of the XFEL pulses, which show a minimum spacing of σ = 90 meV in the present measurements.

Data analysis

The data analysis was carried out on the European XFEL Maxwell server using a Jupyter notebook with a single core. The time consumed to calculate the response matrix of the PES array depends on the number of eTOF data included and the number of shots used. To obtain fully converged results, the number of shots used should be around ten times the number of elements in the PES array vector c. The calculation takes 30 s for 1 eTOF (137 points) using 1200 shots, and 20 min for six eTOF (822 points) using 8000 shots. It is straightforward to use several cores with MPI to shorten the computing time significantly. Note that no filters are applied during the analysis. Filters keeping the shots with good correlations between the PES array and spectrometer integral signals were tried. However, it failed to improve the performance of a ghost-imaging method, which benefits from the variance of SASE pulses.