source: sasmodels/sasmodels/models/teubner_strey.py @ eb69cce

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since eb69cce was eb69cce, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

make model docs more consistent; build pdf docs

  • Property mode set to 100644
File size: 2.2 KB
Line 
1r"""
2Definition
3----------
4
5This model calculates the scattered intensity of a two-component system
6using the Teubner-Strey model. Unlike :ref:`dab` this function generates
7a peak.
8
9.. math::
10
11    I(q) = \frac{1}{a_2 + c_1 q^2 + c_2 q^4} + \text{background}
12
13The parameters $a_2$, $c_1$ and $c_2$ can be used to determine the
14characteristic domain size $d$,
15
16.. math::
17
18    d = 2\pi\left[\frac12\left(\frac{a_2}{c_2}\right)^{1/2}
19                  + \frac14\frac{c_1}{c_2}\right]^{-1/2}
20
21
22and the correlation length $\xi$,
23
24.. math::
25
26    \xi = \left[\frac12\left(\frac{a_2}{c_2}\right)^{1/2}
27                  - \frac14\frac{c_1}{c_2}\right]^{-1/2}
28
29
30For 2D data, scattering intensity is calculated in the same way as 1D,
31where the $q$ vector is defined as
32
33.. math::
34
35    q = \sqrt{q_x^2 + q_y^2}
36
37
38.. figure:: img/teubner_strey_1d.jpg
39
40    1D plot using the default values (w/200 data point).
41
42References
43----------
44
45M Teubner, R Strey, *J. Chem. Phys.*, 87 (1987) 3195
46
47K V Schubert, R Strey, S R Kline and E W Kaler,
48*J. Chem. Phys.*, 101 (1994) 5343
49
50"""
51
52import numpy as np
53from numpy import inf, sqrt
54
55name = "teubner_strey"
56title = "Teubner-Strey model of microemulsions"
57description = """\
58   Scattering model class for the Teubner-Strey model given by
59    Provide F(x) = 1/( a2 + c1 q^2+  c2 q^4 ) + background
60    a2>0, c1<0, c2>0, 4 a2 c2 - c1^2 > 0
61"""
62category = "shape-independent"
63
64#             ["name", "units", default, [lower, upper], "type","description"],
65parameters = [["a2", "", 0.1, [0, inf], "",
66               "a2"],
67              ["c1", "1e-6/Ang^2", -30., [-inf, 0], "",
68               "c1"],
69              ["c2", "Ang", 5000., [0, inf], "volume",
70               "c2"],
71             ]
72
73
74def form_volume(radius):
75    return 1.0
76
77def Iq(q, a2, c1, c2):
78    return 1. / np.polyval([c2, c1, a2], q**2)
79Iq.vectorized = True  # Iq accepts an array of q values
80
81def Iqxy(qx, qy, a2, c1, c2):
82    return Iq(sqrt(qx**2 + qy**2), a2, c1, c2)
83Iqxy.vectorized = True  # Iqxy accepts arrays of qx, qy values
84
85# ER defaults to 0.0
86
87# VR defaults to 1.0
88
89demo = dict(scale=1, background=0, a2=0.1, c1=-30.0, c2=5000.0)
90oldname = "TeubnerStreyModel"
91oldpars = dict(a2='scale')
92
93tests = [[{}, 0.2, 0.144927536232]]
Note: See TracBrowser for help on using the repository browser.