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\lamellarPC.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 CLamellarPCrystalModel |
---|
28 | |
---|
29 | def create_LamellarPCrystalModel(): |
---|
30 | """ |
---|
31 | Create a model instance |
---|
32 | """ |
---|
33 | obj = LamellarPCrystalModel() |
---|
34 | # CLamellarPCrystalModel.__init__(obj) is called by |
---|
35 | # the LamellarPCrystalModel constructor |
---|
36 | return obj |
---|
37 | |
---|
38 | class LamellarPCrystalModel(CLamellarPCrystalModel, BaseComponent): |
---|
39 | """ |
---|
40 | Class that evaluates a LamellarPCrystalModel model. |
---|
41 | This file was auto-generated from src\sans\models\include\lamellarPC.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 | * thickness = 33.0 [A] |
---|
49 | * Nlayers = 20.0 |
---|
50 | * spacing = 250.0 [A] |
---|
51 | * pd_spacing = 0.0 |
---|
52 | * sld_layer = 1e-06 [1/A^(2)] |
---|
53 | * sld_solvent = 6.34e-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(CLamellarPCrystalModel.__init__, (self,)) |
---|
65 | |
---|
66 | CLamellarPCrystalModel.__init__(self) |
---|
67 | self.is_multifunc = False |
---|
68 | |
---|
69 | ## Name of the model |
---|
70 | self.name = "LamellarPCrystalModel" |
---|
71 | ## Model description |
---|
72 | self.description = """ |
---|
73 | [Lamellar ParaCrystal Model] Parameter Definitions: scale = scale factor, |
---|
74 | background = incoherent background |
---|
75 | thickness = lamellar thickness, |
---|
76 | sld_layer = layer scattering length density , |
---|
77 | sld_solvent = solvent scattering length density. |
---|
78 | Nlayers = no. of lamellar layers |
---|
79 | spacing = spacing between layers |
---|
80 | pd_spacing = polydispersity of spacing |
---|
81 | Note: This model can be used for large |
---|
82 | multilamellar vesicles. |
---|
83 | |
---|
84 | """ |
---|
85 | |
---|
86 | ## Parameter details [units, min, max] |
---|
87 | self.details = {} |
---|
88 | self.details['scale'] = ['', None, None] |
---|
89 | self.details['thickness'] = ['[A]', None, None] |
---|
90 | self.details['Nlayers'] = ['', None, None] |
---|
91 | self.details['spacing'] = ['[A]', None, None] |
---|
92 | self.details['pd_spacing'] = ['', None, None] |
---|
93 | self.details['sld_layer'] = ['[1/A^(2)]', None, None] |
---|
94 | self.details['sld_solvent'] = ['[1/A^(2)]', None, None] |
---|
95 | self.details['background'] = ['[1/cm]', None, None] |
---|
96 | |
---|
97 | ## fittable parameters |
---|
98 | self.fixed = ['thickness.width'] |
---|
99 | |
---|
100 | ## non-fittable parameters |
---|
101 | self.non_fittable = [] |
---|
102 | |
---|
103 | ## parameters with orientation |
---|
104 | self.orientation_params = [] |
---|
105 | |
---|
106 | ## parameters with magnetism |
---|
107 | self.magnetic_params = [] |
---|
108 | |
---|
109 | self.category = None |
---|
110 | self.multiplicity_info = None |
---|
111 | |
---|
112 | def __setstate__(self, state): |
---|
113 | """ |
---|
114 | restore the state of a model from pickle |
---|
115 | """ |
---|
116 | self.__dict__, self.params, self.dispersion = state |
---|
117 | |
---|
118 | def __reduce_ex__(self, proto): |
---|
119 | """ |
---|
120 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
121 | c model. |
---|
122 | """ |
---|
123 | state = (self.__dict__, self.params, self.dispersion) |
---|
124 | return (create_LamellarPCrystalModel, tuple(), state, None, None) |
---|
125 | |
---|
126 | def clone(self): |
---|
127 | """ Return a identical copy of self """ |
---|
128 | return self._clone(LamellarPCrystalModel()) |
---|
129 | |
---|
130 | def run(self, x=0.0): |
---|
131 | """ |
---|
132 | Evaluate the model |
---|
133 | |
---|
134 | :param x: input q, or [q,phi] |
---|
135 | |
---|
136 | :return: scattering function P(q) |
---|
137 | |
---|
138 | """ |
---|
139 | return CLamellarPCrystalModel.run(self, x) |
---|
140 | |
---|
141 | def runXY(self, x=0.0): |
---|
142 | """ |
---|
143 | Evaluate the model in cartesian coordinates |
---|
144 | |
---|
145 | :param x: input q, or [qx, qy] |
---|
146 | |
---|
147 | :return: scattering function P(q) |
---|
148 | |
---|
149 | """ |
---|
150 | return CLamellarPCrystalModel.runXY(self, x) |
---|
151 | |
---|
152 | def evalDistribution(self, x): |
---|
153 | """ |
---|
154 | Evaluate the model in cartesian coordinates |
---|
155 | |
---|
156 | :param x: input q[], or [qx[], qy[]] |
---|
157 | |
---|
158 | :return: scattering function P(q[]) |
---|
159 | |
---|
160 | """ |
---|
161 | return CLamellarPCrystalModel.evalDistribution(self, x) |
---|
162 | |
---|
163 | def calculate_ER(self): |
---|
164 | """ |
---|
165 | Calculate the effective radius for P(q)*S(q) |
---|
166 | |
---|
167 | :return: the value of the effective radius |
---|
168 | |
---|
169 | """ |
---|
170 | return CLamellarPCrystalModel.calculate_ER(self) |
---|
171 | |
---|
172 | def calculate_VR(self): |
---|
173 | """ |
---|
174 | Calculate the volf ratio for P(q)*S(q) |
---|
175 | |
---|
176 | :return: the value of the volf ratio |
---|
177 | |
---|
178 | """ |
---|
179 | return CLamellarPCrystalModel.calculate_VR(self) |
---|
180 | |
---|
181 | def set_dispersion(self, parameter, dispersion): |
---|
182 | """ |
---|
183 | Set the dispersion object for a model parameter |
---|
184 | |
---|
185 | :param parameter: name of the parameter [string] |
---|
186 | :param dispersion: dispersion object of type DispersionModel |
---|
187 | |
---|
188 | """ |
---|
189 | return CLamellarPCrystalModel.set_dispersion(self, |
---|
190 | parameter, dispersion.cdisp) |
---|
191 | |
---|
192 | |
---|
193 | # End of file |
---|
194 | |
---|