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

Last change on this file since d3e3c46a was d3e3c46a, checked in by ajj, 8 years ago

and fixing the tests in pringle model

  • Property mode set to 100644
File size: 3.5 KB
Line 
1r"""
2Definition
3----------
4
5The form factor for this bent disc is essentially that of a hyperbolic
6paraboloid and calculated as
7
8.. math::
9
10    P(q) = (\Delta \rho )^2 V \int^{\pi/2}_0 d\psi \sin{\psi} sinc^2
11    \left( \frac{qd\cos{\psi}}{2} \right)
12    \left[ \left( S^2_0+C^2_0\right) + 2\sum_{n=1}^{\infty}
13     \left( S^2_n+C^2_n\right) \right]
14
15where
16
17.. math::
18
19    C_n = \int^{R}_{0} r dr\cos(qr^2\alpha \cos{\psi})
20    J_n\left( qr^2\beta \cos{\psi}\right)
21    J_{2n}\left( qr \sin{\psi}\right)
22
23.. math::
24
25    S_n = \int^{R}_{0} r dr\sin(qr^2\alpha \cos{\psi})
26    J_n\left( qr^2\beta \cos{\psi}\right)
27    J_{2n}\left( qr \sin{\psi}\right)
28
29and $\Delta \rho \text{ is } \rho_{pringle}-\rho_{solvent}$, $V$ is the volume of
30the disc, $\psi$ is the angle between the normal to the disc and the q vector,
31$d$ and $R$ are the "pringle" thickness and radius respectively, $\alpha$ and
32$\beta$ are the two curvature parameters, and $J_n$ is the n\ :sup:`th` order
33Bessel function of the first kind.
34
35.. figure:: img/pringles_fig1.png
36
37    Schematic of model shape (Graphic from Matt Henderson, matt@matthen.com)
38
39Reference
40---------
41
42Karen Edler, Universtiy of Bath, Private Communication. 2012.
43Derivation by Stefan Alexandru Rautu.
44
45**Author:** Andrew Jackson **on:** 2008
46
47**Last Modified by:** Wojciech Wpotrzebowski **on:** March 20, 2016
48
49**Last Reviewed by:** Paul Butler **on:** March 21, 2016
50
51"""
52
53from numpy import inf, pi
54
55name = "pringle"
56title = "The Pringle model provides the form factor, $P(q)$, for a 'pringle' \
57or 'saddle-shaped' disc that is bent in two directions."
58description = """\
59
60"""
61category = "shape:cylinder"
62
63# pylint: disable=bad-whitespace, line-too-long
64#   ["name", "units", default, [lower, upper], "type","description"],
65parameters = [
66    ["radius",      "Ang",         60.0,   [0, inf],    "volume", "Pringle radius"],
67    ["thickness",   "Ang",         10.0,   [0, inf],    "volume", "Thickness of pringle"],
68    ["alpha",       "",            0.001,  [-inf, inf], "volume", "Curvature parameter alpha"],
69    ["beta",        "",            0.02,   [-inf, inf], "volume", "Curvature paramter beta"],
70    ["sld_pringle", "1e-6/Ang^2",  1.0,    [-inf, inf], "sld", "Pringle sld"],
71    ["sld_solvent", "1e-6/Ang^2",  6.3,    [-inf, inf], "sld", "Solvent sld"]
72    ]
73# pylint: enable=bad-whitespace, line-too-long
74
75
76source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", \
77          "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"]
78
79def ER(radius, thickness, alpha, beta):
80    """
81    Return equivalent radius (ER)
82    """
83    ddd = 0.75 * radius * (2 * radius * thickness + (thickness + radius) \
84                           * (thickness + pi * radius))
85    return 0.5 * (ddd) ** (1. / 3.)
86
87demo = dict(background=0.0,
88            scale=1.0,
89            radius=60.0,
90            thickness=10.0,
91            alpha=0.001,
92            beta=0.02,
93            sld_pringle=1.0,
94            sld_solvent=6.35)
95
96tests = [
97    [{'scale' : 1.0,
98      'radius': 60.0,
99      'thickness': 10.0,
100      'alpha': 0.001,
101      'beta': 0.02,
102      'sld_pringle': 1.0,
103      'sld_solvent': 6.3,
104      'background': 0.001,
105     }, 0.1, 9.88653],
106
107    [{'scale' : 1.0,
108      'radius': 60.0,
109      'thickness': 10.0,
110      'alpha': 0.001,
111      'beta': 0.02,
112      'sld_pringle': 1.0,
113      'sld_solvent': 6.3,
114      'background': 0.001,
115     }, 0.01, 290.854],
116
117    [{'scale' : 1.0,
118      'radius': 60.0,
119      'thickness': 10.0,
120      'alpha': 0.001,
121      'beta': 0.02,
122      'sld_pringle': 1.0,
123      'sld_solvent': 6.3,
124      'background': 6.3,
125     }, 0.001, 317.935],
126]
Note: See TracBrowser for help on using the repository browser.