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