1 | """ |
---|
2 | Conversion of scattering cross section from SANS in absolute |
---|
3 | units into SESANS using a Hankel transformation |
---|
4 | |
---|
5 | Everything is in units of metres except specified otherwise |
---|
6 | |
---|
7 | Wim Bouwman (w.g.bouwman@tudelft.nl), June 2013 |
---|
8 | """ |
---|
9 | |
---|
10 | from __future__ import division |
---|
11 | |
---|
12 | import numpy as np |
---|
13 | from numpy import pi, exp |
---|
14 | from scipy.special import jv as besselj |
---|
15 | |
---|
16 | def hankel(zz, wavelength, th, q, I): |
---|
17 | """ |
---|
18 | Compute the expected SESANS polarization for a given SANS pattern. |
---|
19 | |
---|
20 | Uses the hankel transform followed by the exponential. The values |
---|
21 | for zz (or spin echo length, or delta), wavelength and sample thickness |
---|
22 | information should come from the dataset. *q* should be chosen such |
---|
23 | that the oscillations in *I(q)* are well sampled (e.g., 5*2*pi/d_max). |
---|
24 | |
---|
25 | *zz* [nm] is the set of z points at which to compute the hankel transform |
---|
26 | |
---|
27 | *wavelength* [m] is the wavelength of each individual point *zz* |
---|
28 | |
---|
29 | *th* [m] is the sample thickness. |
---|
30 | |
---|
31 | *q* [nm^{-1}] is the set of q points at which the model has been computed. |
---|
32 | These should be equally spaced. |
---|
33 | |
---|
34 | *qwidth* is the width of the integration |
---|
35 | |
---|
36 | *I* [m^{-1}] is the value of the SANS model at *q* |
---|
37 | """ |
---|
38 | dq=(q[1]-q[0])*1e9 # [m^-1] step size in q, needed for integration |
---|
39 | G = np.zeros(len(zz), 'd') |
---|
40 | for i in range(len(zz)): |
---|
41 | integr = besselj(0,q*zz[i])*I*q |
---|
42 | G[i] = np.sum(integr) |
---|
43 | G *= dq*1e9*2*pi # integr step, conver q into [m**-1] and 2 pi circle integr |
---|
44 | PP = exp(th*wavelength**2/(4*pi**2)*(G-G[0])) |
---|
45 | |
---|
46 | return PP |
---|