source: sasmodels/sasmodels/models/pringle.py @ af4da90

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

Updated reference to originator of the pringle model

  • 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
45Stefan Alexandru Rautu, Private Communication. 2012.
46As of 2016: stefanar@ncbs.res.in
47
48"""
49
50from numpy import inf, pi
51
52name = "pringles"
53title = "Pringles model for K Edler. Represents a disc that is bent in two directions."
54description = """\
55
56"""
57category = "shape:cylinder"
58
59# pylint: disable=bad-whitespace, line-too-long
60#   ["name", "units", default, [lower, upper], "type","description"],
61parameters = [
62    ["radius",      "Ang",         60.0,   [0, inf],    "volume", "Pringle radius"],
63    ["thickness",   "Ang",         10.0,   [0, inf],    "volume", "Thickness of pringle"],
64    ["alpha",       "",            0.001,  [-inf, inf], "", "Curvature parameter alpha"],
65    ["beta",        "",            0.02,   [-inf, inf], "", "Curvature paramter beta"],
66    ["sld_pringle", "1e-6/Ang^2",  1.0,    [-inf, inf], "", "Pringle sld"],
67    ["sld_solvent", "1e-6/Ang^2",  6.3,    [-inf, inf], "", "Solvent sld"]
68    ]
69# pylint: enable=bad-whitespace, line-too-long
70
71source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", \
72          "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"]
73
74def ER(radius, thickness):
75    """
76        Return equivalent radius (ER)
77    """
78    ddd = 0.75 * radius * (2 * radius * thickness + (thickness + radius) \
79                           * (thickness + pi * radius))
80    return 0.5 * (ddd) ** (1. / 3.)
81
82demo = dict(background=0.0,
83            scale=1.0,
84            radius=60.0,
85            thickness=10.0,
86            alpha=0.001,
87            beta=0.02,
88            sld_pringle=1.0,
89            sld_solvent=6.35)
90
91oldname = 'PringlesModel'
92oldpars = dict(background='background',
93               scale='scale',
94               radius='radius',
95               thickness='thickness',
96               alpha='alpha',
97               beta='beta',
98               pringle_sld='sld_pringle',
99               solvent_sld='sld_solvent')
100
101tests = [
102    [{'scale' : 1.0,
103      'radius': 60.0,
104      'thickness': 10.0,
105      'alpha': 0.001,
106      'beta': 0.02,
107      'sld_pringle': 1.0,
108      'sld_solvent': 6.3,
109      'background': 6.3,
110     }, 0.1, 16.185532],
111
112    [{'scale' : 1.0,
113      'radius': 60.0,
114      'thickness': 10.0,
115      'alpha': 0.001,
116      'beta': 0.02,
117      'sld_pringle': 1.0,
118      'sld_solvent': 6.3,
119      'background': 6.3,
120     }, 0.01, 297.153496],
121
122    [{'scale' : 1.0,
123      'radius': 60.0,
124      'thickness': 10.0,
125      'alpha': 0.001,
126      'beta': 0.02,
127      'sld_pringle': 1.0,
128      'sld_solvent': 6.3,
129      'background': 6.3,
130     }, 0.001, 324.021256415],
131
132    [{'scale' : 1.0,
133      'radius': 60.0,
134      'thickness': 10.0,
135      'alpha': 0.001,
136      'beta': 0.02,
137      'sld_pringle': 1.0,
138      'sld_solvent': 6.3,
139      'background': 6.3,
140     }, (0.001, 90.0), 6.30000026876],
141]
Note: See TracBrowser for help on using the repository browser.