source: sasview/src/sans/models/CoreShellEllipsoidModel.py @ 81b524f

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 81b524f was 81b524f, checked in by Jeff Krzywon <jeffery.krzywon@…>, 10 years ago

This branch is now merged with the latest trunk release. I will merge them next.

  • Property mode set to 100644
File size: 7.2 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: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
19         DO NOT MODIFY THIS FILE, MODIFY
20            src\sans\models\include\spheroid.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CCoreShellEllipsoidModel
26
27def create_CoreShellEllipsoidModel():
28    """
29       Create a model instance
30    """
31    obj = CoreShellEllipsoidModel()
32    # CCoreShellEllipsoidModel.__init__(obj) is called by
33    # the CoreShellEllipsoidModel constructor
34    return obj
35
36class CoreShellEllipsoidModel(CCoreShellEllipsoidModel, BaseComponent):
37    """
38    Class that evaluates a CoreShellEllipsoidModel model.
39    This file was auto-generated from src\sans\models\include\spheroid.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
43         scale           = 1.0
44         equat_core      = 200.0 [A]
45         polar_core      = 20.0 [A]
46         equat_shell     = 250.0 [A]
47         polar_shell     = 30.0 [A]
48         sld_core        = 2e-06 [1/A^(2)]
49         sld_shell       = 1e-06 [1/A^(2)]
50         sld_solvent     = 6.3e-06 [1/A^(2)]
51         background      = 0.001 [1/cm]
52         axis_theta      = 0.0 [deg]
53         axis_phi        = 0.0 [deg]
54
55    """
56       
57    def __init__(self, multfactor=1):
58        """ Initialization """
59        self.__dict__ = {}
60       
61        # Initialize BaseComponent first, then sphere
62        BaseComponent.__init__(self)
63        #apply(CCoreShellEllipsoidModel.__init__, (self,))
64
65        CCoreShellEllipsoidModel.__init__(self)
66        self.is_multifunc = False
67                       
68        ## Name of the model
69        self.name = "CoreShellEllipsoidModel"
70        ## Model description
71        self.description = """
72        [SpheroidCoreShellModel] Calculates the form factor for an spheroid
73                ellipsoid particle with a core_shell structure.
74                The form factor is averaged over all possible
75                orientations of the ellipsoid such that P(q)
76                = scale*<f^2>/Vol + bkg, where f is the
77                single particle scattering amplitude.
78                [Parameters]:
79                equat_core = equatorial radius of core,
80                polar_core = polar radius of core,
81                equat_shell = equatorial radius of shell,
82                polar_shell = polar radius (revolution axis) of shell,
83                sld_core = SLD_core
84                sld_shell = SLD_shell
85                sld_solvent = SLD_solvent
86                background = Incoherent bkg
87                scale =scale
88                Note:It is the users' responsibility to ensure
89                that shell radii are larger than core radii.
90                oblate: polar radius < equatorial radius
91                prolate :  polar radius > equatorial radius
92        """
93       
94        ## Parameter details [units, min, max]
95        self.details = {}
96        self.details['scale'] = ['', None, None]
97        self.details['equat_core'] = ['[A]', None, None]
98        self.details['polar_core'] = ['[A]', None, None]
99        self.details['equat_shell'] = ['[A]', None, None]
100        self.details['polar_shell'] = ['[A]', None, None]
101        self.details['sld_core'] = ['[1/A^(2)]', None, None]
102        self.details['sld_shell'] = ['[1/A^(2)]', None, None]
103        self.details['sld_solvent'] = ['[1/A^(2)]', None, None]
104        self.details['background'] = ['[1/cm]', None, None]
105        self.details['axis_theta'] = ['[deg]', None, None]
106        self.details['axis_phi'] = ['[deg]', None, None]
107
108        ## fittable parameters
109        self.fixed = ['equat_core.width',
110                      'polar_core.width',
111                      'equat_shell.width',
112                      'polar_shell.width',
113                      'axis_phi.width',
114                      'axis_theta.width']
115       
116        ## non-fittable parameters
117        self.non_fittable = []
118       
119        ## parameters with orientation
120        self.orientation_params = ['axis_phi',
121                                   'axis_theta',
122                                   'axis_phi.width',
123                                   'axis_theta.width']
124
125        ## parameters with magnetism
126        self.magnetic_params = []
127
128        self.category = None
129        self.multiplicity_info = None
130       
131    def __setstate__(self, state):
132        """
133        restore the state of a model from pickle
134        """
135        self.__dict__, self.params, self.dispersion = state
136       
137    def __reduce_ex__(self, proto):
138        """
139        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
140        c model.
141        """
142        state = (self.__dict__, self.params, self.dispersion)
143        return (create_CoreShellEllipsoidModel, tuple(), state, None, None)
144       
145    def clone(self):
146        """ Return a identical copy of self """
147        return self._clone(CoreShellEllipsoidModel())   
148       
149    def run(self, x=0.0):
150        """
151        Evaluate the model
152       
153        :param x: input q, or [q,phi]
154       
155        :return: scattering function P(q)
156       
157        """
158        return CCoreShellEllipsoidModel.run(self, x)
159   
160    def runXY(self, x=0.0):
161        """
162        Evaluate the model in cartesian coordinates
163       
164        :param x: input q, or [qx, qy]
165       
166        :return: scattering function P(q)
167       
168        """
169        return CCoreShellEllipsoidModel.runXY(self, x)
170       
171    def evalDistribution(self, x):
172        """
173        Evaluate the model in cartesian coordinates
174       
175        :param x: input q[], or [qx[], qy[]]
176       
177        :return: scattering function P(q[])
178       
179        """
180        return CCoreShellEllipsoidModel.evalDistribution(self, x)
181       
182    def calculate_ER(self):
183        """
184        Calculate the effective radius for P(q)*S(q)
185       
186        :return: the value of the effective radius
187       
188        """       
189        return CCoreShellEllipsoidModel.calculate_ER(self)
190       
191    def calculate_VR(self):
192        """
193        Calculate the volf ratio for P(q)*S(q)
194       
195        :return: the value of the volf ratio
196       
197        """       
198        return CCoreShellEllipsoidModel.calculate_VR(self)
199             
200    def set_dispersion(self, parameter, dispersion):
201        """
202        Set the dispersion object for a model parameter
203       
204        :param parameter: name of the parameter [string]
205        :param dispersion: dispersion object of type DispersionModel
206       
207        """
208        return CCoreShellEllipsoidModel.set_dispersion(self,
209               parameter, dispersion.cdisp)
210       
211   
212# End of file
213
Note: See TracBrowser for help on using the repository browser.