source: sasmodels/sasmodels/sesans.py @ 190fc2b

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

delint

  • Property mode set to 100644
File size: 1.8 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    r"""
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    r"""
26    Compute the expected SESANS polarization for a given SANS pattern.
27
28    Uses the hankel transform followed by the exponential.  The values for *zz*
29    (or spin echo length, or delta), wavelength and sample thickness should
30    come from the dataset.  $q$ should be chosen such that the oscillations
31    in $I(q)$ are well sampled (e.g., $5 \cdot 2 \pi/d_{\max}$).
32
33    *SElength* [A] is the set of $z$ points at which to compute the
34    Hankel transform
35
36    *wavelength* [m]  is the wavelength of each individual point *zz*
37
38    *thickness* [cm] is the sample thickness.
39
40    *q* [A$^{-1}$] is the set of $q$ points at which the model has been
41    computed. These should be equally spaced.
42
43    *I* [cm$^{-1}$] is the value of the SANS model at *q*
44    """
45    G = np.zeros_like(SElength, 'd')
46    for i, SElength_i in enumerate(SElength):
47        integral = besselj(0, q*SElength_i)*Iq*q
48        G[i] = np.sum(integral)
49
50    # [m^-1] step size in q, needed for integration
51    dq = (q[1]-q[0])*1e10
52
53    # integration step, convert q into [m**-1] and 2 pi circle integration
54    G *= dq*1e10*2*pi
55
56    P = exp(thickness*wavelength**2/(4*pi**2)*(G-G[0]))
57
58    return P
Note: See TracBrowser for help on using the repository browser.