source: sasview/src/sans/models/TriaxialEllipsoidModel.py @ 81b524f

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 81b524f was 81b524f, checked in by Jeff Krzywon <jeffery.krzywon@…>, 11 years ago

This branch is now merged with the latest trunk release. I will merge them next.

  • 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: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
19         DO NOT MODIFY THIS FILE, MODIFY
20            src\sans\models\include\triaxial_ellipsoid.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CTriaxialEllipsoidModel
26
27def create_TriaxialEllipsoidModel():
28    """
29       Create a model instance
30    """
31    obj = TriaxialEllipsoidModel()
32    # CTriaxialEllipsoidModel.__init__(obj) is called by
33    # the TriaxialEllipsoidModel constructor
34    return obj
35
36class TriaxialEllipsoidModel(CTriaxialEllipsoidModel, BaseComponent):
37    """
38    Class that evaluates a TriaxialEllipsoidModel model.
39    This file was auto-generated from src\sans\models\include\triaxial_ellipsoid.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
43         scale           = 1.0
44         semi_axisA      = 35.0 [A]
45         semi_axisB      = 100.0 [A]
46         semi_axisC      = 400.0 [A]
47         sldEll          = 1e-06 [1/A^(2)]
48         sldSolv         = 6.3e-06 [1/A^(2)]
49         background      = 0.0 [1/cm]
50         axis_theta      = 57.325 [deg]
51         axis_phi        = 57.325 [deg]
52         axis_psi        = 0.0 [deg]
53
54    """
55       
56    def __init__(self, multfactor=1):
57        """ Initialization """
58        self.__dict__ = {}
59       
60        # Initialize BaseComponent first, then sphere
61        BaseComponent.__init__(self)
62        #apply(CTriaxialEllipsoidModel.__init__, (self,))
63
64        CTriaxialEllipsoidModel.__init__(self)
65        self.is_multifunc = False
66                       
67        ## Name of the model
68        self.name = "TriaxialEllipsoidModel"
69        ## Model description
70        self.description = """
71        Note: During fitting ensure that the inequality A<B<C is not
72                violated. Otherwise the calculation will
73                not be correct.
74        """
75       
76        ## Parameter details [units, min, max]
77        self.details = {}
78        self.details['scale'] = ['', None, None]
79        self.details['semi_axisA'] = ['[A]', None, None]
80        self.details['semi_axisB'] = ['[A]', None, None]
81        self.details['semi_axisC'] = ['[A]', None, None]
82        self.details['sldEll'] = ['[1/A^(2)]', None, None]
83        self.details['sldSolv'] = ['[1/A^(2)]', None, None]
84        self.details['background'] = ['[1/cm]', None, None]
85        self.details['axis_theta'] = ['[deg]', None, None]
86        self.details['axis_phi'] = ['[deg]', None, None]
87        self.details['axis_psi'] = ['[deg]', None, None]
88
89        ## fittable parameters
90        self.fixed = ['axis_psi.width',
91                      'axis_phi.width',
92                      'axis_theta.width',
93                      'semi_axisA.width',
94                      'semi_axisB.width',
95                      'semi_axisC.width']
96       
97        ## non-fittable parameters
98        self.non_fittable = []
99       
100        ## parameters with orientation
101        self.orientation_params = ['axis_psi',
102                                   'axis_phi',
103                                   'axis_theta',
104                                   'axis_psi.width',
105                                   'axis_phi.width',
106                                   'axis_theta.width']
107
108        ## parameters with magnetism
109        self.magnetic_params = []
110
111        self.category = None
112        self.multiplicity_info = None
113       
114    def __setstate__(self, state):
115        """
116        restore the state of a model from pickle
117        """
118        self.__dict__, self.params, self.dispersion = state
119       
120    def __reduce_ex__(self, proto):
121        """
122        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
123        c model.
124        """
125        state = (self.__dict__, self.params, self.dispersion)
126        return (create_TriaxialEllipsoidModel, tuple(), state, None, None)
127       
128    def clone(self):
129        """ Return a identical copy of self """
130        return self._clone(TriaxialEllipsoidModel())   
131       
132    def run(self, x=0.0):
133        """
134        Evaluate the model
135       
136        :param x: input q, or [q,phi]
137       
138        :return: scattering function P(q)
139       
140        """
141        return CTriaxialEllipsoidModel.run(self, x)
142   
143    def runXY(self, x=0.0):
144        """
145        Evaluate the model in cartesian coordinates
146       
147        :param x: input q, or [qx, qy]
148       
149        :return: scattering function P(q)
150       
151        """
152        return CTriaxialEllipsoidModel.runXY(self, x)
153       
154    def evalDistribution(self, x):
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 CTriaxialEllipsoidModel.evalDistribution(self, x)
164       
165    def calculate_ER(self):
166        """
167        Calculate the effective radius for P(q)*S(q)
168       
169        :return: the value of the effective radius
170       
171        """       
172        return CTriaxialEllipsoidModel.calculate_ER(self)
173       
174    def calculate_VR(self):
175        """
176        Calculate the volf ratio for P(q)*S(q)
177       
178        :return: the value of the volf ratio
179       
180        """       
181        return CTriaxialEllipsoidModel.calculate_VR(self)
182             
183    def set_dispersion(self, parameter, dispersion):
184        """
185        Set the dispersion object for a model parameter
186       
187        :param parameter: name of the parameter [string]
188        :param dispersion: dispersion object of type DispersionModel
189       
190        """
191        return CTriaxialEllipsoidModel.set_dispersion(self,
192               parameter, dispersion.cdisp)
193       
194   
195# End of file
196
Note: See TracBrowser for help on using the repository browser.