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\lamellarPS_HG.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 CLamellarPSHGModel |
---|
28 | |
---|
29 | def create_LamellarPSHGModel(): |
---|
30 | """ |
---|
31 | Create a model instance |
---|
32 | """ |
---|
33 | obj = LamellarPSHGModel() |
---|
34 | # CLamellarPSHGModel.__init__(obj) is called by |
---|
35 | # the LamellarPSHGModel constructor |
---|
36 | return obj |
---|
37 | |
---|
38 | class LamellarPSHGModel(CLamellarPSHGModel, BaseComponent): |
---|
39 | """ |
---|
40 | Class that evaluates a LamellarPSHGModel model. |
---|
41 | This file was auto-generated from src\sans\models\include\lamellarPS_HG.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 | * spacing = 40.0 [A] |
---|
49 | * deltaT = 10.0 [A] |
---|
50 | * deltaH = 2.0 [A] |
---|
51 | * sld_tail = 4e-07 [1/A^(2)] |
---|
52 | * sld_head = 2e-06 [1/A^(2)] |
---|
53 | * sld_solvent = 6e-06 [1/A^(2)] |
---|
54 | * n_plates = 30.0 |
---|
55 | * caille = 0.001 |
---|
56 | * background = 0.001 [1/cm] |
---|
57 | |
---|
58 | """ |
---|
59 | |
---|
60 | def __init__(self, multfactor=1): |
---|
61 | """ Initialization """ |
---|
62 | self.__dict__ = {} |
---|
63 | |
---|
64 | # Initialize BaseComponent first, then sphere |
---|
65 | BaseComponent.__init__(self) |
---|
66 | #apply(CLamellarPSHGModel.__init__, (self,)) |
---|
67 | |
---|
68 | CLamellarPSHGModel.__init__(self) |
---|
69 | self.is_multifunc = False |
---|
70 | |
---|
71 | ## Name of the model |
---|
72 | self.name = "LamellarPSHGModel" |
---|
73 | ## Model description |
---|
74 | self.description = """ |
---|
75 | [Concentrated Lamellar (head+tail) Form Factor]: Calculates the |
---|
76 | intensity from a lyotropic lamellar phase. |
---|
77 | The intensity (form factor and structure factor) |
---|
78 | calculated is for lamellae of two-layer scattering |
---|
79 | length density that are randomly distributed in |
---|
80 | solution (a powder average). The scattering |
---|
81 | length density of the tail region, headgroup |
---|
82 | region, and solvent are taken to be different. |
---|
83 | The model can also be applied to large, |
---|
84 | multi-lamellar vesicles. |
---|
85 | No resolution smeared version is included |
---|
86 | in the structure factor of this model. |
---|
87 | *Parameters: spacing = repeat spacing, |
---|
88 | deltaT = tail length, |
---|
89 | deltaH = headgroup thickness, |
---|
90 | n_plates = # of Lamellar plates |
---|
91 | caille = Caille parameter (<0.8 or <1) |
---|
92 | background = incoherent bgd |
---|
93 | scale = scale factor ... |
---|
94 | """ |
---|
95 | |
---|
96 | ## Parameter details [units, min, max] |
---|
97 | self.details = {} |
---|
98 | self.details['scale'] = ['', None, None] |
---|
99 | self.details['spacing'] = ['[A]', None, None] |
---|
100 | self.details['deltaT'] = ['[A]', None, None] |
---|
101 | self.details['deltaH'] = ['[A]', None, None] |
---|
102 | self.details['sld_tail'] = ['[1/A^(2)]', None, None] |
---|
103 | self.details['sld_head'] = ['[1/A^(2)]', None, None] |
---|
104 | self.details['sld_solvent'] = ['[1/A^(2)]', None, None] |
---|
105 | self.details['n_plates'] = ['', None, None] |
---|
106 | self.details['caille'] = ['', None, None] |
---|
107 | self.details['background'] = ['[1/cm]', None, None] |
---|
108 | |
---|
109 | ## fittable parameters |
---|
110 | self.fixed = ['deltaT.width', |
---|
111 | 'deltaH.width', |
---|
112 | 'spacing.width'] |
---|
113 | |
---|
114 | ## non-fittable parameters |
---|
115 | self.non_fittable = [] |
---|
116 | |
---|
117 | ## parameters with orientation |
---|
118 | self.orientation_params = [] |
---|
119 | |
---|
120 | ## parameters with magnetism |
---|
121 | self.magnetic_params = [] |
---|
122 | |
---|
123 | self.category = None |
---|
124 | self.multiplicity_info = None |
---|
125 | |
---|
126 | def __setstate__(self, state): |
---|
127 | """ |
---|
128 | restore the state of a model from pickle |
---|
129 | """ |
---|
130 | self.__dict__, self.params, self.dispersion = state |
---|
131 | |
---|
132 | def __reduce_ex__(self, proto): |
---|
133 | """ |
---|
134 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
135 | c model. |
---|
136 | """ |
---|
137 | state = (self.__dict__, self.params, self.dispersion) |
---|
138 | return (create_LamellarPSHGModel, tuple(), state, None, None) |
---|
139 | |
---|
140 | def clone(self): |
---|
141 | """ Return a identical copy of self """ |
---|
142 | return self._clone(LamellarPSHGModel()) |
---|
143 | |
---|
144 | def run(self, x=0.0): |
---|
145 | """ |
---|
146 | Evaluate the model |
---|
147 | |
---|
148 | :param x: input q, or [q,phi] |
---|
149 | |
---|
150 | :return: scattering function P(q) |
---|
151 | |
---|
152 | """ |
---|
153 | return CLamellarPSHGModel.run(self, x) |
---|
154 | |
---|
155 | def runXY(self, x=0.0): |
---|
156 | """ |
---|
157 | Evaluate the model in cartesian coordinates |
---|
158 | |
---|
159 | :param x: input q, or [qx, qy] |
---|
160 | |
---|
161 | :return: scattering function P(q) |
---|
162 | |
---|
163 | """ |
---|
164 | return CLamellarPSHGModel.runXY(self, x) |
---|
165 | |
---|
166 | def evalDistribution(self, x): |
---|
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 CLamellarPSHGModel.evalDistribution(self, x) |
---|
176 | |
---|
177 | def calculate_ER(self): |
---|
178 | """ |
---|
179 | Calculate the effective radius for P(q)*S(q) |
---|
180 | |
---|
181 | :return: the value of the effective radius |
---|
182 | |
---|
183 | """ |
---|
184 | return CLamellarPSHGModel.calculate_ER(self) |
---|
185 | |
---|
186 | def calculate_VR(self): |
---|
187 | """ |
---|
188 | Calculate the volf ratio for P(q)*S(q) |
---|
189 | |
---|
190 | :return: the value of the volf ratio |
---|
191 | |
---|
192 | """ |
---|
193 | return CLamellarPSHGModel.calculate_VR(self) |
---|
194 | |
---|
195 | def set_dispersion(self, parameter, dispersion): |
---|
196 | """ |
---|
197 | Set the dispersion object for a model parameter |
---|
198 | |
---|
199 | :param parameter: name of the parameter [string] |
---|
200 | :param dispersion: dispersion object of type DispersionModel |
---|
201 | |
---|
202 | """ |
---|
203 | return CLamellarPSHGModel.set_dispersion(self, |
---|
204 | parameter, dispersion.cdisp) |
---|
205 | |
---|
206 | |
---|
207 | # End of file |
---|
208 | |
---|