Two-Time Correlation Analysis¶
This page explains the concept and interpretation of two-time correlation analysis in XPCS, which extends the standard \(g_2(\tau)\) analysis to detect non-equilibrium and aging dynamics.
Motivation¶
The standard G2 autocorrelation function (see G2 Correlation Function Theory) assumes time-translation invariance – that the sample dynamics are stationary, meaning the same at all measurement times. This assumption breaks down for:
Aging systems: Glasses, gels, and other out-of-equilibrium materials where dynamics slow down over time
Phase transitions: Systems undergoing structural or ordering transformations during the measurement
Beam-induced dynamics: X-ray damage that progressively changes sample behavior
Intermittent dynamics: Sudden, discrete rearrangement events (avalanches, earthquakes in colloidal crystals)
The two-time correlation function captures these non-stationary effects by retaining the explicit dependence on both time points.
Definition¶
The two-time correlation function is defined as:
where:
\(I(\mathbf{q}, t)\) is the scattered intensity at wavevector \(\mathbf{q}\) and time \(t\)
\(\langle \cdot \rangle_{\mathbf{q}}\) denotes averaging over pixels within a Q-bin
\(t_1\) and \(t_2\) are two frame times (not a time and a lag)
The result is a symmetric matrix \(C(t_1, t_2) = C(t_2, t_1)\) of dimension \(N_{\text{frames}} \times N_{\text{frames}}\).
Interpretation¶
Relationship to G2¶
For a stationary system, \(C(t_1, t_2)\) depends only on the time difference \(\tau = |t_1 - t_2|\), and averaging along the diagonals recovers the standard \(g_2(\tau)\):
where \(k = \tau / \Delta t\) is the lag index and \(N\) is the number of frames.
Non-Stationary Features¶
Deviations from uniform diagonal structure reveal dynamics that change over the measurement:
Pattern |
Physical Interpretation |
|---|---|
Uniform diagonals |
Stationary dynamics (standard G2 analysis is valid) |
Diagonals broaden with time |
Aging: dynamics slow down (e.g., glass formation) |
Diagonals narrow with time |
Speeding up: dynamics accelerate (e.g., melting) |
Sharp off-diagonal boundaries |
Discrete events: sudden rearrangements at specific times |
Stripe patterns |
Intermittent dynamics: alternating fast and slow periods |
Bright corners / dark center |
Beam damage: sample changes due to X-ray exposure |
Extracting \(g_2(\tau, t_{\text{age}})\) from Cuts¶
For aging systems, one can extract a time-dependent correlation function by taking cuts along diagonals at different mean ages \(t_{\text{age}} = (t_1 + t_2) / 2\):
Fitting these cuts with the single exponential model at each age gives \(\tau_c(t_{\text{age}})\), revealing how the relaxation time evolves.
Visualization in XPCS Viewer¶
XPCS Viewer provides two visualization modes for two-time data:
Two-Time Correlation Map
The full \(C(t_1, t_2)\) matrix is displayed as a color-coded image. The visualization applies:
Outlier clipping to handle spurious extreme values
Percentile-based color scaling for robust contrast
Symmetric colormap centered on the diagonal
Diagonal G2 Extraction
Averaging along diagonals of the two-time matrix produces the standard \(g_2(\tau)\) curve. This is useful for comparing with the directly computed G2 data and for verifying stationarity.
Computational Considerations¶
Two-time correlation matrices are large: an experiment with \(N\) frames produces an \(N \times N\) matrix per Q-bin. For 10,000 frames, this is \(10^8\) elements (800 MB in float64), making two-time analysis the most memory-intensive operation in XPCS Viewer.
The implementation addresses this through:
Lazy loading: Two-time data is read from HDF5 only when the user navigates to the two-time analysis tab.
Slicing: Only the requested Q-bin’s data is loaded, not the full multi-Q dataset.
Backend acceleration: When the JAX backend is active, element-wise operations on the correlation matrix benefit from JIT compilation.
Memory monitoring: The
MemoryMonitortracks system memory usage and warns before allocating matrices that would exceed available RAM.