Correlation Functions in XPCS¶
This page derives the two-time intensity correlation function \(c_2(\mathbf{q}, t_1, t_2)\) from first principles, states the Siegert relation, and explains why the equilibrium projection \(g_2(q, \tau)\) is insufficient for the non-stationary samples that xpcsjax targets. The derivation follows the transport-coefficient framework of [He2024].
Position density and scattered field¶
For a sample of \(N\) scattering centres at positions \(\mathbf{r}_j(t)\), the position density in Fourier space is
where \(f_j\) is the form factor of particle \(j\) and the magnitude of the momentum transfer is \(q = 4\pi \sin(\theta)/\lambda\).
The scattered electric field is
and the measured intensity per pixel is
The fluctuations of \(I(\mathbf{q}, t)\) carry the information about the sample’s collective dynamics.
First-order correlation function c_1¶
The normalised first-order correlation function is
For a Gaussian process — valid for large \(N\) by the central limit theorem — \(c_1\) depends only on the transport coefficient \(J(t)\) and the mean particle velocity:
The first factor is a generalised Debye–Waller decay; the second is a phase shift from the mean drift. This factorisation is exact for Gaussian displacement statistics. We split
with the internal (diffusive) piece
and the external (drift) piece
The transport coefficient \(J(t)\) is the central physical quantity in xpcsjax; it is defined in Transport Coefficient J(t).
Second-order (intensity) correlation function c_2¶
The normalised second-order correlation function is
This is the quantity measured directly in XPCS experiments. Each detector pixel contributes one time series \(I(\mathbf{q}, t)\) and the correlation is accumulated as a function of the absolute times \(t_1\) and \(t_2\).
Note
\(c_2\) is dimensionless and satisfies \(c_2 \geq 1\) for classical
intensity fluctuations (Cauchy–Schwarz). For ergodic decorrelating
dynamics, \(c_2(t_1, t_2) \to 1\) as \(|t_2 - t_1| \to \infty\).
This is a statement about the true physical \(c_2\); xpcsjax’s
fitted forward model \(\mathrm{offset} + \mathrm{contrast}\times
g_1^2\) does not hard-enforce it – offset is bounded down to
\(0.5\) (not \(1.0\)) to absorb baseline-calibration error in
real data, and the model value is not clipped at runtime (clipping
would kill gradients at the boundary). A fitted offset well below 1
is a data-quality signal worth checking, not something the solver is
prevented from returning.
The Siegert relation¶
For a Gaussian field (single-mode thermal-light statistics), Wick’s theorem yields the Siegert relation connecting the measured intensity correlation to the unmeasurable field correlation [Sutton2008]:
where \(\beta \in (0, 1]\) is the speckle contrast (also called the optical coherence parameter). For a fully coherent beam with single-mode detection \(\beta = 1\); in realistic experiments \(\beta \approx 0.05\)–\(0.8\) depending on beam coherence, pixel geometry, and sample inhomogeneity.
Substituting (5) into (8) gives the general homodyne result:
The drift phase drops out of \(|c_1|^2\) for homodyne detection. It is
recovered in heterodyne detection (multi-component scattering) through cross
terms between the populations, leading to the characteristic oscillations
that xpcsjax fits in two_component mode (Heterodyne Model).
Note
In xpcsjax, \(\mathcal{D}(t_1, t_2) = \int_{t_1}^{t_2} J(t')\,dt'\) is evaluated numerically by cumulative trapezoidal integration on the experimental time grid — no closed-form antiderivative is ever substituted. A closed form (\(D_0 \tau^{\alpha+1}/(\alpha+1)\)) does exist for \(\alpha \neq -1\), but it is evaluated at the nominal grid spacing rather than the true (possibly irregular) sampling, and it drops the constant \(D_\mathrm{offset}\) term entirely – both introduce error relative to trapezoidal integration on the real time grid, which is why xpcsjax never substitutes it. See Transport Coefficient J(t) for the integration convention and the \(D_0 = 2 D_\mathrm{SE}\) factor.
Wiener–Khinchin and the equilibrium projection¶
For a wide-sense stationary process, the Wiener–Khinchin theorem relates the autocorrelation function to the power spectral density: the second-moment statistics of \(I(\mathbf{q}, t)\) are completely specified by the lag-only correlation. Equivalently, the two-time matrix collapses onto a single curve in \(\tau = t_2 - t_1\):
For simple Brownian diffusion \(\Gamma = D q^2\) and the decay is a single exponential. The \(g_2(q, \tau)\) form is widely used in dynamic light scattering and equilibrium XPCS analysis.
Warning
Applying \(g_2(q, \tau)\) analysis to a non-stationary sample produces artefact-corrupted parameters: the effective \(D\) absorbs time-averaged heterogeneity, the apparent contrast \(\beta\) is depressed, and the functional form may stop being a single exponential even when the underlying physics is simple. For yielding, aging, or shear-banding samples, use the full two-time matrix.
The two-time correlation matrix¶
In practice \(c_2\) is represented as a matrix indexed by discrete frame times:
This matrix is symmetric (\(c_2^{ij} = c_2^{ji}\)) and has \(c_2^{ii} = 1 + \beta\) on the diagonal (zero lag). The equilibrium projection \(g_2(\tau)\) corresponds to the mean along the anti-diagonal at lag \(\tau = (j - i)\,\Delta t\).
The xpcsjax data loader xpcsjax.data.xpcs_loader.load_xpcs_data() returns the array
c2_exp of shape (n_phi, n_time, n_time) together with the two
frame-time grids t1 / t2 (accessors .t1 / .t2) and the angle
vector phi_angles_list (accessor .phi). The angle axis is
preserved because the homodyne laminar-flow kernel and the heterodyne
two-component kernel both depend explicitly on \(\phi\).
Multi-angle data and the per-angle scaling¶
A typical XPCS experiment captures the full \((q, \phi)\) plane on a 2D detector and resolves it into \(N_\phi\) azimuthal sectors at each \(q\). Each sector is fit simultaneously, but the speckle contrast \(\beta(\phi)\) and the baseline offset \(c_\mathrm{offset}(\phi)\) vary with angle for purely instrumental reasons (partial coherence, pixel geometry, gain variation, sample inhomogeneity).
The xpcsjax forward model factorises this as
where \(\theta\) collects the physical parameters
(\(D_0, \alpha, D_\mathrm{offset}\), plus shear parameters in
laminar_flow) and \((\beta(\phi_k), c_\mathrm{offset}(\phi_k))\) are
the per-angle scaling parameters. The naive choice of
\(2 N_\phi\) free scaling parameters introduces a parameter
absorption degeneracy; xpcsjax breaks the degeneracy through the strategies
described in Anti-Degeneracy Defence.
Fitting the model to data¶
Given measured \(\{c_2^{kij,\,\mathrm{meas}}\}\) and the forward model in Equation (11), the NLSQ engine in xpcsjax minimises
through the trust-region Levenberg–Marquardt step in the upstream NLSQ
library (xpcsjax.optimization.nlsq.fit_nlsq()). The weights \(w_{kij}\) default to
uniform and can optionally encode Poisson photon statistics or
shear-sensitivity reweighting. The shape parameters
\((\beta(\phi_k), c_\mathrm{offset}(\phi_k))\) enter through the
anti-degeneracy controller’s per-angle mode — constant (fixed from
quantiles), averaged (averaged and optimised), or individual
(per-angle); auto resolves to averaged or individual by angle
count. See Anti-Degeneracy Defence.
See also
Transport Coefficient J(t) – physical meaning of \(J(t)\).
Homodyne Model – mode-specific kernels for \(c_2\).
Heterodyne Model – multi-component generalisation.
xpcsjax.core.HomodyneModel– JAX implementation of the kernel.xpcsjax.optimization.nlsq.fit_nlsq()– the single-entry NLSQ wrapper.References and Citations – bibliography.