source: sasview/src/sans/models/CoreShellBicelleModel.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: 7.0 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\core_shell_bicelle.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CCoreShellBicelleModel
28
29def create_CoreShellBicelleModel():
30    """
31       Create a model instance
32    """
33    obj = CoreShellBicelleModel()
34    # CCoreShellBicelleModel.__init__(obj) is called by
35    # the CoreShellBicelleModel constructor
36    return obj
37
38class CoreShellBicelleModel(CCoreShellBicelleModel, BaseComponent):
39    """
40    Class that evaluates a CoreShellBicelleModel model.
41    This file was auto-generated from src\sans\models\include\core_shell_bicelle.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    * radius          = 20.0 [A]
48    * scale           = 1.0
49    * rim_thick       = 10.0 [A]
50    * face_thick      = 10.0 [A]
51    * length          = 400.0 [A]
52    * core_sld        = 1e-06 [1/A^(2)]
53    * face_sld        = 4e-06 [1/A^(2)]
54    * rim_sld         = 4e-06 [1/A^(2)]
55    * solvent_sld     = 1e-06 [1/A^(2)]
56    * background      = 0.0 [1/cm]
57    * axis_theta      = 90.0 [deg]
58    * axis_phi        = 0.0 [deg]
59
60    """
61       
62    def __init__(self, multfactor=1):
63        """ Initialization """
64        self.__dict__ = {}
65       
66        # Initialize BaseComponent first, then sphere
67        BaseComponent.__init__(self)
68        #apply(CCoreShellBicelleModel.__init__, (self,))
69
70        CCoreShellBicelleModel.__init__(self)
71        self.is_multifunc = False
72                       
73        ## Name of the model
74        self.name = "CoreShellBicelleModel"
75        ## Model description
76        self.description = """
77        P(q,alpha)= scale/Vs*f(q)^(2) + bkg,  where: f(q)= 2(core_sld
78                - solvant_sld)* Vc*sin[qLcos(alpha/2)]
79                /[qLcos(alpha/2)]*J1(qRsin(alpha))
80                /[qRsin(alpha)]+2(shell_sld-solvent_sld)
81                *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T)
82                *cos(alpha/2)]*J1(q(R+T)sin(alpha))
83                /q(R+T)sin(alpha)]
84               
85                alpha:is the angle between the axis of
86                the cylinder and the q-vector
87                Vs: the volume of the outer shell
88                Vc: the volume of the core
89                L: the length of the core
90                shell_sld: the scattering length density
91                of the shell
92                solvent_sld: the scattering length density
93                of the solvent
94                bkg: the background
95                T: the thickness
96                R+T: is the outer radius
97                L+2T: The total length of the outershell
98                J1: the first order Bessel function
99                theta: axis_theta of the cylinder
100                phi: the axis_phi of the cylinder...
101        """
102       
103        ## Parameter details [units, min, max]
104        self.details = {}
105        self.details['radius'] = ['[A]', None, None]
106        self.details['scale'] = ['', None, None]
107        self.details['rim_thick'] = ['[A]', None, None]
108        self.details['face_thick'] = ['[A]', None, None]
109        self.details['length'] = ['[A]', None, None]
110        self.details['core_sld'] = ['[1/A^(2)]', None, None]
111        self.details['face_sld'] = ['[1/A^(2)]', None, None]
112        self.details['rim_sld'] = ['[1/A^(2)]', None, None]
113        self.details['solvent_sld'] = ['[1/A^(2)]', None, None]
114        self.details['background'] = ['[1/cm]', None, None]
115        self.details['axis_theta'] = ['[deg]', None, None]
116        self.details['axis_phi'] = ['[deg]', None, None]
117
118        ## fittable parameters
119        self.fixed = ['axis_phi.width',
120                      'axis_theta.width',
121                      'length.width',
122                      'radius.width',
123                      'rim_thick.width',
124                      'face_thick.width']
125       
126        ## non-fittable parameters
127        self.non_fittable = []
128       
129        ## parameters with orientation
130        self.orientation_params = ['axis_phi',
131                                   'axis_theta',
132                                   'axis_phi.width',
133                                   'axis_theta.width']
134
135        ## parameters with magnetism
136        self.magnetic_params = []
137
138        self.category = None
139        self.multiplicity_info = None
140       
141    def __setstate__(self, state):
142        """
143        restore the state of a model from pickle
144        """
145        self.__dict__, self.params, self.dispersion = state
146       
147    def __reduce_ex__(self, proto):
148        """
149        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
150        c model.
151        """
152        state = (self.__dict__, self.params, self.dispersion)
153        return (create_CoreShellBicelleModel, tuple(), state, None, None)
154       
155    def clone(self):
156        """ Return a identical copy of self """
157        return self._clone(CoreShellBicelleModel())   
158       
159    def run(self, x=0.0):
160        """
161        Evaluate the model
162       
163        :param x: input q, or [q,phi]
164       
165        :return: scattering function P(q)
166       
167        """
168        return CCoreShellBicelleModel.run(self, x)
169   
170    def runXY(self, x=0.0):
171        """
172        Evaluate the model in cartesian coordinates
173       
174        :param x: input q, or [qx, qy]
175       
176        :return: scattering function P(q)
177       
178        """
179        return CCoreShellBicelleModel.runXY(self, x)
180       
181    def evalDistribution(self, x):
182        """
183        Evaluate the model in cartesian coordinates
184       
185        :param x: input q[], or [qx[], qy[]]
186       
187        :return: scattering function P(q[])
188       
189        """
190        return CCoreShellBicelleModel.evalDistribution(self, x)
191       
192    def calculate_ER(self):
193        """
194        Calculate the effective radius for P(q)*S(q)
195       
196        :return: the value of the effective radius
197       
198        """       
199        return CCoreShellBicelleModel.calculate_ER(self)
200       
201    def calculate_VR(self):
202        """
203        Calculate the volf ratio for P(q)*S(q)
204       
205        :return: the value of the volf ratio
206       
207        """       
208        return CCoreShellBicelleModel.calculate_VR(self)
209             
210    def set_dispersion(self, parameter, dispersion):
211        """
212        Set the dispersion object for a model parameter
213       
214        :param parameter: name of the parameter [string]
215        :param dispersion: dispersion object of type DispersionModel
216       
217        """
218        return CCoreShellBicelleModel.set_dispersion(self,
219               parameter, dispersion.cdisp)
220       
221   
222# End of file
223
Note: See TracBrowser for help on using the repository browser.