source: sasview/src/sans/models/StickyHSStructure.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.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::
19
20   THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
21   DO NOT MODIFY THIS FILE, MODIFY
22   src\sans\models\include\StickyHS.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CStickyHSStructure
28
29def create_StickyHSStructure():
30    """
31       Create a model instance
32    """
33    obj = StickyHSStructure()
34    # CStickyHSStructure.__init__(obj) is called by
35    # the StickyHSStructure constructor
36    return obj
37
38class StickyHSStructure(CStickyHSStructure, BaseComponent):
39    """
40    Class that evaluates a StickyHSStructure model.
41    This file was auto-generated from src\sans\models\include\StickyHS.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    * effect_radius   = 50.0 [A]
48    * volfraction     = 0.1
49    * perturb         = 0.05
50    * stickiness      = 0.2
51
52    """
53       
54    def __init__(self, multfactor=1):
55        """ Initialization """
56        self.__dict__ = {}
57       
58        # Initialize BaseComponent first, then sphere
59        BaseComponent.__init__(self)
60        #apply(CStickyHSStructure.__init__, (self,))
61
62        CStickyHSStructure.__init__(self)
63        self.is_multifunc = False
64                       
65        ## Name of the model
66        self.name = "StickyHSStructure"
67        ## Model description
68        self.description = """
69         Structure Factor for interacting particles:                               .
70               
71                The interaction potential is
72               
73                U(r)= inf , r < 2R
74                = -Uo  , 2R < r < 2R + w
75                = 0   , r >= 2R +w
76               
77                R: effective radius of the hardsphere
78                stickiness = [exp(Uo/kT)]/(12*perturb)
79                perturb = w/(w+ 2R) , 0.01 =< w <= 0.1
80                w: The width of the square well ,w > 0
81                v: The volume fraction , v > 0
82               
83                Ref: Menon, S. V. G.,et.al., J. Chem.
84                Phys., 1991, 95(12), 9186-9190.
85        """
86       
87        ## Parameter details [units, min, max]
88        self.details = {}
89        self.details['effect_radius'] = ['[A]', None, None]
90        self.details['volfraction'] = ['', None, None]
91        self.details['perturb'] = ['', None, None]
92        self.details['stickiness'] = ['', None, None]
93
94        ## fittable parameters
95        self.fixed = ['effect_radius.width']
96       
97        ## non-fittable parameters
98        self.non_fittable = []
99       
100        ## parameters with orientation
101        self.orientation_params = []
102
103        ## parameters with magnetism
104        self.magnetic_params = []
105
106        self.category = None
107        self.multiplicity_info = None
108       
109    def __setstate__(self, state):
110        """
111        restore the state of a model from pickle
112        """
113        self.__dict__, self.params, self.dispersion = state
114       
115    def __reduce_ex__(self, proto):
116        """
117        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
118        c model.
119        """
120        state = (self.__dict__, self.params, self.dispersion)
121        return (create_StickyHSStructure, tuple(), state, None, None)
122       
123    def clone(self):
124        """ Return a identical copy of self """
125        return self._clone(StickyHSStructure())   
126       
127    def run(self, x=0.0):
128        """
129        Evaluate the model
130       
131        :param x: input q, or [q,phi]
132       
133        :return: scattering function P(q)
134       
135        """
136        return CStickyHSStructure.run(self, x)
137   
138    def runXY(self, x=0.0):
139        """
140        Evaluate the model in cartesian coordinates
141       
142        :param x: input q, or [qx, qy]
143       
144        :return: scattering function P(q)
145       
146        """
147        return CStickyHSStructure.runXY(self, x)
148       
149    def evalDistribution(self, x):
150        """
151        Evaluate the model in cartesian coordinates
152       
153        :param x: input q[], or [qx[], qy[]]
154       
155        :return: scattering function P(q[])
156       
157        """
158        return CStickyHSStructure.evalDistribution(self, x)
159       
160    def calculate_ER(self):
161        """
162        Calculate the effective radius for P(q)*S(q)
163       
164        :return: the value of the effective radius
165       
166        """       
167        return CStickyHSStructure.calculate_ER(self)
168       
169    def calculate_VR(self):
170        """
171        Calculate the volf ratio for P(q)*S(q)
172       
173        :return: the value of the volf ratio
174       
175        """       
176        return CStickyHSStructure.calculate_VR(self)
177             
178    def set_dispersion(self, parameter, dispersion):
179        """
180        Set the dispersion object for a model parameter
181       
182        :param parameter: name of the parameter [string]
183        :param dispersion: dispersion object of type DispersionModel
184       
185        """
186        return CStickyHSStructure.set_dispersion(self,
187               parameter, dispersion.cdisp)
188       
189   
190# End of file
191
Note: See TracBrowser for help on using the repository browser.