source: sasview/src/sans/models/TeubnerStreyModel.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: 5.2 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\teubner_strey.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CTeubnerStreyModel
26
27def create_TeubnerStreyModel():
28    """
29       Create a model instance
30    """
31    obj = TeubnerStreyModel()
32    # CTeubnerStreyModel.__init__(obj) is called by
33    # the TeubnerStreyModel constructor
34    return obj
35
36class TeubnerStreyModel(CTeubnerStreyModel, BaseComponent):
37    """
38    Class that evaluates a TeubnerStreyModel model.
39    This file was auto-generated from src\sans\models\include\teubner_strey.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
43         scale           = 0.1
44         c1              = -30.0
45         c2              = 5000.0
46         background      = 0.0
47
48    """
49       
50    def __init__(self, multfactor=1):
51        """ Initialization """
52        self.__dict__ = {}
53       
54        # Initialize BaseComponent first, then sphere
55        BaseComponent.__init__(self)
56        #apply(CTeubnerStreyModel.__init__, (self,))
57
58        CTeubnerStreyModel.__init__(self)
59        self.is_multifunc = False
60                       
61        ## Name of the model
62        self.name = "TeubnerStreyModel"
63        ## Model description
64        self.description = """
65        F(x) = 1/( scale + c1*(x)^(2)+  c2*(x)^(4)) + bkd
66        """
67       
68        ## Parameter details [units, min, max]
69        self.details = {}
70        self.details['scale'] = ['', None, None]
71        self.details['c1'] = ['', None, None]
72        self.details['c2'] = ['', None, None]
73        self.details['background'] = ['', None, None]
74
75        ## fittable parameters
76        self.fixed = []
77       
78        ## non-fittable parameters
79        self.non_fittable = []
80       
81        ## parameters with orientation
82        self.orientation_params = []
83
84        ## parameters with magnetism
85        self.magnetic_params = []
86
87        self.category = None
88        self.multiplicity_info = None
89       
90    def __setstate__(self, state):
91        """
92        restore the state of a model from pickle
93        """
94        self.__dict__, self.params, self.dispersion = state
95       
96    def __reduce_ex__(self, proto):
97        """
98        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
99        c model.
100        """
101        state = (self.__dict__, self.params, self.dispersion)
102        return (create_TeubnerStreyModel, tuple(), state, None, None)
103       
104    def clone(self):
105        """ Return a identical copy of self """
106        return self._clone(TeubnerStreyModel())   
107       
108    def run(self, x=0.0):
109        """
110        Evaluate the model
111       
112        :param x: input q, or [q,phi]
113       
114        :return: scattering function P(q)
115       
116        """
117        return CTeubnerStreyModel.run(self, x)
118   
119    def runXY(self, x=0.0):
120        """
121        Evaluate the model in cartesian coordinates
122       
123        :param x: input q, or [qx, qy]
124       
125        :return: scattering function P(q)
126       
127        """
128        return CTeubnerStreyModel.runXY(self, x)
129       
130    def evalDistribution(self, x):
131        """
132        Evaluate the model in cartesian coordinates
133       
134        :param x: input q[], or [qx[], qy[]]
135       
136        :return: scattering function P(q[])
137       
138        """
139        return CTeubnerStreyModel.evalDistribution(self, x)
140       
141    def calculate_ER(self):
142        """
143        Calculate the effective radius for P(q)*S(q)
144       
145        :return: the value of the effective radius
146       
147        """       
148        return CTeubnerStreyModel.calculate_ER(self)
149       
150    def calculate_VR(self):
151        """
152        Calculate the volf ratio for P(q)*S(q)
153       
154        :return: the value of the volf ratio
155       
156        """       
157        return CTeubnerStreyModel.calculate_VR(self)
158             
159    def set_dispersion(self, parameter, dispersion):
160        """
161        Set the dispersion object for a model parameter
162       
163        :param parameter: name of the parameter [string]
164        :param dispersion: dispersion object of type DispersionModel
165       
166        """
167        return CTeubnerStreyModel.set_dispersion(self,
168               parameter, dispersion.cdisp)
169       
170   
171# End of file
172
Note: See TracBrowser for help on using the repository browser.