source: sasview/src/sans/models/RectangularPrismModel.py @ 400155b

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 400155b was 400155b, checked in by gonzalezm, 9 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\RectangularPrism.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CRectangularPrismModel
28
29def create_RectangularPrismModel():
30    """
31       Create a model instance
32    """
33    obj = RectangularPrismModel()
34    # CRectangularPrismModel.__init__(obj) is called by
35    # the RectangularPrismModel constructor
36    return obj
37
38class RectangularPrismModel(CRectangularPrismModel, BaseComponent):
39    """
40    Class that evaluates a RectangularPrismModel model.
41    This file was auto-generated from src\sans\models\include\RectangularPrism.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    * short_side      = 35.0 [A]
49    * b2a_ratio       = 1.0 [adim]
50    * c2a_ratio       = 1.0 [adim]
51    * sldPipe         = 6.3e-06 [1/A^(2)]
52    * sldSolv         = 1e-06 [1/A^(2)]
53    * background      = 0.0 [1/cm]
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(CRectangularPrismModel.__init__, (self,))
64
65        CRectangularPrismModel.__init__(self)
66        self.is_multifunc = False
67                       
68        ## Name of the model
69        self.name = "RectangularPrismModel"
70        ## Model description
71        self.description = """
72         Form factor for a massive rectangular prism with uniform scattering length density.
73                scale:Scale factor
74                short_side: shortest side of the rectangular prism  [A]
75                b2a_ratio: ratio b/a [adim]
76                c2a_ratio: ratio c/a [adim]
77                sldPipe: Pipe_sld
78                sldSolv: solvent_sld
79                background:Incoherent Background [1/cm]
80        """
81       
82        ## Parameter details [units, min, max]
83        self.details = {}
84        self.details['scale'] = ['', None, None]
85        self.details['short_side'] = ['[A]', None, None]
86        self.details['b2a_ratio'] = ['[adim]', None, None]
87        self.details['c2a_ratio'] = ['[adim]', None, None]
88        self.details['sldPipe'] = ['[1/A^(2)]', None, None]
89        self.details['sldSolv'] = ['[1/A^(2)]', None, None]
90        self.details['background'] = ['[1/cm]', None, None]
91
92        ## fittable parameters
93        self.fixed = ['short_side.width',
94                      'b2a_ratio.width',
95                      'c2a_ratio.width']
96       
97        ## non-fittable parameters
98        self.non_fittable = []
99       
100        ## parameters with orientation
101        self.orientation_params = []
102
103        ## parameters with magnetism
104        self.magnetic_params = []
105
106        self.category = None
107        self.multiplicity_info = None
108       
109    def __setstate__(self, state):
110        """
111        restore the state of a model from pickle
112        """
113        self.__dict__, self.params, self.dispersion = state
114       
115    def __reduce_ex__(self, proto):
116        """
117        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
118        c model.
119        """
120        state = (self.__dict__, self.params, self.dispersion)
121        return (create_RectangularPrismModel, tuple(), state, None, None)
122       
123    def clone(self):
124        """ Return a identical copy of self """
125        return self._clone(RectangularPrismModel())   
126       
127    def run(self, x=0.0):
128        """
129        Evaluate the model
130       
131        :param x: input q, or [q,phi]
132       
133        :return: scattering function P(q)
134       
135        """
136        return CRectangularPrismModel.run(self, x)
137   
138    def runXY(self, x=0.0):
139        """
140        Evaluate the model in cartesian coordinates
141       
142        :param x: input q, or [qx, qy]
143       
144        :return: scattering function P(q)
145       
146        """
147        return CRectangularPrismModel.runXY(self, x)
148       
149    def evalDistribution(self, x):
150        """
151        Evaluate the model in cartesian coordinates
152       
153        :param x: input q[], or [qx[], qy[]]
154       
155        :return: scattering function P(q[])
156       
157        """
158        return CRectangularPrismModel.evalDistribution(self, x)
159       
160    def calculate_ER(self):
161        """
162        Calculate the effective radius for P(q)*S(q)
163       
164        :return: the value of the effective radius
165       
166        """       
167        return CRectangularPrismModel.calculate_ER(self)
168       
169    def calculate_VR(self):
170        """
171        Calculate the volf ratio for P(q)*S(q)
172       
173        :return: the value of the volf ratio
174       
175        """       
176        return CRectangularPrismModel.calculate_VR(self)
177             
178    def set_dispersion(self, parameter, dispersion):
179        """
180        Set the dispersion object for a model parameter
181       
182        :param parameter: name of the parameter [string]
183        :param dispersion: dispersion object of type DispersionModel
184       
185        """
186        return CRectangularPrismModel.set_dispersion(self,
187               parameter, dispersion.cdisp)
188       
189   
190# End of file
191
Note: See TracBrowser for help on using the repository browser.