# From Femtoseconds to Hours--Measuring Dynamics over 18 Orders of Magnitude with Coherent X-rays
## 2 XPCS Concepts
### Coherence and Speckle Contrast
Examples for such geometrical speckle contrasts are given in Figure 6. Note that this has to be multiplied by the actual degree of transverse coherence to obtain the experimental speckle contrast. For a SAXS geometry, the contrast is maximized, and drops towards the WAXS regime. This further demonstrates, that XPCS or XSVS in SAXS geometry can be typically performed with beam sizes in the range of 10 \(\upmu\)m and sample thicknesses in the mm range. In contrast, WAXS geometries that allow probing molecular length scales, demand smaller beam sizes and in particular thinner samples or a smaller bandwidth. As both reduces the scattering intensity, XPCS in WAXS geometry typically results in lower count rates. In general, the speckle contrast can be either obtained from spatial correlations by Equation (17) from single speckle patterns or similarly via XPCS from slow or static sample by correlating in the time domain. However, at low intensities the validity of Equation (17) is limited. In such cases one can take advantage of the intensity distribution of coherent scattering experiments [61]. For fully coherent beams (\(\beta=1\)), the intensity follows a gamma distribution. At low count rates with single photon detections, the Poisson distribution of photon detection processes is taken into account by convoluting it with the gamma distribution. The result is the negative-binomial distribution  
\[P(k)=\frac{\Gamma(M+k)}{\Gamma(M)\Gamma(k+1)}\bigg{(}1+\frac{M}{\langle k \rangle}\bigg{)}^{-k}\bigg{(}1+\frac{\langle k\rangle}{M}\bigg{)}^{-M}, \tag{19}\]  
with the gamma function \(\Gamma(\cdot)\), the number of photons \(k\) and the average number of photons per pixel \(\langle k\rangle\). The contrast is then obtained as inverse of the mode number \(M\) by histogramming the number of pixels that detected \(k\) photons. Furthermore, as the variance of the negative binomial distribution is the sum of those for the gamma and the Poisson distribution, the speckle contrast becomes [59]  
\[\beta_{NB}=\frac{\text{var}(k)}{\langle k\rangle^{2}}-\frac{1}{\langle k \rangle}. \tag{20}\]  
For low count rates the second term dominates so that the extraction of contrast will be affected a lot by counting statistics and thus be inaccurate. Instead for \(\langle k\rangle<10^{-2}\), \(P(k)\) can be approximated by its Taylor series leading to a contrast estimate from the number of two-photon events \(P(2)\) as \(\beta\approx 2P(2)/\langle k\rangle^{2}-1\)[59]. It is important to note that at least one  
Figure 6: (**a**) Geometrical speckle contrast as a function of \(q\) for different sample thicknesses \(d_{\text{samp}}\). The beam size was set to 5 \(\upmu\)m, the dashed line marks a typical \(q\)-value for intermolecular distances. (**b**) Geometrical speckle contrast as function of beam size at different \(q\) values at \(d_{\text{samp}}=500\)\(\upmu\)m. The dashed line marks a beam size of 5 \(\upmu\)m as used in the left side. In both parts the bandwidth was set to 1.4 \(\times\) 10\({}^{-4}\), the sample-detector distance to 5 m, \(X\)-ray energy was 10 keV, and the pixel size 75 \(\upmu\)m.  
two-photon event is necessary to estimate the contrast, if only 0 and 1 photon events are measured \(P(k)\) cannot be distinguished from a Poisson distribution.