source: sasview/src/sans/models/StackedDisksModel.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: 6.5 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\stacked_disks.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CStackedDisksModel
28
29def create_StackedDisksModel():
30    """
31       Create a model instance
32    """
33    obj = StackedDisksModel()
34    # CStackedDisksModel.__init__(obj) is called by
35    # the StackedDisksModel constructor
36    return obj
37
38class StackedDisksModel(CStackedDisksModel, BaseComponent):
39    """
40    Class that evaluates a StackedDisksModel model.
41    This file was auto-generated from src\sans\models\include\stacked_disks.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           = 0.01
48    * core_thick      = 10.0 [A]
49    * radius          = 3000.0 [A]
50    * layer_thick     = 15.0 [A]
51    * core_sld        = 4e-06 [1/A^(2)]
52    * layer_sld       = -4e-07 [1/A^(2)]
53    * solvent_sld     = 5e-06 [1/A^(2)]
54    * n_stacking      = 1.0
55    * sigma_d         = 0.0
56    * background      = 0.001 [1/cm]
57    * axis_theta      = 0.0 [rad]
58    * axis_phi        = 0.0 [rad]
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(CStackedDisksModel.__init__, (self,))
69
70        CStackedDisksModel.__init__(self)
71        self.is_multifunc = False
72                       
73        ## Name of the model
74        self.name = "StackedDisksModel"
75        ## Model description
76        self.description = """
77         One layer of disk consists of a core, a top layer, and a bottom layer.
78                radius =  the radius of the disk
79                core_thick = thickness of the core
80                layer_thick = thickness of a layer
81                core_sld = the SLD of the core
82                layer_sld = the SLD of the layers
83                n_stacking = the number of the disks
84                sigma_d =  Gaussian STD of d-spacing
85                solvent_sld = the SLD of the solvent
86        """
87       
88        ## Parameter details [units, min, max]
89        self.details = {}
90        self.details['scale'] = ['', None, None]
91        self.details['core_thick'] = ['[A]', None, None]
92        self.details['radius'] = ['[A]', None, None]
93        self.details['layer_thick'] = ['[A]', None, None]
94        self.details['core_sld'] = ['[1/A^(2)]', None, None]
95        self.details['layer_sld'] = ['[1/A^(2)]', None, None]
96        self.details['solvent_sld'] = ['[1/A^(2)]', None, None]
97        self.details['n_stacking'] = ['', None, None]
98        self.details['sigma_d'] = ['', None, None]
99        self.details['background'] = ['[1/cm]', None, None]
100        self.details['axis_theta'] = ['[rad]', None, None]
101        self.details['axis_phi'] = ['[rad]', None, None]
102
103        ## fittable parameters
104        self.fixed = ['core_thick.width',
105                      'layer_thick.width',
106                      'radius.width',
107                      'axis_theta.width',
108                      'axis_phi.width']
109       
110        ## non-fittable parameters
111        self.non_fittable = []
112       
113        ## parameters with orientation
114        self.orientation_params = ['axis_phi',
115                                   'axis_theta',
116                                   'axis_phi.width',
117                                   'axis_theta.width']
118
119        ## parameters with magnetism
120        self.magnetic_params = []
121
122        self.category = None
123        self.multiplicity_info = None
124       
125    def __setstate__(self, state):
126        """
127        restore the state of a model from pickle
128        """
129        self.__dict__, self.params, self.dispersion = state
130       
131    def __reduce_ex__(self, proto):
132        """
133        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
134        c model.
135        """
136        state = (self.__dict__, self.params, self.dispersion)
137        return (create_StackedDisksModel, tuple(), state, None, None)
138       
139    def clone(self):
140        """ Return a identical copy of self """
141        return self._clone(StackedDisksModel())   
142       
143    def run(self, x=0.0):
144        """
145        Evaluate the model
146       
147        :param x: input q, or [q,phi]
148       
149        :return: scattering function P(q)
150       
151        """
152        return CStackedDisksModel.run(self, x)
153   
154    def runXY(self, x=0.0):
155        """
156        Evaluate the model in cartesian coordinates
157       
158        :param x: input q, or [qx, qy]
159       
160        :return: scattering function P(q)
161       
162        """
163        return CStackedDisksModel.runXY(self, x)
164       
165    def evalDistribution(self, x):
166        """
167        Evaluate the model in cartesian coordinates
168       
169        :param x: input q[], or [qx[], qy[]]
170       
171        :return: scattering function P(q[])
172       
173        """
174        return CStackedDisksModel.evalDistribution(self, x)
175       
176    def calculate_ER(self):
177        """
178        Calculate the effective radius for P(q)*S(q)
179       
180        :return: the value of the effective radius
181       
182        """       
183        return CStackedDisksModel.calculate_ER(self)
184       
185    def calculate_VR(self):
186        """
187        Calculate the volf ratio for P(q)*S(q)
188       
189        :return: the value of the volf ratio
190       
191        """       
192        return CStackedDisksModel.calculate_VR(self)
193             
194    def set_dispersion(self, parameter, dispersion):
195        """
196        Set the dispersion object for a model parameter
197       
198        :param parameter: name of the parameter [string]
199        :param dispersion: dispersion object of type DispersionModel
200       
201        """
202        return CStackedDisksModel.set_dispersion(self,
203               parameter, dispersion.cdisp)
204       
205   
206# End of file
207
Note: See TracBrowser for help on using the repository browser.