## 3 Analysis of Contrast Extraction Algorithms
### Calibration with the Zero-Contrast Baseline  
As proposed in Ref. [17], the biased contrasts \(\beta_{e}\) extracted from the three algorithms can be corrected with a linear coefficient. The calibrated contrast \(\beta_{c}\) is related to the extracted contrast baseline (\(\beta_{b}\)) at zero-contrast point with  
\[\beta_{c}=\frac{\beta_{e}-\beta_{b}}{1+\beta_{b}}. \tag{5}\]  
We will demonstrate in this section such a contrast calibration routine by utilizing the unfocused beam scattering as the baseline. The unfocused beam at XPP is approximately 300 \(\upmu\)m, which translates to a speckle size of 3.6 \(\upmu\)m at the detector and therefore an oversampling ratio of 0.07. It gives a contrast reduction factor \(\sim\)0.5%, which is well below the typical contrast values for XPCS measurements at FELs [9,22]. This leads to a small systematic error that can be neglected when working at higher contrast levels and the contrast reduction ranges for dynamics interpretation. In the context of this manuscript, we consider the scattering from unfocused beam as the _zero-contrast_ calibration point. As listed in Table 1, it is apparent that none of the three algorithms returns a contrast value close to 0 for the fully open slit condition. We next show experimental confirmation of this theory by using a detector pixel mask to eliminate charge sharing. As shown in our earlier work [17], charge sharing is the dominant contribution leading to inaccuracy in photon statistics, while the effects from other imperfections of the state-of-the-art hard X-ray detectors including pixel gain non-uniformity and readout noise are comparatively negligible. By masking the pixel boundaries with an aperture array, one can eliminate photon absorption at locations with position ambiguities. A tungsten foil with a thickness of 50 \(\upmu\)m was chosen for the mask fabrication. It has a transmission of \(9.1\times 10^{-5}\) for the photon energy of 9.83 keV, creating sufficient absorption contrast to be considered a binary mask. Shown in Figure 3a is the schematic of the mask. It consists of a periodic laser-machined aperture array (nominal diameter: 35 \(\upmu\)m, pitch: 100 \(\upmu\)m, 25 \(\times\) 25) that is commensurate with detector pixel array. When the pin holes are well aligned to the pixel centers, the photons landing on the detector will no longer have position ambiguities, e.g., only the center area of every other detector pixel can receive a nonzero reading, as the apertures lie well within the 60% charge contribution region marked as gray in Figure 3b. Therefore, by directly rounding the pixel readout, the number of photons falling into individual pixels can be uniquely and accurately determined. The mask was positioned close to the front of the detector at a distance of 7 mm from the sensor surface. The pixel histogram of the masked region was very sensitive to the  
Figure 2: Contrasts extraction using the three algorithms of the same scattering data set. The dashed lines show the extracted overall effective contrast \(\beta_{c}\). (**a**) Extracted \(\bar{k}\) distribution using the PPC method. (**b**) Extracted contrasts using the PPC method. (**c**) Extracted \(\bar{k}\) distribution using the GG/LSF method. (**d**) Extracted contrasts using the GG method. (**e**) Extracted contrasts using the LSF method. The legend on top of (**e**) is shared by all the plots in this figure, and it explains the measurement conditions followed by the effective beam sizes on the sample. The error bars in (**b**,**d**,**e**) were estimated from photon counting statistics. position of the mask. With a step size of 2 \(\upmu\)m, a 2D scan allows accurate determination of the mask alignment both horizontally and vertically (see Appendix B for details). Plotted with yellow line in Figure 3e is the optimized pixel histogram. It deviates from the purple curve which is simulated by assuming a perfect mask with the nominal values for the apertures.