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