1 | ############################################################################## |
---|
2 | # This software was developed by the University of Tennessee as part of the |
---|
3 | # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
4 | # project funded by the US National Science Foundation. |
---|
5 | # |
---|
6 | # If you use DANSE applications to do scientific research that leads to |
---|
7 | # publication, we ask that you acknowledge the use of the software with the |
---|
8 | # following sentence: |
---|
9 | # |
---|
10 | # This work benefited from DANSE software developed under NSF award DMR-0520547 |
---|
11 | # |
---|
12 | # Copyright 2008-2011, University of Tennessee |
---|
13 | ############################################################################## |
---|
14 | |
---|
15 | """ |
---|
16 | Provide functionality for a C extension model |
---|
17 | |
---|
18 | .. WARNING:: |
---|
19 | |
---|
20 | THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
21 | DO NOT MODIFY THIS FILE, MODIFY |
---|
22 | src\sans\models\include\spheroidXT.h |
---|
23 | AND RE-RUN THE GENERATOR SCRIPT |
---|
24 | """ |
---|
25 | |
---|
26 | from sans.models.BaseComponent import BaseComponent |
---|
27 | from sans.models.sans_extension.c_models import CCoreShellEllipsoidXTModel |
---|
28 | |
---|
29 | def create_CoreShellEllipsoidXTModel(): |
---|
30 | """ |
---|
31 | Create a model instance |
---|
32 | """ |
---|
33 | obj = CoreShellEllipsoidXTModel() |
---|
34 | # CCoreShellEllipsoidXTModel.__init__(obj) is called by |
---|
35 | # the CoreShellEllipsoidXTModel constructor |
---|
36 | return obj |
---|
37 | |
---|
38 | class CoreShellEllipsoidXTModel(CCoreShellEllipsoidXTModel, BaseComponent): |
---|
39 | """ |
---|
40 | Class that evaluates a CoreShellEllipsoidXTModel model. |
---|
41 | This file was auto-generated from src\sans\models\include\spheroidXT.h. |
---|
42 | Refer to that file and the structure it contains |
---|
43 | for details of the model. |
---|
44 | |
---|
45 | List of default parameters: |
---|
46 | |
---|
47 | * scale = 0.05 |
---|
48 | * equat_core = 20.0 [A] |
---|
49 | * X_core = 3.0 |
---|
50 | * T_shell = 30.0 [A] |
---|
51 | * XpolarShell = 1.0 |
---|
52 | * sld_core = 2e-06 [1/A^(2)] |
---|
53 | * sld_shell = 1e-06 [1/A^(2)] |
---|
54 | * sld_solvent = 6.3e-06 [1/A^(2)] |
---|
55 | * background = 0.001 [1/cm] |
---|
56 | * axis_theta = 0.0 [deg] |
---|
57 | * axis_phi = 0.0 [deg] |
---|
58 | |
---|
59 | """ |
---|
60 | |
---|
61 | def __init__(self, multfactor=1): |
---|
62 | """ Initialization """ |
---|
63 | self.__dict__ = {} |
---|
64 | |
---|
65 | # Initialize BaseComponent first, then sphere |
---|
66 | BaseComponent.__init__(self) |
---|
67 | #apply(CCoreShellEllipsoidXTModel.__init__, (self,)) |
---|
68 | |
---|
69 | CCoreShellEllipsoidXTModel.__init__(self) |
---|
70 | self.is_multifunc = False |
---|
71 | |
---|
72 | ## Name of the model |
---|
73 | self.name = "CoreShellEllipsoidXTModel" |
---|
74 | ## Model description |
---|
75 | self.description = """ |
---|
76 | [SpheroidCoreShellModel] Calculates the form factor for an spheroid |
---|
77 | ellipsoid particle with a core_shell structure. |
---|
78 | The form factor is averaged over all possible |
---|
79 | orientations of the ellipsoid such that P(q) |
---|
80 | = scale*<f^2>/Vol + bkg, where f is the |
---|
81 | single particle scattering amplitude. |
---|
82 | [Parameters]: |
---|
83 | equat_core = equatorial radius of core, |
---|
84 | polar_core = polar radius of core = equat_core*X_core, |
---|
85 | equat_shell = equatorial radius of outer surface = equat_core + T_shell, |
---|
86 | polar_shell = polar radius (revolution axis) of outer surface = equat_core*X_core + XpolarShell*T_shell |
---|
87 | sld_core = SLD_core |
---|
88 | sld_shell = SLD_shell |
---|
89 | sld_solvent = SLD_solvent |
---|
90 | background = Incoherent bkg |
---|
91 | scale =scale |
---|
92 | Note:It is the users' responsibility to ensure |
---|
93 | that shell radii are larger than core radii. |
---|
94 | oblate: polar radius < equatorial radius |
---|
95 | prolate : polar radius > equatorial radius - this new model will make this easier |
---|
96 | and polydispersity integrals more logical (as previously the shell could disappear). |
---|
97 | """ |
---|
98 | |
---|
99 | ## Parameter details [units, min, max] |
---|
100 | self.details = {} |
---|
101 | self.details['scale'] = ['', None, None] |
---|
102 | self.details['equat_core'] = ['[A]', None, None] |
---|
103 | self.details['X_core'] = ['', None, None] |
---|
104 | self.details['T_shell'] = ['[A]', None, None] |
---|
105 | self.details['XpolarShell'] = ['', None, None] |
---|
106 | self.details['sld_core'] = ['[1/A^(2)]', None, None] |
---|
107 | self.details['sld_shell'] = ['[1/A^(2)]', None, None] |
---|
108 | self.details['sld_solvent'] = ['[1/A^(2)]', None, None] |
---|
109 | self.details['background'] = ['[1/cm]', None, None] |
---|
110 | self.details['axis_theta'] = ['[deg]', None, None] |
---|
111 | self.details['axis_phi'] = ['[deg]', None, None] |
---|
112 | |
---|
113 | ## fittable parameters |
---|
114 | self.fixed = ['equat_core.width', |
---|
115 | 'X_core.width', |
---|
116 | 'T_shell.width', |
---|
117 | 'Xpolarshell.width', |
---|
118 | 'axis_phi.width', |
---|
119 | 'axis_theta.width'] |
---|
120 | |
---|
121 | ## non-fittable parameters |
---|
122 | self.non_fittable = [] |
---|
123 | |
---|
124 | ## parameters with orientation |
---|
125 | self.orientation_params = ['axis_phi', |
---|
126 | 'axis_theta', |
---|
127 | 'axis_phi.width', |
---|
128 | 'axis_theta.width'] |
---|
129 | |
---|
130 | ## parameters with magnetism |
---|
131 | self.magnetic_params = [] |
---|
132 | |
---|
133 | self.category = None |
---|
134 | self.multiplicity_info = None |
---|
135 | |
---|
136 | def __setstate__(self, state): |
---|
137 | """ |
---|
138 | restore the state of a model from pickle |
---|
139 | """ |
---|
140 | self.__dict__, self.params, self.dispersion = state |
---|
141 | |
---|
142 | def __reduce_ex__(self, proto): |
---|
143 | """ |
---|
144 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
145 | c model. |
---|
146 | """ |
---|
147 | state = (self.__dict__, self.params, self.dispersion) |
---|
148 | return (create_CoreShellEllipsoidXTModel, tuple(), state, None, None) |
---|
149 | |
---|
150 | def clone(self): |
---|
151 | """ Return a identical copy of self """ |
---|
152 | return self._clone(CoreShellEllipsoidXTModel()) |
---|
153 | |
---|
154 | def run(self, x=0.0): |
---|
155 | """ |
---|
156 | Evaluate the model |
---|
157 | |
---|
158 | :param x: input q, or [q,phi] |
---|
159 | |
---|
160 | :return: scattering function P(q) |
---|
161 | |
---|
162 | """ |
---|
163 | return CCoreShellEllipsoidXTModel.run(self, x) |
---|
164 | |
---|
165 | def runXY(self, x=0.0): |
---|
166 | """ |
---|
167 | Evaluate the model in cartesian coordinates |
---|
168 | |
---|
169 | :param x: input q, or [qx, qy] |
---|
170 | |
---|
171 | :return: scattering function P(q) |
---|
172 | |
---|
173 | """ |
---|
174 | return CCoreShellEllipsoidXTModel.runXY(self, x) |
---|
175 | |
---|
176 | def evalDistribution(self, x): |
---|
177 | """ |
---|
178 | Evaluate the model in cartesian coordinates |
---|
179 | |
---|
180 | :param x: input q[], or [qx[], qy[]] |
---|
181 | |
---|
182 | :return: scattering function P(q[]) |
---|
183 | |
---|
184 | """ |
---|
185 | return CCoreShellEllipsoidXTModel.evalDistribution(self, x) |
---|
186 | |
---|
187 | def calculate_ER(self): |
---|
188 | """ |
---|
189 | Calculate the effective radius for P(q)*S(q) |
---|
190 | |
---|
191 | :return: the value of the effective radius |
---|
192 | |
---|
193 | """ |
---|
194 | return CCoreShellEllipsoidXTModel.calculate_ER(self) |
---|
195 | |
---|
196 | def calculate_VR(self): |
---|
197 | """ |
---|
198 | Calculate the volf ratio for P(q)*S(q) |
---|
199 | |
---|
200 | :return: the value of the volf ratio |
---|
201 | |
---|
202 | """ |
---|
203 | return CCoreShellEllipsoidXTModel.calculate_VR(self) |
---|
204 | |
---|
205 | def set_dispersion(self, parameter, dispersion): |
---|
206 | """ |
---|
207 | Set the dispersion object for a model parameter |
---|
208 | |
---|
209 | :param parameter: name of the parameter [string] |
---|
210 | :param dispersion: dispersion object of type DispersionModel |
---|
211 | |
---|
212 | """ |
---|
213 | return CCoreShellEllipsoidXTModel.set_dispersion(self, |
---|
214 | parameter, dispersion.cdisp) |
---|
215 | |
---|
216 | |
---|
217 | # End of file |
---|
218 | |
---|