source: sasmodels/sasmodels/models/core_shell_ellipsoid_xt.py @ e481a39

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

rename params and sort equations in docs for core_shell_ellipsoid

  • Property mode set to 100644
File size: 6.0 KB
Line 
1r"""
2An alternative version of $P(q)$ for the core_shell_ellipsoid
3having as parameters the core axial ratio X and a shell thickness,
4which 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 core_shell_ellipsoid model.
8
9Definition
10----------
11
12.. figure:: img/core_shell_ellipsoid_geometry.png
13
14The geometric parameters of this model are
15
16*equat_core =* equatorial core radius *= R_minor_core*
17
18*X_core = polar_core / equat_core = Rmajor_core / Rminor_core*
19
20*T_shell = equat_outer - equat_core = Rminor_outer - Rminor_core*
21
22*XpolarShell = Tpolar_shell / T_shell = (Rmajor_outer - Rmajor_core)/
23(Rminor_outer - Rminor_core)*
24
25In terms of the original radii
26
27*polar_core = equat_core * X_core*
28
29*equat_shell = equat_core + T_shell*
30
31*polar_shell = equat_core * X_core + T_shell * XpolarShell*
32
33(where we note that "shell" perhaps confusingly, relates to the outer radius)
34When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate.
35*X_core = 1* is a spherical core.
36
37For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness
38pro-rata with the radius *XpolarShell = X_core*.
39
40When including an $S(q)$, the radius in $S(q)$ is calculated to be that of
41a sphere with the same 2nd virial coefficient of the outer surface of the
42ellipsoid. This may have some undesirable effects if the aspect ratio of the
43ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$
44- which assumes spheres - will not in any case be valid.
45
46If SAS data are in absolute units, and the SLDs are correct, then scale should
47be the total volume fraction of the "outer particle". When $S(q)$ is introduced
48this moves to the $S(q)$ volume fraction, and scale should then be 1.0,
49or contain some other units conversion factor (for example, if you have SAXS data).
50
51References
52----------
53
54R K Heenan, 2015, reparametrised the core_shell_ellipsoid model
55
56"""
57
58from numpy import inf, sin, cos, pi
59
60name = "core_shell_ellipsoid_xt"
61title = "Form factor for an spheroid ellipsoid particle with a core shell structure."
62description = """
63        [core_shell_ellipsoid_xt] Calculates the form factor for an spheroid
64        ellipsoid particle with a core_shell structure.
65        The form factor is averaged over all possible
66        orientations of the ellipsoid such that P(q)
67        = scale*<f^2>/Vol + bkg, where f is the
68        single particle scattering amplitude.
69        [Parameters]:
70        equat_core = equatorial radius of core,
71        x_core = ratio of core polar/equatorial radii,
72        t_shell = equatorial radius of outer surface,
73        x_polar_shell = ratio of polar shell thickness to equatorial shell thickness,
74        sld_core = SLD_core
75        sld_shell = SLD_shell
76        sld_solvent = SLD_solvent
77        background = Incoherent bkg
78        scale =scale
79        Note:It is the users' responsibility to ensure
80        that shell radii are larger than core radii.
81        oblate: polar radius < equatorial radius
82        prolate :  polar radius > equatorial radius - this new model will make this easier
83        and polydispersity integrals more logical (as previously the shell could disappear).
84    """
85category = "shape:ellipsoid"
86
87# pylint: disable=bad-whitespace, line-too-long
88#             ["name", "units", default, [lower, upper], "type", "description"],
89parameters = [
90    ["equat_core",    "Ang",       20,   [0, inf],    "volume",      "Equatorial radius of core"],
91    ["x_core",        "None",       3,   [0, inf],    "volume",      "Polar radius of core"],
92    ["t_shell",       "Ang",       30,   [0, inf],    "volume",      "Equatorial radius of shell"],
93    ["x_polar_shell", "",           1,   [0, inf],    "volume",      "Polar radius of shell"],
94    ["sld_core",      "1e-6/Ang^2", 2,   [-inf, inf], "",            "Core scattering length density"],
95    ["sld_shell",     "1e-6/Ang^2", 1,   [-inf, inf], "",            "Shell scattering length density"],
96    ["sld_solvent",   "1e-6/Ang^2", 6.3, [-inf, inf], "",            "Solvent scattering length density"],
97    ["theta",         "degrees",    0,   [-inf, inf], "orientation", "Oblate orientation wrt incoming beam"],
98    ["phi",           "degrees",    0,   [-inf, inf], "orientation", "Oblate orientation in the plane of the detector"],
99    ]
100# pylint: enable=bad-whitespace, line-too-long
101
102source = ["lib/sph_j1c.c", "lib/gfn.c", "lib/gauss76.c",
103          "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            sld_core=2.0,
111            sld_shell=1.0,
112            sld_solvent=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               sld_core='sld_core',
122               sld_shell='sld_shell',
123               sld_solvent='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      'sld_core': 2.0,
139      'sld_shell': 1.0,
140      'sld_solvent': 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      'sld_core': 20.0,
153      'sld_shell': 10.0,
154      'sld_solvent': 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      'sld_core': 20.0,
166      'sld_shell': 10.0,
167      'sld_solvent': 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.