# source:sasmodels/sasmodels/sesans.py@09ebe8c

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 09ebe8c was 09ebe8c, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

doc and delint

• Property mode set to 100644
File size: 1.7 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 make_q(q_max, Rmax):
17    """
18    Return a $q$ vector suitable for SESANS covering from $2\pi/ (10 R_{\max})$
19    to $q_max$.
20    """
21    q_min = dq = 0.1 * 2*pi / Rmax
22    return np.arange(q_min, q_max, dq)
23
24def hankel(SElength, wavelength, thickness, q, Iq):
25    """
26    Compute the expected SESANS polarization for a given SANS pattern.
27
28    Uses the hankel transform followed by the exponential.  The values
29    for zz (or spin echo length, or delta), wavelength and sample thickness
30    information should come from the dataset.  *q* should be chosen such
31    that the oscillations in *I(q)* are well sampled (e.g., 5*2*pi/d_max).
32
33    *SElength* [A] is the set of z points at which to compute the hankel transform
34
35    *wavelength* [m]  is the wavelength of each individual point *zz*
36
37    *thickness* [cm] is the sample thickness.
38
39    *q* [A^{-1}] is the set of q points at which the model has been computed.
40    These should be equally spaced.
41
42    *I* [cm^{-1}] is the value of the SANS model at *q*
43    """
44    G = np.zeros(len(SElength), 'd')
45    for i in range(len(SElength)):
46        integr = besselj(0, q*SElength[i])*Iq*q
47        G[i] = np.sum(integr)
48    dq=(q[1]-q[0])*1e10   # [m^-1] step size in q, needed for integration
49    G *= dq*1e10*2*pi # integr step, conver q into [m**-1] and 2 pi circle integr
50    P = exp(thickness*wavelength**2/(4*pi**2)*(G-G[0]))
51
52    return P
Note: See TracBrowser for help on using the repository browser.