source: sasview/src/sans/models/MultiShellModel.py @ 54b9ad2

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