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: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
19 | DO NOT MODIFY THIS FILE, MODIFY |
---|
20 | src\sans\models\include\csparallelepiped.h |
---|
21 | AND RE-RUN THE GENERATOR SCRIPT |
---|
22 | """ |
---|
23 | |
---|
24 | from sans.models.BaseComponent import BaseComponent |
---|
25 | from sans.models.sans_extension.c_models import CCSParallelepipedModel |
---|
26 | |
---|
27 | def create_CSParallelepipedModel(): |
---|
28 | """ |
---|
29 | Create a model instance |
---|
30 | """ |
---|
31 | obj = CSParallelepipedModel() |
---|
32 | # CCSParallelepipedModel.__init__(obj) is called by |
---|
33 | # the CSParallelepipedModel constructor |
---|
34 | return obj |
---|
35 | |
---|
36 | class CSParallelepipedModel(CCSParallelepipedModel, BaseComponent): |
---|
37 | """ |
---|
38 | Class that evaluates a CSParallelepipedModel model. |
---|
39 | This file was auto-generated from src\sans\models\include\csparallelepiped.h. |
---|
40 | Refer to that file and the structure it contains |
---|
41 | for details of the model. |
---|
42 | List of default parameters: |
---|
43 | scale = 1.0 |
---|
44 | shortA = 35.0 [A] |
---|
45 | midB = 75.0 [A] |
---|
46 | longC = 400.0 [A] |
---|
47 | rimA = 10.0 [A] |
---|
48 | rimB = 10.0 [A] |
---|
49 | rimC = 10.0 [A] |
---|
50 | sld_rimA = 2e-06 [1/A^(2)] |
---|
51 | sld_rimB = 4e-06 [1/A^(2)] |
---|
52 | sld_rimC = 2e-06 [1/A^(2)] |
---|
53 | sld_pcore = 1e-06 [1/A^(2)] |
---|
54 | sld_solv = 6e-06 [1/A^(2)] |
---|
55 | background = 0.06 [1/cm] |
---|
56 | parallel_theta = 0.0 [deg] |
---|
57 | parallel_phi = 0.0 [deg] |
---|
58 | parallel_psi = 0.0 [deg] |
---|
59 | |
---|
60 | """ |
---|
61 | |
---|
62 | def __init__(self, multfactor=1): |
---|
63 | """ Initialization """ |
---|
64 | self.__dict__ = {} |
---|
65 | |
---|
66 | # Initialize BaseComponent first, then sphere |
---|
67 | BaseComponent.__init__(self) |
---|
68 | #apply(CCSParallelepipedModel.__init__, (self,)) |
---|
69 | |
---|
70 | CCSParallelepipedModel.__init__(self) |
---|
71 | self.is_multifunc = False |
---|
72 | |
---|
73 | ## Name of the model |
---|
74 | self.name = "CSParallelepipedModel" |
---|
75 | ## Model description |
---|
76 | self.description = """ |
---|
77 | Form factor for a rectangular Shell. Below are the Parameters. |
---|
78 | scale: scale factor |
---|
79 | shortA: length of short edge [A] |
---|
80 | midB: length of another short edge [A] |
---|
81 | longC: length of long edge of the parallelepiped [A] |
---|
82 | rimA: length of short edge [A] |
---|
83 | rimB: length of another short edge [A] |
---|
84 | rimC: length of long edge of the parallelepiped [A] |
---|
85 | sld_rimA: sld of rimA [1/A^(2)] |
---|
86 | sld_rimB: sld of rimB [1/A^(2)] |
---|
87 | sld_rimC: sld of rimC [1/A^(2)] |
---|
88 | sld_core: Pipe_sld [1/A^(2)] |
---|
89 | sld_solv: solvent_sld [1/A^(2)] |
---|
90 | background: incoherent Background [1/cm] |
---|
91 | """ |
---|
92 | |
---|
93 | ## Parameter details [units, min, max] |
---|
94 | self.details = {} |
---|
95 | self.details['scale'] = ['', None, None] |
---|
96 | self.details['shortA'] = ['[A]', None, None] |
---|
97 | self.details['midB'] = ['[A]', None, None] |
---|
98 | self.details['longC'] = ['[A]', None, None] |
---|
99 | self.details['rimA'] = ['[A]', None, None] |
---|
100 | self.details['rimB'] = ['[A]', None, None] |
---|
101 | self.details['rimC'] = ['[A]', None, None] |
---|
102 | self.details['sld_rimA'] = ['[1/A^(2)]', None, None] |
---|
103 | self.details['sld_rimB'] = ['[1/A^(2)]', None, None] |
---|
104 | self.details['sld_rimC'] = ['[1/A^(2)]', None, None] |
---|
105 | self.details['sld_pcore'] = ['[1/A^(2)]', None, None] |
---|
106 | self.details['sld_solv'] = ['[1/A^(2)]', None, None] |
---|
107 | self.details['background'] = ['[1/cm]', None, None] |
---|
108 | self.details['parallel_theta'] = ['[deg]', None, None] |
---|
109 | self.details['parallel_phi'] = ['[deg]', None, None] |
---|
110 | self.details['parallel_psi'] = ['[deg]', None, None] |
---|
111 | |
---|
112 | ## fittable parameters |
---|
113 | self.fixed = ['shortA.width', |
---|
114 | 'midB.width', |
---|
115 | 'longC.width', |
---|
116 | 'parallel_phi.width', |
---|
117 | 'parallel_psi.width', |
---|
118 | 'parallel_theta.width'] |
---|
119 | |
---|
120 | ## non-fittable parameters |
---|
121 | self.non_fittable = [] |
---|
122 | |
---|
123 | ## parameters with orientation |
---|
124 | self.orientation_params = ['parallel_phi', |
---|
125 | 'parallel_psi', |
---|
126 | 'parallel_theta', |
---|
127 | 'parallel_phi.width', |
---|
128 | 'parallel_psi.width', |
---|
129 | 'parallel_theta.width'] |
---|
130 | |
---|
131 | ## parameters with magnetism |
---|
132 | self.magnetic_params = [] |
---|
133 | |
---|
134 | self.category = None |
---|
135 | self.multiplicity_info = None |
---|
136 | |
---|
137 | def __setstate__(self, state): |
---|
138 | """ |
---|
139 | restore the state of a model from pickle |
---|
140 | """ |
---|
141 | self.__dict__, self.params, self.dispersion = state |
---|
142 | |
---|
143 | def __reduce_ex__(self, proto): |
---|
144 | """ |
---|
145 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
146 | c model. |
---|
147 | """ |
---|
148 | state = (self.__dict__, self.params, self.dispersion) |
---|
149 | return (create_CSParallelepipedModel, tuple(), state, None, None) |
---|
150 | |
---|
151 | def clone(self): |
---|
152 | """ Return a identical copy of self """ |
---|
153 | return self._clone(CSParallelepipedModel()) |
---|
154 | |
---|
155 | def run(self, x=0.0): |
---|
156 | """ |
---|
157 | Evaluate the model |
---|
158 | |
---|
159 | :param x: input q, or [q,phi] |
---|
160 | |
---|
161 | :return: scattering function P(q) |
---|
162 | |
---|
163 | """ |
---|
164 | return CCSParallelepipedModel.run(self, x) |
---|
165 | |
---|
166 | def runXY(self, x=0.0): |
---|
167 | """ |
---|
168 | Evaluate the model in cartesian coordinates |
---|
169 | |
---|
170 | :param x: input q, or [qx, qy] |
---|
171 | |
---|
172 | :return: scattering function P(q) |
---|
173 | |
---|
174 | """ |
---|
175 | return CCSParallelepipedModel.runXY(self, x) |
---|
176 | |
---|
177 | def evalDistribution(self, x): |
---|
178 | """ |
---|
179 | Evaluate the model in cartesian coordinates |
---|
180 | |
---|
181 | :param x: input q[], or [qx[], qy[]] |
---|
182 | |
---|
183 | :return: scattering function P(q[]) |
---|
184 | |
---|
185 | """ |
---|
186 | return CCSParallelepipedModel.evalDistribution(self, x) |
---|
187 | |
---|
188 | def calculate_ER(self): |
---|
189 | """ |
---|
190 | Calculate the effective radius for P(q)*S(q) |
---|
191 | |
---|
192 | :return: the value of the effective radius |
---|
193 | |
---|
194 | """ |
---|
195 | return CCSParallelepipedModel.calculate_ER(self) |
---|
196 | |
---|
197 | def calculate_VR(self): |
---|
198 | """ |
---|
199 | Calculate the volf ratio for P(q)*S(q) |
---|
200 | |
---|
201 | :return: the value of the volf ratio |
---|
202 | |
---|
203 | """ |
---|
204 | return CCSParallelepipedModel.calculate_VR(self) |
---|
205 | |
---|
206 | def set_dispersion(self, parameter, dispersion): |
---|
207 | """ |
---|
208 | Set the dispersion object for a model parameter |
---|
209 | |
---|
210 | :param parameter: name of the parameter [string] |
---|
211 | :param dispersion: dispersion object of type DispersionModel |
---|
212 | |
---|
213 | """ |
---|
214 | return CCSParallelepipedModel.set_dispersion(self, |
---|
215 | parameter, dispersion.cdisp) |
---|
216 | |
---|
217 | |
---|
218 | # End of file |
---|
219 | |
---|