source: sasmodels/sasmodels/models/core_shell_ellipsoid_xt.py @ 81bb668

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

Converted CoreShellEllipsoidXt?

  • Property mode set to 100644
File size: 5.9 KB
Line 
1r"""
2An alternative version of $P(q)$ for the core-shell ellipsoid
3(see CoreShellEllipsoidModel), having as parameters the core axial ratio X
4and a shell thickness, which are more often what we would like to determine.
5
6This model is also better behaved when polydispersity is applied than the four
7independent radii in CoreShellEllipsoidModel.
8
9Definition
10----------
11
12.. figure:: img/core_shell_ellipsoid_fig1.gif
13
14
15The geometric parameters of this model are
16
17*equat_core =* equatorial core radius *= R_minor_core*
18
19*X_core = polar_core / equat_core = Rmajor_core / Rminor_core*
20
21*T_shell = equat_outer - equat_core = Rminor_outer - Rminor_core*
22
23*XpolarShell = Tpolar_shell / T_shell = (Rmajor_outer - Rmajor_core)/
24(Rminor_outer - Rminor_core)*
25
26In terms of the original radii
27
28*polar_core = equat_core * X_core*
29
30*equat_shell = equat_core + T_shell*
31
32*polar_shell = equat_core * X_core + T_shell * XpolarShell*
33
34(where we note that "shell" perhaps confusingly, relates to the outer radius)
35When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate.
36*X_core = 1* is a spherical core.
37
38For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness
39pro-rata with the radius *XpolarShell = X_core*.
40
41When including an $S(q)$, the radius in $S(q)$ is calculated to be that of
42a sphere with the same 2nd virial coefficient of the outer surface of the
43ellipsoid. This may have some undesirable effects if the aspect ratio of the
44ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$
45- which assumes spheres - will not in any case be valid.
46
47If SAS data are in absolute units, and the SLDs are correct, then scale should
48be the total volume fraction of the "outer particle". When $S(q)$ is introduced
49this moves to the $S(q)$ volume fraction, and scale should then be 1.0,
50or contain some other units conversion factor (for example, if you have SAXS data).
51
52References
53----------
54
55R K Heenan, *Private communication*
56
57"""
58
59from numpy import inf, sin, cos, pi
60
61name = "core_shell_ellipsoid_xt"
62title = "Form factor for an spheroid ellipsoid particle with a core shell structure."
63description = """
64        [core_shell_ellipsoid_xt] Calculates the form factor for an spheroid
65        ellipsoid particle with a core_shell structure.
66        The form factor is averaged over all possible
67        orientations of the ellipsoid such that P(q)
68        = scale*<f^2>/Vol + bkg, where f is the
69        single particle scattering amplitude.
70        [Parameters]:
71        equat_core = equatorial radius of core,
72        x_core = polar radius of core,
73        t_shell = equatorial radius of outer surface,
74        x_polar_shell = polar radius (revolution axis) of outer surface
75        core_sld = SLD_core
76        shell_sld = SLD_shell
77        solvent_sld = SLD_solvent
78        background = Incoherent bkg
79        scale =scale
80        Note:It is the users' responsibility to ensure
81        that shell radii are larger than core radii.
82        oblate: polar radius < equatorial radius
83        prolate :  polar radius > equatorial radius - this new model will make this easier
84        and polydispersity integrals more logical (as previously the shell could disappear).
85    """
86category = "shape:ellipsoid"
87
88# pylint: disable=bad-whitespace, line-too-long
89#             ["name", "units", default, [lower, upper], "type", "description"],
90parameters = [
91    ["equat_core",    "Ang",       20,   [0, inf],    "volume",      "Equatorial radius of core"],
92    ["x_core",        "None",       3,   [0, inf],    "volume",      "Polar radius of core"],
93    ["t_shell",       "Ang",       30,   [0, inf],    "volume",      "Equatorial radius of shell"],
94    ["x_polar_shell", "",           1,   [0, inf],    "volume",      "Polar radius of shell"],
95    ["core_sld",      "1e-6/Ang^2", 2,   [-inf, inf], "",            "Core scattering length density"],
96    ["shell_sld",     "1e-6/Ang^2", 1,   [-inf, inf], "",            "Shell scattering length density"],
97    ["solvent_sld",   "1e-6/Ang^2", 6.3, [-inf, inf], "",            "Solvent scattering length density"],
98    ["theta",         "degrees",    0,   [-inf, inf], "orientation", "Oblate orientation wrt incoming beam"],
99    ["phi",           "degrees",    0,   [-inf, inf], "orientation", "Oblate orientation in the plane of the detector"],
100    ]
101# pylint: enable=bad-whitespace, line-too-long
102
103source = ["lib/gfn.c", "lib/gauss76.c", "core_shell_ellipsoid_xt.c"]
104
105demo = dict(scale=0.05, background=0.001,
106            equat_core=20.0,
107            x_core=3.0,
108            t_shell=30.0,
109            x_polar_shell=1.0,
110            core_sld=2.0,
111            shell_sld=1.0,
112            solvent_sld=6.3,
113            theta=0,
114            phi=0)
115
116oldname = 'CoreShellEllipsoidXTModel'
117
118oldpars = dict(x_polar_shell='XpolarShell',
119               x_core='X_core',
120               t_shell='T_shell',
121               core_sld='sld_core',
122               shell_sld='sld_shell',
123               solvent_sld='sld_solvent',
124               theta='axis_theta',
125               phi='axis_phi')
126
127q = 0.1
128phi = pi/6
129qx = q*cos(phi)
130qy = q*sin(phi)
131
132tests = [
133    # Accuracy tests based on content in test/utest_coreshellellipsoidXTmodel.py
134    [{'equat_core': 200.0,
135      'x_core': 0.1,
136      't_shell': 50.0,
137      'x_polar_shell': 0.2,
138      'core_sld': 2.0,
139      'shell_sld': 1.0,
140      'solvent_sld': 6.3,
141      'background': 0.001,
142      'scale': 1.0,
143     }, 1.0, 0.00189402],
144
145    # Additional tests with larger range of parameters
146    [{'background': 0.01}, 0.1, 11.6915],
147
148    [{'equat_core': 20.0,
149      'x_core': 200.0,
150      't_shell': 54.0,
151      'x_polar_shell': 3.0,
152      'core_sld': 20.0,
153      'shell_sld': 10.0,
154      'solvent_sld': 6.0,
155      'background': 0.0,
156      'scale': 1.0,
157     }, 0.01, 8688.53],
158
159    [{'background': 0.001}, (0.4, 0.5), 0.00690673],
160
161    [{'equat_core': 20.0,
162      'x_core': 200.0,
163      't_shell': 54.0,
164      'x_polar_shell': 3.0,
165      'core_sld': 20.0,
166      'shell_sld': 10.0,
167      'solvent_sld': 6.0,
168      'background': 0.01,
169      'scale': 0.01,
170     }, (qx, qy), 0.0100002],
171    ]
Note: See TracBrowser for help on using the repository browser.