source: sasmodels/sasmodels/models/pringle.py @ 1805a9e

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 1805a9e was 1805a9e, checked in by wojciech, 8 years ago

Pringle model clean-up

  • Property mode set to 100644
File size: 3.6 KB
Line 
1r"""
2This model provides the form factor, $P(q)$, for a 'pringle' or 'saddle-shaped'
3object (a hyperbolic paraboloid).
4
5.. figure:: img/pringles_fig1.png
6
7    (Graphic from Matt Henderson, matt@matthen.com)
8
9The returned value is in units of cm^-1, on absolute scale.
10
11Definition
12----------
13
14The form factor calculated is
15
16.. math::
17
18    I(q) = (\Delta \rho )^2 V \int^{\pi/2}_0 d\psi \sin{\psi} sinc^2
19    \left( \frac{qd\cos{\psi}}{2} \right)
20    \left[ \left( S^2_0+C^2_0\right) + 2\sum_{n=1}^{\infty}
21     \left( S^2_0+C^2_0\right) \right]
22
23where
24
25.. math::
26
27    C_n = \int^{R}_{0} r dr\cos{qr^2\alpha \cos{\psi}}
28    J_n\left( qr^2\beta \cos{\psi}\right)
29    J_{2n}\left( qr \sin{\psi}\right)
30
31.. math::
32
33    S_n = \int^{R}_{0} r dr\sin{qr^2\alpha \cos{\psi}}
34    J_n\left( qr^2\beta \cos{\psi}\right)
35    J_{2n}\left( qr \sin{\psi}\right)
36
37
38.. figure:: img/pringle-vs-cylinder.png
39
40    1D plot using the default values (with 150 data points).
41
42Reference
43---------
44
45S Alexandru Rautu, Private Communication.
46
47"""
48
49from numpy import inf, pi
50
51name = "pringles"
52title = "Pringles model for K Edler. Represents a disc that is bent in two directions."
53description = """\
54
55"""
56category = "shape:cylinder"
57
58# pylint: disable=bad-whitespace, line-too-long
59#   ["name", "units", default, [lower, upper], "type","description"],
60parameters = [
61    ["radius",      "Ang",         60.0,   [0, inf],    "volume", "Pringle radius"],
62    ["thickness",   "Ang",         10.0,   [0, inf],    "volume", "Thickness of pringle"],
63    ["alpha",       "",            0.001,  [-inf, inf], "", "Curvature parameter alpha"],
64    ["beta",        "",            0.02,   [-inf, inf], "", "Curvature paramter beta"],
65    ["sld_pringle", "1e-6/Ang^2",  1.0,    [-inf, inf], "", "Pringle sld"],
66    ["sld_solvent", "1e-6/Ang^2",  6.3,    [-inf, inf], "", "Solvent sld"]
67    ]
68# pylint: enable=bad-whitespace, line-too-long
69
70source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", \
71          "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"]
72
73def ER(radius, thickness):
74    """
75        Return equivalent radius (ER)
76    """
77    ddd = 0.75 * radius * (2 * radius * thickness + (thickness + radius) \
78                           * (thickness + pi * radius))
79    return 0.5 * (ddd) ** (1. / 3.)
80
81demo = dict(background=0.0,
82            scale=1.0,
83            radius=60.0,
84            thickness=10.0,
85            alpha=0.001,
86            beta=0.02,
87            sld_pringle=1.0,
88            sld_solvent=6.35)
89
90oldname = 'PringlesModel'
91oldpars = dict(background='background',
92               scale='scale',
93               radius='radius',
94               thickness='thickness',
95               alpha='alpha',
96               beta='beta',
97               pringle_sld='sld_pringle',
98               solvent_sld='sld_solvent')
99
100tests = [
101    [{'scale' : 1.0,
102      'radius': 60.0,
103      'thickness': 10.0,
104      'alpha': 0.001,
105      'beta': 0.02,
106      'sld_pringle': 1.0,
107      'sld_solvent': 6.3,
108      'background': 6.3,
109     }, 0.1, 16.185532],
110
111    [{'scale' : 1.0,
112      'radius': 60.0,
113      'thickness': 10.0,
114      'alpha': 0.001,
115      'beta': 0.02,
116      'sld_pringle': 1.0,
117      'sld_solvent': 6.3,
118      'background': 6.3,
119     }, 0.01, 297.153496],
120
121    [{'scale' : 1.0,
122      'radius': 60.0,
123      'thickness': 10.0,
124      'alpha': 0.001,
125      'beta': 0.02,
126      'sld_pringle': 1.0,
127      'sld_solvent': 6.3,
128      'background': 6.3,
129     }, 0.001, 324.021256415],
130
131    [{'scale' : 1.0,
132      'radius': 60.0,
133      'thickness': 10.0,
134      'alpha': 0.001,
135      'beta': 0.02,
136      'sld_pringle': 1.0,
137      'sld_solvent': 6.3,
138      'background': 6.3,
139     }, (0.001, 90.0), 6.30000026876],
140]
Note: See TracBrowser for help on using the repository browser.