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