ess.powder.transform.compute_pdf_from_structure_factor#

ess.powder.transform.compute_pdf_from_structure_factor(s, r, *, uncertainty_broadcast_mode=UncertaintyBroadcastMode.drop, return_covariances=False)[source]#

Compute a pair distribution function from a structure factor.

Computes the pair distribution function \(G(r)\) as defined in Review: Pair distribution functions from neutron total scattering for the study of local structure in disordered materials (note, in the reference, the pair distribution function is denoted \(D(r)\), but since \(G(r)\) is the more common name, that is what is used here). from the overall scattering function \(S(Q)\).

The inputs to the algorithm 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.

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 to UncertaintyBroadcastMode.drop.

  • return_covariances (default: False) – bool, 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:

DataArray – 1D DataArray representing \(G(r)\) with a bin-edge coordinate called \(r\) that is the provided output grid, and optionally a 2D DataArray representing the covariances of \(G(r)\).