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