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