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