source: sasview/src/sans/models/CoreFourShellModel.py @ d09f0ae1

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since d09f0ae1 was 400155b, checked in by gonzalezm, 10 years ago

Implementing request from ticket 261 - default number of bins in Annulus [Phi View] is now 36 and the first bin is now centered at 0 degrees

  • Property mode set to 100644
File size: 9.8 KB
Line 
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"""
16Provide 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\corefourshell.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CCoreFourShellModel
28
29def create_CoreFourShellModel():
30    """
31       Create a model instance
32    """
33    obj = CoreFourShellModel()
34    # CCoreFourShellModel.__init__(obj) is called by
35    # the CoreFourShellModel constructor
36    return obj
37
38class CoreFourShellModel(CCoreFourShellModel, BaseComponent):
39    """
40    Class that evaluates a CoreFourShellModel model.
41    This file was auto-generated from src\sans\models\include\corefourshell.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    * rad_core0       = 60.0 [A]
49    * sld_core0       = 6.4e-06 [1/A^(2)]
50    * thick_shell1    = 10.0 [A]
51    * sld_shell1      = 1e-06 [1/A^(2)]
52    * thick_shell2    = 10.0 [A]
53    * sld_shell2      = 2e-06 [1/A^(2)]
54    * thick_shell3    = 10.0 [A]
55    * sld_shell3      = 3e-06 [1/A^(2)]
56    * thick_shell4    = 10.0 [A]
57    * sld_shell4      = 4e-06 [1/A^(2)]
58    * sld_solv        = 6.4e-06 [1/A^(2)]
59    * background      = 0.001 [1/cm]
60    * M0_sld_shell1   = 0.0 [1/A^(2)]
61    * M_theta_shell1  = 0.0 [deg]
62    * M_phi_shell1    = 0.0 [deg]
63    * M0_sld_shell2   = 0.0 [1/A^(2)]
64    * M_theta_shell2  = 0.0 [deg]
65    * M_phi_shell2    = 0.0 [deg]
66    * M0_sld_shell3   = 0.0 [1/A^(2)]
67    * M_theta_shell3  = 0.0 [deg]
68    * M_phi_shell3    = 0.0 [deg]
69    * M0_sld_shell4   = 0.0 [1/A^(2)]
70    * M_theta_shell4  = 0.0 [deg]
71    * M_phi_shell4    = 0.0 [deg]
72    * M0_sld_core0    = 0.0 [1/A^(2)]
73    * M_theta_core0   = 0.0 [deg]
74    * M_phi_core0     = 0.0 [deg]
75    * M0_sld_solv     = 0.0 [1/A^(2)]
76    * M_theta_solv    = 0.0 [deg]
77    * M_phi_solv      = 0.0 [deg]
78    * Up_frac_i       = 0.5 [u/(u+d)]
79    * Up_frac_f       = 0.5 [u/(u+d)]
80    * Up_theta        = 0.0 [deg]
81
82    """
83       
84    def __init__(self, multfactor=1):
85        """ Initialization """
86        self.__dict__ = {}
87       
88        # Initialize BaseComponent first, then sphere
89        BaseComponent.__init__(self)
90        #apply(CCoreFourShellModel.__init__, (self,))
91
92        CCoreFourShellModel.__init__(self)
93        self.is_multifunc = False
94                       
95        ## Name of the model
96        self.name = "CoreFourShellModel"
97        ## Model description
98        self.description = """
99         Calculates the scattering intensity from a core-4 shell structure.
100                scale = scale factor * volume fraction
101                rad_core0: the radius of the core
102                sld_core0: the SLD of the core
103                thick_shelli: the thickness of the i'th shell from the core
104                sld_shelli: the SLD of the i'th shell from the core
105                sld_solv: the SLD of the solvent
106                background: incoherent background
107        """
108       
109        ## Parameter details [units, min, max]
110        self.details = {}
111        self.details['scale'] = ['', None, None]
112        self.details['rad_core0'] = ['[A]', None, None]
113        self.details['sld_core0'] = ['[1/A^(2)]', None, None]
114        self.details['thick_shell1'] = ['[A]', None, None]
115        self.details['sld_shell1'] = ['[1/A^(2)]', None, None]
116        self.details['thick_shell2'] = ['[A]', None, None]
117        self.details['sld_shell2'] = ['[1/A^(2)]', None, None]
118        self.details['thick_shell3'] = ['[A]', None, None]
119        self.details['sld_shell3'] = ['[1/A^(2)]', None, None]
120        self.details['thick_shell4'] = ['[A]', None, None]
121        self.details['sld_shell4'] = ['[1/A^(2)]', None, None]
122        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
123        self.details['background'] = ['[1/cm]', None, None]
124        self.details['M0_sld_shell1'] = ['[1/A^(2)]', None, None]
125        self.details['M_theta_shell1'] = ['[deg]', None, None]
126        self.details['M_phi_shell1'] = ['[deg]', None, None]
127        self.details['M0_sld_shell2'] = ['[1/A^(2)]', None, None]
128        self.details['M_theta_shell2'] = ['[deg]', None, None]
129        self.details['M_phi_shell2'] = ['[deg]', None, None]
130        self.details['M0_sld_shell3'] = ['[1/A^(2)]', None, None]
131        self.details['M_theta_shell3'] = ['[deg]', None, None]
132        self.details['M_phi_shell3'] = ['[deg]', None, None]
133        self.details['M0_sld_shell4'] = ['[1/A^(2)]', None, None]
134        self.details['M_theta_shell4'] = ['[deg]', None, None]
135        self.details['M_phi_shell4'] = ['[deg]', None, None]
136        self.details['M0_sld_core0'] = ['[1/A^(2)]', None, None]
137        self.details['M_theta_core0'] = ['[deg]', None, None]
138        self.details['M_phi_core0'] = ['[deg]', None, None]
139        self.details['M0_sld_solv'] = ['[1/A^(2)]', None, None]
140        self.details['M_theta_solv'] = ['[deg]', None, None]
141        self.details['M_phi_solv'] = ['[deg]', None, None]
142        self.details['Up_frac_i'] = ['[u/(u+d)]', None, None]
143        self.details['Up_frac_f'] = ['[u/(u+d)]', None, None]
144        self.details['Up_theta'] = ['[deg]', None, None]
145
146        ## fittable parameters
147        self.fixed = ['thick_shell4.width',
148                      'thick_shell1.width',
149                      'thick_shell2.width',
150                      'thick_shell3.width',
151                      'rad_core0.width']
152       
153        ## non-fittable parameters
154        self.non_fittable = []
155       
156        ## parameters with orientation
157        self.orientation_params = ['M0_sld_shell4',
158                                   'M_theta_shell4',
159                                   'M_phi_shell4',
160                                   'M0_sld_shell3',
161                                   'M_theta_shell3',
162                                   'M_phi_shell3',
163                                   'M0_sld_shell2',
164                                   'M_theta_shell2',
165                                   'M_phi_shell2',
166                                   'M0_sld_shell1',
167                                   'M_theta_shell1',
168                                   'M_phi_shell1',
169                                   'M0_sld_core0',
170                                   'M_theta_core0',
171                                   'M_phi_core0',
172                                   'M0_sld_solv',
173                                   'M_theta_solv',
174                                   'M_phi_solv',
175                                   'Up_frac_i',
176                                   'Up_frac_f',
177                                   'Up_theta']
178
179        ## parameters with magnetism
180        self.magnetic_params = ['M0_sld_shell4', 'M_theta_shell4', 'M_phi_shell4', 'M0_sld_shell3', 'M_theta_shell3', 'M_phi_shell3', 'M0_sld_shell2', 'M_theta_shell2', 'M_phi_shell2', 'M0_sld_shell1', 'M_theta_shell1', 'M_phi_shell1', 'M0_sld_core0', 'M_theta_core0', 'M_phi_core0', 'M0_sld_solv', 'M_theta_solv', 'M_phi_solv', 'Up_frac_i', 'Up_frac_f', 'Up_theta']
181
182        self.category = None
183        self.multiplicity_info = None
184       
185    def __setstate__(self, state):
186        """
187        restore the state of a model from pickle
188        """
189        self.__dict__, self.params, self.dispersion = state
190       
191    def __reduce_ex__(self, proto):
192        """
193        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
194        c model.
195        """
196        state = (self.__dict__, self.params, self.dispersion)
197        return (create_CoreFourShellModel, tuple(), state, None, None)
198       
199    def clone(self):
200        """ Return a identical copy of self """
201        return self._clone(CoreFourShellModel())   
202       
203    def run(self, x=0.0):
204        """
205        Evaluate the model
206       
207        :param x: input q, or [q,phi]
208       
209        :return: scattering function P(q)
210       
211        """
212        return CCoreFourShellModel.run(self, x)
213   
214    def runXY(self, x=0.0):
215        """
216        Evaluate the model in cartesian coordinates
217       
218        :param x: input q, or [qx, qy]
219       
220        :return: scattering function P(q)
221       
222        """
223        return CCoreFourShellModel.runXY(self, x)
224       
225    def evalDistribution(self, x):
226        """
227        Evaluate the model in cartesian coordinates
228       
229        :param x: input q[], or [qx[], qy[]]
230       
231        :return: scattering function P(q[])
232       
233        """
234        return CCoreFourShellModel.evalDistribution(self, x)
235       
236    def calculate_ER(self):
237        """
238        Calculate the effective radius for P(q)*S(q)
239       
240        :return: the value of the effective radius
241       
242        """       
243        return CCoreFourShellModel.calculate_ER(self)
244       
245    def calculate_VR(self):
246        """
247        Calculate the volf ratio for P(q)*S(q)
248       
249        :return: the value of the volf ratio
250       
251        """       
252        return CCoreFourShellModel.calculate_VR(self)
253             
254    def set_dispersion(self, parameter, dispersion):
255        """
256        Set the dispersion object for a model parameter
257       
258        :param parameter: name of the parameter [string]
259        :param dispersion: dispersion object of type DispersionModel
260       
261        """
262        return CCoreFourShellModel.set_dispersion(self,
263               parameter, dispersion.cdisp)
264       
265   
266# End of file
267
Note: See TracBrowser for help on using the repository browser.