scipp / essdiffraction

Diffraction data reduction for the European Spallation Source
https://scipp.github.io/essdiffraction/
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

[Requirement] Fourier transform to compute PDF #49

Open jl-wynen opened 3 months ago

jl-wynen commented 3 months ago

Executive summary

We need to compute the fourier transform of the structure factor to get the PDF.

Context and background knowledge

This is needed for reducing PDF data but not other powder data.

The structure factor is given by

S(Q) = \frac{I_\mathsf{coh}(Q) - \sum c_i{|f_i(Q)|}^2}{{|\sum c_i f_i(Q)|}^2} + 1

where $I_\mathsf{coh}$ is the coherent scattering intensity, $f_i$ the scattering length density, and $c_i = \rho_i/\rho$ with $\rho_i$ the number density of atoms of type $i$. The momentum transfer is $Q = 4\pi \mathsf{sin}(\theta)/\lambda$.

The PDF is then

g(r) - 1 = A \frac{2}{\pi} \int_{Q_\mathsf{min}}^{Q_\mathsf{max}}\, (S(Q) - 1) Q \mathsf{sin}(Qr) dQ

with

A = \frac1{2\pi^2 r \rho \sum b^2}

Inputs

1d $S(Q)$.

Methodology

The integral that defines $g(r)$ corresponds to a Fourier transform. So to implement it, we should use an FFT. We should probably add support in Scipp itself. The code in ESSdiffraction would just be a simple wrapper to call the FFT.

Outputs

Fourier transformed, 1d $g(r)$

Which interfaces are required?

Python module / function

Test cases

None yet, though there will be simulated data for DREAM.

Comments

No response

jl-wynen commented 2 months ago

Mantid does not actually use an FFT to compute the PDF, see https://docs.mantidproject.org/nightly/algorithms/PDFFourierTransform-v2.html. Instead, it uses an algorithm based on the maths explained in the Manual for Gudrun.

jokasimr commented 1 month ago

Is there a typo in the expression for $Q$? Should it be $Q = 4\pi \mathsf{sin}(\theta)/\lambda$?

jl-wynen commented 1 month ago

Yes. Fixed it

jokasimr commented 3 weeks ago

Is there any test data available for this? Do we know $g(r)$ for some $S(Q)$?

jl-wynen commented 3 weeks ago

I am not aware of any data.