source: sasview/src/sans/models/PearlNecklaceModel.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: 6.8 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\pearlnecklace.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CPearlNecklaceModel
28
29def create_PearlNecklaceModel():
30    """
31       Create a model instance
32    """
33    obj = PearlNecklaceModel()
34    # CPearlNecklaceModel.__init__(obj) is called by
35    # the PearlNecklaceModel constructor
36    return obj
37
38class PearlNecklaceModel(CPearlNecklaceModel, BaseComponent):
39    """
40    Class that evaluates a PearlNecklaceModel model.
41    This file was auto-generated from src\sans\models\include\pearlnecklace.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    * scale           = 1.0
48    * radius          = 80.0 [A]
49    * edge_separation = 350.0 [A]
50    * thick_string    = 2.5 [A]
51    * num_pearls      = 3.0
52    * sld_pearl       = 1e-06 [1/A^(2)]
53    * sld_string      = 1e-06 [1/A^(2)]
54    * sld_solv        = 6.3e-06 [1/A^(2)]
55    * background      = 0.0
56    * scale           = 1.0
57    * radius          = 80.0 [A]
58    * edge_separation = 350.0 [A]
59    * thick_string    = 2.5 [A]
60    * num_pearls      = 3.0
61    * sld_pearl       = 1e-06 [1/A^(2)]
62    * sld_string      = 1e-06 [1/A^(2)]
63    * sld_solv        = 6.3e-06 [1/A^(2)]
64    * background      = 0.0
65
66    """
67       
68    def __init__(self, multfactor=1):
69        """ Initialization """
70        self.__dict__ = {}
71       
72        # Initialize BaseComponent first, then sphere
73        BaseComponent.__init__(self)
74        #apply(CPearlNecklaceModel.__init__, (self,))
75
76        CPearlNecklaceModel.__init__(self)
77        self.is_multifunc = False
78                       
79        ## Name of the model
80        self.name = "PearlNecklaceModel"
81        ## Model description
82        self.description = """
83        Calculate form factor for Pearl Necklace Model
84                [Macromol. Symp. 2004, 211, 25-42]
85                Parameters:
86                background:background
87                scale: scale factor
88                sld_pearl: the SLD of the pearl spheres
89                sld_string: the SLD of the strings
90                sld_solv: the SLD of the solvent
91                num_pearls: number of the pearls
92                radius: the radius of a pearl
93                edge_separation: the length of string segment; surface to surface
94                thick_string: thickness (ie, diameter) of the string
95        """
96       
97        ## Parameter details [units, min, max]
98        self.details = {}
99        self.details['scale'] = ['', None, None]
100        self.details['radius'] = ['[A]', None, None]
101        self.details['edge_separation'] = ['[A]', None, None]
102        self.details['thick_string'] = ['[A]', None, None]
103        self.details['num_pearls'] = ['', None, None]
104        self.details['sld_pearl'] = ['[1/A^(2)]', None, None]
105        self.details['sld_string'] = ['[1/A^(2)]', None, None]
106        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
107        self.details['background'] = ['', None, None]
108        self.details['scale'] = ['', None, None]
109        self.details['radius'] = ['[A]', None, None]
110        self.details['edge_separation'] = ['[A]', None, None]
111        self.details['thick_string'] = ['[A]', None, None]
112        self.details['num_pearls'] = ['', None, None]
113        self.details['sld_pearl'] = ['[1/A^(2)]', None, None]
114        self.details['sld_string'] = ['[1/A^(2)]', None, None]
115        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
116        self.details['background'] = ['', None, None]
117
118        ## fittable parameters
119        self.fixed = ['radius.width',
120                      'edge_separation.width']
121       
122        ## non-fittable parameters
123        self.non_fittable = []
124       
125        ## parameters with orientation
126        self.orientation_params = []
127
128        ## parameters with magnetism
129        self.magnetic_params = []
130
131        self.category = None
132        self.multiplicity_info = None
133       
134    def __setstate__(self, state):
135        """
136        restore the state of a model from pickle
137        """
138        self.__dict__, self.params, self.dispersion = state
139       
140    def __reduce_ex__(self, proto):
141        """
142        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
143        c model.
144        """
145        state = (self.__dict__, self.params, self.dispersion)
146        return (create_PearlNecklaceModel, tuple(), state, None, None)
147       
148    def clone(self):
149        """ Return a identical copy of self """
150        return self._clone(PearlNecklaceModel())   
151       
152    def run(self, x=0.0):
153        """
154        Evaluate the model
155       
156        :param x: input q, or [q,phi]
157       
158        :return: scattering function P(q)
159       
160        """
161        return CPearlNecklaceModel.run(self, x)
162   
163    def runXY(self, x=0.0):
164        """
165        Evaluate the model in cartesian coordinates
166       
167        :param x: input q, or [qx, qy]
168       
169        :return: scattering function P(q)
170       
171        """
172        return CPearlNecklaceModel.runXY(self, x)
173       
174    def evalDistribution(self, x):
175        """
176        Evaluate the model in cartesian coordinates
177       
178        :param x: input q[], or [qx[], qy[]]
179       
180        :return: scattering function P(q[])
181       
182        """
183        return CPearlNecklaceModel.evalDistribution(self, x)
184       
185    def calculate_ER(self):
186        """
187        Calculate the effective radius for P(q)*S(q)
188       
189        :return: the value of the effective radius
190       
191        """       
192        return CPearlNecklaceModel.calculate_ER(self)
193       
194    def calculate_VR(self):
195        """
196        Calculate the volf ratio for P(q)*S(q)
197       
198        :return: the value of the volf ratio
199       
200        """       
201        return CPearlNecklaceModel.calculate_VR(self)
202             
203    def set_dispersion(self, parameter, dispersion):
204        """
205        Set the dispersion object for a model parameter
206       
207        :param parameter: name of the parameter [string]
208        :param dispersion: dispersion object of type DispersionModel
209       
210        """
211        return CPearlNecklaceModel.set_dispersion(self,
212               parameter, dispersion.cdisp)
213       
214   
215# End of file
216
Note: See TracBrowser for help on using the repository browser.