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