# source:sasmodels/sasmodels/hankel.py@10576d1

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 10576d1 was 10576d1, checked in by pkienzle, 9 years ago

add hankel function and sesans demo (not yet integrated with models)

• Property mode set to `100644`
File size: 1.5 KB
Line
1"""
2Conversion of scattering cross section from SANS in absolute
3units into SESANS using a Hankel transformation
4
5Everything is in units of metres except specified otherwise
6
7Wim Bouwman (w.g.bouwman@tudelft.nl), June 2013
8"""
9
10from __future__ import division
11
12import numpy as np
13from numpy import pi, exp
14from scipy.special import jv as besselj
15
16def 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
Note: See TracBrowser for help on using the repository browser.