source: sasview/src/sans/models/GelFitModel.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.3 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\GelFit.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CGelFitModel
28
29def create_GelFitModel():
30    """
31       Create a model instance
32    """
33    obj = GelFitModel()
34    # CGelFitModel.__init__(obj) is called by
35    # the GelFitModel constructor
36    return obj
37
38class GelFitModel(CGelFitModel, BaseComponent):
39    """
40    Class that evaluates a GelFitModel model.
41    This file was auto-generated from src\sans\models\include\GelFit.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    * lScale          = 3.5
48    * gScale          = 1.7
49    * zeta            = 16.0
50    * radius          = 104.0
51    * scale           = 2.0
52    * background      = 0.01
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(CGelFitModel.__init__, (self,))
63
64        CGelFitModel.__init__(self)
65        self.is_multifunc = False
66                       
67        ## Name of the model
68        self.name = "GelFitModel"
69        ## Model description
70        self.description = """
71        Structure factor for interacting particles:                   .
72                Shibayama-Geissler Two-Length Scale Fit for Gels
73                (GelFit)
74               
75                Sibayama; Tanaka; Han J Chem Phys(1992), 97(9), 6829-6841
76                Mallam; Horkay; Hecht; Rennie; Geissler, Macromol(1991), 24, 543
77        """
78       
79        ## Parameter details [units, min, max]
80        self.details = {}
81        self.details['lScale'] = ['', None, None]
82        self.details['gScale'] = ['', None, None]
83        self.details['zeta'] = ['', None, None]
84        self.details['radius'] = ['', None, None]
85        self.details['scale'] = ['', None, None]
86        self.details['background'] = ['', None, None]
87
88        ## fittable parameters
89        self.fixed = []
90       
91        ## non-fittable parameters
92        self.non_fittable = []
93       
94        ## parameters with orientation
95        self.orientation_params = []
96
97        ## parameters with magnetism
98        self.magnetic_params = []
99
100        self.category = None
101        self.multiplicity_info = None
102       
103    def __setstate__(self, state):
104        """
105        restore the state of a model from pickle
106        """
107        self.__dict__, self.params, self.dispersion = state
108       
109    def __reduce_ex__(self, proto):
110        """
111        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
112        c model.
113        """
114        state = (self.__dict__, self.params, self.dispersion)
115        return (create_GelFitModel, tuple(), state, None, None)
116       
117    def clone(self):
118        """ Return a identical copy of self """
119        return self._clone(GelFitModel())   
120       
121    def run(self, x=0.0):
122        """
123        Evaluate the model
124       
125        :param x: input q, or [q,phi]
126       
127        :return: scattering function P(q)
128       
129        """
130        return CGelFitModel.run(self, x)
131   
132    def runXY(self, x=0.0):
133        """
134        Evaluate the model in cartesian coordinates
135       
136        :param x: input q, or [qx, qy]
137       
138        :return: scattering function P(q)
139       
140        """
141        return CGelFitModel.runXY(self, x)
142       
143    def evalDistribution(self, x):
144        """
145        Evaluate the model in cartesian coordinates
146       
147        :param x: input q[], or [qx[], qy[]]
148       
149        :return: scattering function P(q[])
150       
151        """
152        return CGelFitModel.evalDistribution(self, x)
153       
154    def calculate_ER(self):
155        """
156        Calculate the effective radius for P(q)*S(q)
157       
158        :return: the value of the effective radius
159       
160        """       
161        return CGelFitModel.calculate_ER(self)
162       
163    def calculate_VR(self):
164        """
165        Calculate the volf ratio for P(q)*S(q)
166       
167        :return: the value of the volf ratio
168       
169        """       
170        return CGelFitModel.calculate_VR(self)
171             
172    def set_dispersion(self, parameter, dispersion):
173        """
174        Set the dispersion object for a model parameter
175       
176        :param parameter: name of the parameter [string]
177        :param dispersion: dispersion object of type DispersionModel
178       
179        """
180        return CGelFitModel.set_dispersion(self,
181               parameter, dispersion.cdisp)
182       
183   
184# End of file
185
Note: See TracBrowser for help on using the repository browser.