ess.diffraction.pdf.pair_correlation_function#
- ess.diffraction.pdf.pair_correlation_function(s, r, *, uncertainty_broadcast_mode=UncertaintyBroadcastMode.drop, return_covariances=False)[source]#
Compute the pair correlation function from a structure factor.
Computes the pair correlation function \(G(r)\) from the overall scattering function \(S(Q)\). See Review: Pair distribution functions from neutron total scattering for the study of local structure in disordered materials for the definition of \(G(r)\) or
ess.diffraction.pdf. (Note, in the reference, the pair correlation function is denoted as \(D(r)\), but since \(G(r)\) is the more common name, that is what is used here).The inputs to the function are:
A histogram representing \(S(Q)\) with \(N\) bins on a bin-edge grid with \(N+1\) edges \(Q_j\) for \(j=0\ldots N\).
The bin-edge grid over \(r\). The output histogram representing \(G(r)\) will be computed on this grid.
In each output bin, the output is computed as:
\[\begin{split}G_{i+\frac{1}{2}} &= \frac{2}{\pi(r_{i+1}-r_i)} \int_{r_i}^{r_{i+1}} \int_{0}^\infty (S(Q) - 1) Q \sin(Q r) dQ \ dr \\ &\approx \frac{2}{\pi(r_{i+1}-r_i)} \sum_{j=0}^{N-1} (S(Q)_{j+\frac{1}{2}} - 1) (\cos(\bar{Q}_{j+\frac{1}{2}} r_{i})-\cos(\bar{Q}_{j+\frac{1}{2}} r_{i+1})) \Delta Q_{j+\frac{1}{2}}\end{split}\]Note that in the above expression the subscript \(_{j+\frac{1}{2}}\) is used to denote quantities belonging to the \(j^\text{th}\) bin of a histogram, \(\bar{Q}_{j+\frac{1}{2}} = \frac{Q_j + Q_{j+1}}{2}\) and \(\Delta Q_{j+\frac{1}{2}} = Q_{j+1} - Q_{j}\).
- Parameters:
s (
DataArray) – 1D DataArray representing \(S(Q)\) with a bin-edge coordinate called'Q'.r (
Variable) – 1D array, bin-edges of output grid.uncertainty_broadcast_mode (
UncertaintyBroadcastMode,) – Choose how uncertainties in S(Q) are broadcast to G(r). Defaults toUncertaintyBroadcastMode.drop.return_covariances (
bool, default:False) – If true the second output of the function will be a 2D array representing the covariance matrix of the entries in the first output.
- Returns:
G (
scipp.DataArray) – 1D array representing \(G(r)\) with a bin-edge coordinate called'r'that is the provided output grid.cov (
scipp.DataArray) – 2D array representing the covariance matrix of the entries ing. Only returned ifreturn_covariances=True.
See also
ess.diffraction.pdfModule with related functions.