source: sasview/src/sans/models/CSParallelepipedModel.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.3 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\csparallelepiped.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CCSParallelepipedModel
28
29def create_CSParallelepipedModel():
30    """
31       Create a model instance
32    """
33    obj = CSParallelepipedModel()
34    # CCSParallelepipedModel.__init__(obj) is called by
35    # the CSParallelepipedModel constructor
36    return obj
37
38class CSParallelepipedModel(CCSParallelepipedModel, BaseComponent):
39    """
40    Class that evaluates a CSParallelepipedModel model.
41    This file was auto-generated from src\sans\models\include\csparallelepiped.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    * shortA          = 35.0 [A]
49    * midB            = 75.0 [A]
50    * longC           = 400.0 [A]
51    * rimA            = 10.0 [A]
52    * rimB            = 10.0 [A]
53    * rimC            = 10.0 [A]
54    * sld_rimA        = 2e-06 [1/A^(2)]
55    * sld_rimB        = 4e-06 [1/A^(2)]
56    * sld_rimC        = 2e-06 [1/A^(2)]
57    * sld_pcore       = 1e-06 [1/A^(2)]
58    * sld_solv        = 6e-06 [1/A^(2)]
59    * background      = 0.06 [1/cm]
60    * parallel_theta  = 0.0 [deg]
61    * parallel_phi    = 0.0 [deg]
62    * parallel_psi    = 0.0 [deg]
63
64    """
65       
66    def __init__(self, multfactor=1):
67        """ Initialization """
68        self.__dict__ = {}
69       
70        # Initialize BaseComponent first, then sphere
71        BaseComponent.__init__(self)
72        #apply(CCSParallelepipedModel.__init__, (self,))
73
74        CCSParallelepipedModel.__init__(self)
75        self.is_multifunc = False
76                       
77        ## Name of the model
78        self.name = "CSParallelepipedModel"
79        ## Model description
80        self.description = """
81         Form factor for a rectangular Shell. Below are the Parameters.
82                scale: scale factor
83                shortA: length of short edge  [A]
84                midB: length of another short edge [A]
85                longC: length of long edge  of the parallelepiped [A]
86                rimA: length of short edge  [A]
87                rimB: length of another short edge [A]
88                rimC: length of long edge  of the parallelepiped [A]
89                sld_rimA: sld of rimA [1/A^(2)]
90                sld_rimB: sld of rimB [1/A^(2)]
91                sld_rimC: sld of rimC [1/A^(2)]
92                sld_core: Pipe_sld [1/A^(2)]
93                sld_solv: solvent_sld [1/A^(2)]
94                background: incoherent Background [1/cm]
95        """
96       
97        ## Parameter details [units, min, max]
98        self.details = {}
99        self.details['scale'] = ['', None, None]
100        self.details['shortA'] = ['[A]', None, None]
101        self.details['midB'] = ['[A]', None, None]
102        self.details['longC'] = ['[A]', None, None]
103        self.details['rimA'] = ['[A]', None, None]
104        self.details['rimB'] = ['[A]', None, None]
105        self.details['rimC'] = ['[A]', None, None]
106        self.details['sld_rimA'] = ['[1/A^(2)]', None, None]
107        self.details['sld_rimB'] = ['[1/A^(2)]', None, None]
108        self.details['sld_rimC'] = ['[1/A^(2)]', None, None]
109        self.details['sld_pcore'] = ['[1/A^(2)]', None, None]
110        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
111        self.details['background'] = ['[1/cm]', None, None]
112        self.details['parallel_theta'] = ['[deg]', None, None]
113        self.details['parallel_phi'] = ['[deg]', None, None]
114        self.details['parallel_psi'] = ['[deg]', None, None]
115
116        ## fittable parameters
117        self.fixed = ['shortA.width',
118                      'midB.width',
119                      'longC.width',
120                      'parallel_phi.width',
121                      'parallel_psi.width',
122                      'parallel_theta.width']
123       
124        ## non-fittable parameters
125        self.non_fittable = []
126       
127        ## parameters with orientation
128        self.orientation_params = ['parallel_phi',
129                                   'parallel_psi',
130                                   'parallel_theta',
131                                   'parallel_phi.width',
132                                   'parallel_psi.width',
133                                   'parallel_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_CSParallelepipedModel, tuple(), state, None, None)
154       
155    def clone(self):
156        """ Return a identical copy of self """
157        return self._clone(CSParallelepipedModel())   
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 CCSParallelepipedModel.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 CCSParallelepipedModel.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 CCSParallelepipedModel.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 CCSParallelepipedModel.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 CCSParallelepipedModel.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 CCSParallelepipedModel.set_dispersion(self,
219               parameter, dispersion.cdisp)
220       
221   
222# End of file
223
Note: See TracBrowser for help on using the repository browser.