## 3 Simulations
(**b**) Shortest reliably reconstructed pulse duration versus the streak field oscillation period. After exploring the temporal resolution limitations, we turned to more realistic X-ray pulses and used one of the SASE waveforms simulated for the Linac Coherent Light Source (LCLS). It consisted of about 20 randomly positioned SASE spikes with different amplitudes and durations between about 0.5 fs and 3 fs. The entire waveform was about 20 fs long and exhibited a minor global phase variation. Figure 3 shows the amplitude and phase (black curves) of this waveform. The red circles represent the reconstructed amplitude (top) and phase (middle), and we found a nearly perfect agreement between the two. We also show, for the sake of completeness, the original and reconstructed phases of the gate (bottom) and again, there is very good agreement. That is, ptychography is not only able to reconstruct simple well-behaved X-ray pulses but also complex waveforms, such as those generated by the amplification of noise in an unseeded free electron laser. Since all measurements are subject to different noise contributions, we investigated the reconstruction error as a function of the signal-to-noise ratio (SNR). Figure 4 shows the rms versus SNR values ranging from 1 to 1000. As expected, the quality of reconstruction increased with SNR, but we found surprisingly good results even for low SNR values. The two insets show the reconstruction results for the two extreme cases, i.e., SNR = 1 and SNR = 1000. Even for SNR = 1, the reconstruction reproduced the most prominent features, albeit with substantial noise contribution. We also found that the rms error decreased with a slope of \(-\)0.25, which is reasonable because we added noise to the spectrogram and here, we expect a slope of \(-\)0.5 for pure statistical noise. The linear slope also indicates that the rms was dominated by the noise contribution and not by any additional reconstruction errors, especially for low SNR values. Another important aspect to consider is the influence of the finite energy resolution of the electron spectrometers used. In a recent experiment, electrons with a mean kinetic energy of approximately 310 eV were analyzed with electron spectrometers with an energy resolution of less than 1 eV [9]. That is, the relative energy resolution was in the order of \(\leq\)0.3%. Figure 5 shows the rms error for a relative energy resolution between 0% and 1%. For close to ideal energy resolutions, the reconstruction of the SASE waveform is very good, as shown in the left-most inset with the original waveform in black and the reconstructed waveform in red. With an increasing relative energy resolution, the error rapidly increased but we found good reconstruction results up to about 0.35% (see, for example, the lower right inset). For even worse energy resolutions, the error became almost constant at a level of rms \(\approx\)0.2, and the corresponding reconstruction results were no longer of reasonable quality. Figure 2: Ptychographic reconstruction of X-ray double pulses. Each pulse is 1 fs long and the time delay between the two replica increases from 1 fs to 3.5 fs in steps of 0.5 fs. In all cases, the reconstructed X-ray waveform (red circles) matches the original waveform (black curve) extremely well. Finally, we investigated the number of spectra actually required for good reconstruction of the SASE waveform. Note that in angular streaking, the number of spectra is directly linked to the time delay increment, such that \(N\delta\tau=2\pi/\omega_{0}\). That is, for \(N=1\), we have \(\delta\tau=35.4\) fs, and for \(N=256\), the time delay increment is as small as \(\delta\tau=0.14\) fs. Figure 6 shows the rms error starting with one spectrum to 256 spectra, which means that \(\delta\tau\) simultaneously reduces from 35.4 fs to 0.14 fs. For less than five spectra, the rms error was prohibitively high and the reconstruction results were insufficient, as indicated in the left inset.