source: sasview/src/sans/models/TwoYukawaModel.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: 5.6 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\TwoYukawa.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CTwoYukawaModel
28
29def create_TwoYukawaModel():
30    """
31       Create a model instance
32    """
33    obj = TwoYukawaModel()
34    # CTwoYukawaModel.__init__(obj) is called by
35    # the TwoYukawaModel constructor
36    return obj
37
38class TwoYukawaModel(CTwoYukawaModel, BaseComponent):
39    """
40    Class that evaluates a TwoYukawaModel model.
41    This file was auto-generated from src\sans\models\include\TwoYukawa.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    * volfraction     = 0.2
48    * effect_radius   = 50.0 [A]
49    * scale_K1        = 6.0
50    * decayConst_Z1   = 10.0
51    * scale_K2        = -1.0
52    * decayConst_Z2   = 2.0
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(CTwoYukawaModel.__init__, (self,))
63
64        CTwoYukawaModel.__init__(self)
65        self.is_multifunc = False
66                       
67        ## Name of the model
68        self.name = "TwoYukawaModel"
69        ## Model description
70        self.description = """
71        Structure factor for interacting particles:                   .
72               
73                Calculates the structure factor, S(q), for a monodisperse spherical particle interacting
74                through a two-Yukawa potential. The Mean Spherical Approximation is used as the
75                closure to solve the Ornstein-Zernicke equations.
76               
77                The function calculated is S(q), based on the solution of the Ornstein-Zernicke equations
78                using the Two-Yukawa potential (in its scaled form, r=r/diam):
79               
80                Radius is that of the hard core. The returned value is dimensionless.
81        """
82       
83        ## Parameter details [units, min, max]
84        self.details = {}
85        self.details['volfraction'] = ['', None, None]
86        self.details['effect_radius'] = ['[A]', None, None]
87        self.details['scale_K1'] = ['', None, None]
88        self.details['decayConst_Z1'] = ['', None, None]
89        self.details['scale_K2'] = ['', None, None]
90        self.details['decayConst_Z2'] = ['', None, None]
91
92        ## fittable parameters
93        self.fixed = []
94       
95        ## non-fittable parameters
96        self.non_fittable = []
97       
98        ## parameters with orientation
99        self.orientation_params = []
100
101        ## parameters with magnetism
102        self.magnetic_params = []
103
104        self.category = None
105        self.multiplicity_info = None
106       
107    def __setstate__(self, state):
108        """
109        restore the state of a model from pickle
110        """
111        self.__dict__, self.params, self.dispersion = state
112       
113    def __reduce_ex__(self, proto):
114        """
115        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
116        c model.
117        """
118        state = (self.__dict__, self.params, self.dispersion)
119        return (create_TwoYukawaModel, tuple(), state, None, None)
120       
121    def clone(self):
122        """ Return a identical copy of self """
123        return self._clone(TwoYukawaModel())   
124       
125    def run(self, x=0.0):
126        """
127        Evaluate the model
128       
129        :param x: input q, or [q,phi]
130       
131        :return: scattering function P(q)
132       
133        """
134        return CTwoYukawaModel.run(self, x)
135   
136    def runXY(self, x=0.0):
137        """
138        Evaluate the model in cartesian coordinates
139       
140        :param x: input q, or [qx, qy]
141       
142        :return: scattering function P(q)
143       
144        """
145        return CTwoYukawaModel.runXY(self, x)
146       
147    def evalDistribution(self, x):
148        """
149        Evaluate the model in cartesian coordinates
150       
151        :param x: input q[], or [qx[], qy[]]
152       
153        :return: scattering function P(q[])
154       
155        """
156        return CTwoYukawaModel.evalDistribution(self, x)
157       
158    def calculate_ER(self):
159        """
160        Calculate the effective radius for P(q)*S(q)
161       
162        :return: the value of the effective radius
163       
164        """       
165        return CTwoYukawaModel.calculate_ER(self)
166       
167    def calculate_VR(self):
168        """
169        Calculate the volf ratio for P(q)*S(q)
170       
171        :return: the value of the volf ratio
172       
173        """       
174        return CTwoYukawaModel.calculate_VR(self)
175             
176    def set_dispersion(self, parameter, dispersion):
177        """
178        Set the dispersion object for a model parameter
179       
180        :param parameter: name of the parameter [string]
181        :param dispersion: dispersion object of type DispersionModel
182       
183        """
184        return CTwoYukawaModel.set_dispersion(self,
185               parameter, dispersion.cdisp)
186       
187   
188# End of file
189
Note: See TracBrowser for help on using the repository browser.