## 3 Simulations  
The simulations assumed either a simple Gaussian-shaped X-ray pulse or a simulated SASE pulse from the initial LCLS design phase. The streak laser pulse had a central wavelength of 10.6 \(\upmu\)m which resulted in an oscillation period of 35.4 fs. The detector configuration consisted of 64 identical electron spectrometers which were equally distributed on a circle around the interaction volume, i.e., \(N=64\). As a result, the time delay increment was \(\delta\tau=0.55\) fs. Since the relevant part of the gate pulse was one oscillation period, we argue that the fundamental sampling ratio of ptychography is approximately given by the number of spectrometers, here \(R\approx 64\). The electron spectrometers covered the range from 256 eV to 374 eV with \(M=2048\) samples, corresponding to a time sampling of \(\delta t=17\) as. That is, hereafter, we operate on a spectrogram sampled on a \((2048\times 64)\) grid, except when stated otherwise. The quality of reconstruction was quantified via the root mean square error (rms) after 5000 iterations between the reconstructed \(E_{j=5000}(t_{i})\) and the original X-ray pulse \(E_{X}(t_{i})\). \[\mathrm{rms}=\sum_{i=1}^{M}\left(|E_{j=5000}(t_{i})|-|E_{X}(t_{i})|\right)^{2}. \tag{18}\]  
Note, that we calculated the rms error only from the amplitude of the waveform. The reason for this is that ePIE tends to distribute reconstruction errors more or less equally to the X-ray and the gate pulse. In our case, the gate was a pure phase gate and we forced its amplitude to be one; thus, all amplitude reconstruction errors appeared in the X-ray pulse. We began with a simple Gauss-shaped X-ray pulse of decreasing pulse duration in order to establish a lower bound for the feature sizes that could be reconstructed. Figure 1a shows the rms error for different pulse durations ranging from 0.01 fs to 1.5 fs. We identified three different regions, i.e., below 0.18 fs, between 0.18 fs and 0.5 fs and above. Below 0.18 fs, the reconstructed X-ray pulse contained mostly artifacts, as seen in the left-most inset, which shows the original (black curve) and the reconstructed (red curve) X-ray pulse. Between 0.18 fs and 0.5 fs, the main pulse was well reconstructed; however, we found reconstruction errors on both wings of the main pulse, as seen in the middle inset. Nevertheless, the quality of reconstruction was sufficiently high to estimate the pulse duration. For durations longer than 0.5 fs, the reconstructions were extremely good. As an example, the reconstruction of a 0.58 fs long Gaussian pulse is shown in the right inset. Further simulations indicated that the shortest pulse duration that could be reconstructed is linked to the oscillation period of the streak field, if all other parameters are kept constant. Figure 1b shows the FWHM of the shortest reliably reconstructed Gauss pulse versus the oscillation period of the streak laser. The error bars result from the uncertainty in determining the transition from a low (\(<\)10\({}^{-3}\)) to a high rms error (\(>\)10\({}^{-1}\)). These simulations suggest that a ratio of pulse duration over an oscillation period of less than 0.02 leads to erroneous reconstruction results. Next, we analyzed the reconstruction of X-ray waveforms consisting of two identical Gaussian pulses, each having a duration of 1 fs. Above, we have shown that single pulses with 1 fs duration are very well reconstructed. Such double pulses may be relevant for X-ray pump and X-ray probe experiments. One replica is fixed at the origin and the separation to the second replica is varied between 1 fs and 3.5 fs in steps of 0.5 fs. Figure 2 shows that in all cases, ptychography is able to yield an extremely accurate reconstruction result. The reconstruction is equally accurate for larger separations (not shown here). Figure 1: (**a**) Rms error versus pulse duration of a Gauss-shaped X-ray pulse. The insets show the original (black curve) and the reconstructed (red curve) X-ray pulses for three different pulse durations, i.e., 0.02 fs, 0.28 fs and 0.58 fs.