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\RectangularHollowPrism.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 CRectangularHollowPrismModel |
---|
28 | |
---|
29 | def create_RectangularHollowPrismModel(): |
---|
30 | """ |
---|
31 | Create a model instance |
---|
32 | """ |
---|
33 | obj = RectangularHollowPrismModel() |
---|
34 | # CRectangularHollowPrismModel.__init__(obj) is called by |
---|
35 | # the RectangularHollowPrismModel constructor |
---|
36 | return obj |
---|
37 | |
---|
38 | class RectangularHollowPrismModel(CRectangularHollowPrismModel, BaseComponent): |
---|
39 | """ |
---|
40 | Class that evaluates a RectangularHollowPrismModel model. |
---|
41 | This file was auto-generated from src\sans\models\include\RectangularHollowPrism.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 = 1.0 |
---|
48 | * short_side = 35.0 [A] |
---|
49 | * b2a_ratio = 1.0 [adim] |
---|
50 | * c2a_ratio = 1.0 [adim] |
---|
51 | * thickness = 1.0 [A] |
---|
52 | * sldPipe = 6.3e-06 [1/A^(2)] |
---|
53 | * sldSolv = 1e-06 [1/A^(2)] |
---|
54 | * background = 0.0 [1/cm] |
---|
55 | |
---|
56 | """ |
---|
57 | |
---|
58 | def __init__(self, multfactor=1): |
---|
59 | """ Initialization """ |
---|
60 | self.__dict__ = {} |
---|
61 | |
---|
62 | # Initialize BaseComponent first, then sphere |
---|
63 | BaseComponent.__init__(self) |
---|
64 | #apply(CRectangularHollowPrismModel.__init__, (self,)) |
---|
65 | |
---|
66 | CRectangularHollowPrismModel.__init__(self) |
---|
67 | self.is_multifunc = False |
---|
68 | |
---|
69 | ## Name of the model |
---|
70 | self.name = "RectangularHollowPrismModel" |
---|
71 | ## Model description |
---|
72 | self.description = """ |
---|
73 | Form factor for a hollow rectangular prism with uniform scattering length density. |
---|
74 | scale:Scale factor |
---|
75 | short_side: shortest side of the rectangular prism [A] |
---|
76 | b2a_ratio: ratio b/a [adim] |
---|
77 | c2a_ratio: ratio c/a [adim] |
---|
78 | thickness: thickness of the walls [A] |
---|
79 | sldPipe: Pipe_sld |
---|
80 | sldSolv: solvent_sld |
---|
81 | background:Incoherent Background [1/cm] |
---|
82 | """ |
---|
83 | |
---|
84 | ## Parameter details [units, min, max] |
---|
85 | self.details = {} |
---|
86 | self.details['scale'] = ['', None, None] |
---|
87 | self.details['short_side'] = ['[A]', None, None] |
---|
88 | self.details['b2a_ratio'] = ['[adim]', None, None] |
---|
89 | self.details['c2a_ratio'] = ['[adim]', None, None] |
---|
90 | self.details['thickness'] = ['[A]', None, None] |
---|
91 | self.details['sldPipe'] = ['[1/A^(2)]', None, None] |
---|
92 | self.details['sldSolv'] = ['[1/A^(2)]', None, None] |
---|
93 | self.details['background'] = ['[1/cm]', None, None] |
---|
94 | |
---|
95 | ## fittable parameters |
---|
96 | self.fixed = ['short_side.width', |
---|
97 | 'b2a_ratio.width', |
---|
98 | 'c2a_ratio.width', |
---|
99 | 'thicness.width'] |
---|
100 | |
---|
101 | ## non-fittable parameters |
---|
102 | self.non_fittable = [] |
---|
103 | |
---|
104 | ## parameters with orientation |
---|
105 | self.orientation_params = [] |
---|
106 | |
---|
107 | ## parameters with magnetism |
---|
108 | self.magnetic_params = [] |
---|
109 | |
---|
110 | self.category = None |
---|
111 | self.multiplicity_info = None |
---|
112 | |
---|
113 | def __setstate__(self, state): |
---|
114 | """ |
---|
115 | restore the state of a model from pickle |
---|
116 | """ |
---|
117 | self.__dict__, self.params, self.dispersion = state |
---|
118 | |
---|
119 | def __reduce_ex__(self, proto): |
---|
120 | """ |
---|
121 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
122 | c model. |
---|
123 | """ |
---|
124 | state = (self.__dict__, self.params, self.dispersion) |
---|
125 | return (create_RectangularHollowPrismModel, tuple(), state, None, None) |
---|
126 | |
---|
127 | def clone(self): |
---|
128 | """ Return a identical copy of self """ |
---|
129 | return self._clone(RectangularHollowPrismModel()) |
---|
130 | |
---|
131 | def run(self, x=0.0): |
---|
132 | """ |
---|
133 | Evaluate the model |
---|
134 | |
---|
135 | :param x: input q, or [q,phi] |
---|
136 | |
---|
137 | :return: scattering function P(q) |
---|
138 | |
---|
139 | """ |
---|
140 | return CRectangularHollowPrismModel.run(self, x) |
---|
141 | |
---|
142 | def runXY(self, x=0.0): |
---|
143 | """ |
---|
144 | Evaluate the model in cartesian coordinates |
---|
145 | |
---|
146 | :param x: input q, or [qx, qy] |
---|
147 | |
---|
148 | :return: scattering function P(q) |
---|
149 | |
---|
150 | """ |
---|
151 | return CRectangularHollowPrismModel.runXY(self, x) |
---|
152 | |
---|
153 | def evalDistribution(self, x): |
---|
154 | """ |
---|
155 | Evaluate the model in cartesian coordinates |
---|
156 | |
---|
157 | :param x: input q[], or [qx[], qy[]] |
---|
158 | |
---|
159 | :return: scattering function P(q[]) |
---|
160 | |
---|
161 | """ |
---|
162 | return CRectangularHollowPrismModel.evalDistribution(self, x) |
---|
163 | |
---|
164 | def calculate_ER(self): |
---|
165 | """ |
---|
166 | Calculate the effective radius for P(q)*S(q) |
---|
167 | |
---|
168 | :return: the value of the effective radius |
---|
169 | |
---|
170 | """ |
---|
171 | return CRectangularHollowPrismModel.calculate_ER(self) |
---|
172 | |
---|
173 | def calculate_VR(self): |
---|
174 | """ |
---|
175 | Calculate the volf ratio for P(q)*S(q) |
---|
176 | |
---|
177 | :return: the value of the volf ratio |
---|
178 | |
---|
179 | """ |
---|
180 | return CRectangularHollowPrismModel.calculate_VR(self) |
---|
181 | |
---|
182 | def set_dispersion(self, parameter, dispersion): |
---|
183 | """ |
---|
184 | Set the dispersion object for a model parameter |
---|
185 | |
---|
186 | :param parameter: name of the parameter [string] |
---|
187 | :param dispersion: dispersion object of type DispersionModel |
---|
188 | |
---|
189 | """ |
---|
190 | return CRectangularHollowPrismModel.set_dispersion(self, |
---|
191 | parameter, dispersion.cdisp) |
---|
192 | |
---|
193 | |
---|
194 | # End of file |
---|
195 | |
---|