source: sasmodels/sasmodels/models/pringles.py @ 9da407c

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

Pringle model added

  • 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"],
64    ["beta",        "",            0.02,   [-inf, inf], "", "Curvature paramter"],
65    ["sld_pringle", "1e-6/Ang^2",  1.0,    [-inf, inf], "", "Fractal exponent"],
66    ["sld_solvent", "1e-6/Ang^2",  6.3,    [-inf, inf], "", "Correlation length"]
67    ]
68# pylint: enable=bad-whitespace, line-too-long
69
70source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", "lib/sas_JN.c", "lib/gauss76.c", "pringles.c"]
71
72def ER(radius, thickness):
73    """
74        Return equivalent radius (ER)
75    """
76    ddd = 0.75 * radius * (2 * radius * thickness + (thickness + radius) \
77                           * (thickness + pi * radius))
78    return 0.5 * (ddd) ** (1. / 3.)
79
80demo = dict(background=0.0,
81            scale=1.0,
82            radius=60.0,
83            thickness=10.0,
84            alpha=0.001,
85            beta=0.02,
86            sld_pringle=1.0,
87            sld_solvent=6.35)
88
89oldname = 'PringlesModel'
90oldpars = dict(background='background',
91                scale='scale',
92                radius = 'radius',
93                thickness = 'thickness',
94                alpha = 'alpha',
95                beta='beta',
96                pringle_sld='sld_pringle',
97                solvent_sld='sld_solvent')
98
99tests = [
100    [{'scale' : 1.0,
101      'radius': 60.0,
102      'thickness': 10.0,
103      'alpha': 0.001,
104      'beta': 0.02,
105      'sld_pringle': 1.0,
106      'sld_solvent': 6.3,
107      'background': 6.3,
108     }, 0.1, 16.185532],
109
110    [{'scale' : 1.0,
111      'radius': 60.0,
112      'thickness': 10.0,
113      'alpha': 0.001,
114      'beta': 0.02,
115      'sld_pringle': 1.0,
116      'sld_solvent': 6.3,
117      'background': 6.3,
118     }, 0.01, 297.153496],
119
120    [{'scale' : 1.0,
121      'radius': 60.0,
122      'thickness': 10.0,
123      'alpha': 0.001,
124      'beta': 0.02,
125      'sld_pringle': 1.0,
126      'sld_solvent': 6.3,
127      'background': 6.3,
128     }, 0.001, 324.021256415],
129
130    [{'scale' : 1.0,
131      'radius': 60.0,
132      'thickness': 10.0,
133      'alpha': 0.001,
134      'beta': 0.02,
135      'sld_pringle': 1.0,
136      'sld_solvent': 6.3,
137      'background': 6.3,
138     }, (0.001, 90.0), 6.30000026876],
139
140    ]
Note: See TracBrowser for help on using the repository browser.