source: sasmodels/sasmodels/models/pringle.py

Last change on this file was d57b06c, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

Merge remote-tracking branch 'origin/master' into ticket-1263-source-link

  • Property mode set to 100644
File size: 3.7 KB
RevLine 
[9da407c]1r"""
2Definition
3----------
4
[693570c]5The form factor for this bent disc is essentially that of a hyperbolic
6paraboloid and calculated as
[9da407c]7
8.. math::
9
[693570c]10    P(q) = (\Delta \rho )^2 V \int^{\pi/2}_0 d\psi \sin{\psi} sinc^2
[9da407c]11    \left( \frac{qd\cos{\psi}}{2} \right)
12    \left[ \left( S^2_0+C^2_0\right) + 2\sum_{n=1}^{\infty}
[693570c]13     \left( S^2_n+C^2_n\right) \right]
[9da407c]14
15where
16
17.. math::
18
[58c3367]19    C_n = \frac{1}{r^2}\int^{R}_{0} r dr\cos(qr^2\alpha \cos{\psi})
[9da407c]20    J_n\left( qr^2\beta \cos{\psi}\right)
21    J_{2n}\left( qr \sin{\psi}\right)
22
23.. math::
24
[58c3367]25    S_n = \frac{1}{r^2}\int^{R}_{0} r dr\sin(qr^2\alpha \cos{\psi})
[9da407c]26    J_n\left( qr^2\beta \cos{\psi}\right)
27    J_{2n}\left( qr \sin{\psi}\right)
28
[693570c]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
[40a87fa]33Bessel function of the first kind.
[9da407c]34
[693570c]35.. figure:: img/pringles_fig1.png
[9da407c]36
[693570c]37    Schematic of model shape (Graphic from Matt Henderson, matt@matthen.com)
[9da407c]38
39Reference
40---------
41
[0507e09]42.. [#] Karen Edler, Universtiy of Bath, Private Communication. 2012. Derivation by Stefan Alexandru Rautu.
43.. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659
44
45Authorship and Verification
46----------------------------
[693570c]47
[ef07e95]48* **Author:** Andrew Jackson **Date:** 2008
49* **Last Modified by:** Wojciech Wpotrzebowski **Date:** March 20, 2016
50* **Last Reviewed by:** Andrew Jackson **Date:** September 26, 2016
[9da407c]51"""
52
[2d81cfe]53import numpy as np
[b297ba9]54from numpy import inf
[9da407c]55
[693570c]56name = "pringle"
57title = "The Pringle model provides the form factor, $P(q)$, for a 'pringle' \
58or 'saddle-shaped' disc that is bent in two directions."
[9da407c]59description = """\
60
61"""
62category = "shape:cylinder"
63
64# pylint: disable=bad-whitespace, line-too-long
65#   ["name", "units", default, [lower, upper], "type","description"],
66parameters = [
67    ["radius",      "Ang",         60.0,   [0, inf],    "volume", "Pringle radius"],
68    ["thickness",   "Ang",         10.0,   [0, inf],    "volume", "Thickness of pringle"],
[c047acf]69    ["alpha",       "",            0.001,  [-inf, inf], "volume", "Curvature parameter alpha"],
70    ["beta",        "",            0.02,   [-inf, inf], "volume", "Curvature paramter beta"],
[30fbe2e]71    ["sld", "1e-6/Ang^2",  1.0,    [-inf, inf], "sld", "Pringle sld"],
[42356c8]72    ["sld_solvent", "1e-6/Ang^2",  6.3,    [-inf, inf], "sld", "Solvent sld"]
[9da407c]73    ]
74# pylint: enable=bad-whitespace, line-too-long
75
[c047acf]76
[ee60aa7]77source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c",
[b70cb3b]78          "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"]
[a34b811]79radius_effective_modes = [
[b297ba9]80    "equivalent cylinder excluded volume",
81    "equivalent volume sphere",
82    "radius"]
[9da407c]83
[8f04da4]84def random():
[b297ba9]85    """Return a random parameter set for the model."""
[8f04da4]86    alpha, beta = 10**np.random.uniform(-1, 1, size=2)
87    radius = 10**np.random.uniform(1, 3)
88    thickness = 10**np.random.uniform(0.7, 2)
89    pars = dict(
90        radius=radius,
91        thickness=thickness,
92        alpha=alpha,
93        beta=beta,
94    )
95    return pars
[9da407c]96
97tests = [
98    [{'scale' : 1.0,
99      'radius': 60.0,
100      'thickness': 10.0,
101      'alpha': 0.001,
102      'beta': 0.02,
[30fbe2e]103      'sld': 1.0,
[9da407c]104      'sld_solvent': 6.3,
[639042e]105      'background': 0.001,
[5fd684d]106     }, 0.1, 9.87676],
[9da407c]107
108    [{'scale' : 1.0,
109      'radius': 60.0,
110      'thickness': 10.0,
111      'alpha': 0.001,
112      'beta': 0.02,
[30fbe2e]113      'sld': 1.0,
[9da407c]114      'sld_solvent': 6.3,
[639042e]115      'background': 0.001,
[5fd684d]116     }, 0.01, 290.56723],
[9da407c]117
118    [{'scale' : 1.0,
119      'radius': 60.0,
120      'thickness': 10.0,
121      'alpha': 0.001,
122      'beta': 0.02,
[30fbe2e]123      'sld': 1.0,
[9da407c]124      'sld_solvent': 6.3,
[5fd684d]125      'background': 0.001,
126     }, 0.001, 317.40847],
[91b8b80]127]
Note: See TracBrowser for help on using the repository browser.