source: sasview/sansmodels/src/sans/models/RPAModel.py @ 20f00bed

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 20f00bed was 35aface, checked in by Jae Cho <jhjcho@…>, 14 years ago

addede new models and attr. non_fittable

  • Property mode set to 100644
File size: 7.3 KB
Line 
1#!/usr/bin/env python
2
3##############################################################################
4#       This software was developed by the University of Tennessee as part of the
5#       Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
6#       project funded by the US National Science Foundation.
7#
8#       If you use DANSE applications to do scientific research that leads to
9#       publication, we ask that you acknowledge the use of the software with the
10#       following sentence:
11#
12#       "This work benefited from DANSE software developed under NSF award DMR-0520547."
13#
14#       copyright 2008, University of Tennessee
15##############################################################################
16
17
18"""
19Provide functionality for a C extension model
20
21:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
22         DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\rpa.h
23         AND RE-RUN THE GENERATOR SCRIPT
24
25"""
26
27from sans.models.BaseComponent import BaseComponent
28from sans_extension.c_models import CRPAModel
29import copy   
30   
31class RPAModel(CRPAModel, BaseComponent):
32    """
33    Class that evaluates a RPAModel model.
34    This file was auto-generated from ..\c_extensions\rpa.h.
35    Refer to that file and the structure it contains
36    for details of the model.
37    List of default parameters:
38         lcase_n         = 0.0
39         ba              = 5.0
40         bb              = 5.0
41         bc              = 5.0
42         bd              = 5.0
43         Kab             = -0.0004
44         Kac             = -0.0004
45         Kad             = -0.0004
46         Kbc             = -0.0004
47         Kbd             = -0.0004
48         Kcd             = -0.0004
49         scale           = 1.0
50         background      = 0.0 [1/cm]
51         Na              = 1000.0
52         Phia            = 0.25
53         va              = 100.0
54         La              = 1e-012
55         Nb              = 1000.0
56         Phib            = 0.25
57         vb              = 100.0
58         Lb              = 1e-012
59         Nc              = 1000.0
60         Phic            = 0.25
61         vc              = 100.0
62         Lc              = 1e-012
63         Nd              = 1000.0
64         Phid            = 0.25
65         vd              = 100.0
66         Ld              = 0.0
67
68    """
69       
70    def __init__(self):
71        """ Initialization """
72       
73        # Initialize BaseComponent first, then sphere
74        BaseComponent.__init__(self)
75        CRPAModel.__init__(self)
76       
77        ## Name of the model
78        self.name = "RPAModel"
79        ## Model description
80        self.description ="""  THIS FORMALISM APPLIES TO MULTICOMPONENT POLYMER MIXTURES IN THE
81                HOMOGENEOUS (MIXED) PHASE REGION ONLY.;
82                CASE 0: C/D BINARY MIXTURE OF HOMOPOLYMERS
83                CASE 1: C-D DIBLOCK COPOLYMER
84                CASE 2: B/C/D TERNARY MIXTURE OF HOMOPOLYMERS
85                CASE 3: B/C-D MIXTURE OF HOMOPOLYMER B AND
86                DIBLOCK COPOLYMER C-D
87                CASE 4: B-C-D TRIBLOCK COPOLYMER
88                CASE 5: A/B/C/D QUATERNARY MIXTURE OF HOMOPOLYMERS
89                CASE 6: A/B/C-D MIXTURE OF TWO HOMOPOLYMERS A/B
90                AND A DIBLOCK C-D
91                CASE 7: A/B-C-D MIXTURE OF A HOMOPOLYMER A AND A
92                TRIBLOCK B-C-D
93                CASE 8: A-B/C-D MIXTURE OF TWO DIBLOCK COPOLYMERS
94                A-B AND C-D
95                CASE 9: A-B-C-D FOUR-BLOCK COPOLYMER
96                See details in the model function help"""
97       
98        ## Parameter details [units, min, max]
99        self.details = {}
100        self.details['lcase_n'] = ['', None, None]
101        self.details['ba'] = ['', None, None]
102        self.details['bb'] = ['', None, None]
103        self.details['bc'] = ['', None, None]
104        self.details['bd'] = ['', None, None]
105        self.details['Kab'] = ['', None, None]
106        self.details['Kac'] = ['', None, None]
107        self.details['Kad'] = ['', None, None]
108        self.details['Kbc'] = ['', None, None]
109        self.details['Kbd'] = ['', None, None]
110        self.details['Kcd'] = ['', None, None]
111        self.details['scale'] = ['', None, None]
112        self.details['background'] = ['[1/cm]', None, None]
113        self.details['Na'] = ['', None, None]
114        self.details['Phia'] = ['', None, None]
115        self.details['va'] = ['', None, None]
116        self.details['La'] = ['', None, None]
117        self.details['Nb'] = ['', None, None]
118        self.details['Phib'] = ['', None, None]
119        self.details['vb'] = ['', None, None]
120        self.details['Lb'] = ['', None, None]
121        self.details['Nc'] = ['', None, None]
122        self.details['Phic'] = ['', None, None]
123        self.details['vc'] = ['', None, None]
124        self.details['Lc'] = ['', None, None]
125        self.details['Nd'] = ['', None, None]
126        self.details['Phid'] = ['', None, None]
127        self.details['vd'] = ['', None, None]
128        self.details['Ld'] = ['', None, None]
129
130        ## fittable parameters
131        self.fixed=[]
132       
133        ## non-fittable parameters
134        self.non_fittable=['lcase_n', 'Na', 'Phia', 'va', 'La', 'Nb', 'Phib', 'vb', 'Lb', 'Nc', 'Phic', 'vc', 'Lc', 'Nd', 'Phid', 'vd', 'Ld']
135       
136        ## parameters with orientation
137        self.orientation_params =[]
138   
139    def clone(self):
140        """ Return a identical copy of self """
141        return self._clone(RPAModel())   
142       
143    def __getstate__(self):
144        """
145        return object state for pickling and copying
146        """
147        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}
148       
149        return self.__dict__, model_state
150       
151    def __setstate__(self, state):
152        """
153        create object from pickled state
154       
155        :param state: the state of the current model
156       
157        """
158       
159        self.__dict__, model_state = state
160        self.params = model_state['params']
161        self.dispersion = model_state['dispersion']
162        self.log = model_state['log']
163       
164   
165    def run(self, x=0.0):
166        """
167        Evaluate the model
168       
169        :param x: input q, or [q,phi]
170       
171        :return: scattering function P(q)
172       
173        """
174       
175        return CRPAModel.run(self, x)
176   
177    def runXY(self, x=0.0):
178        """
179        Evaluate the model in cartesian coordinates
180       
181        :param x: input q, or [qx, qy]
182       
183        :return: scattering function P(q)
184       
185        """
186       
187        return CRPAModel.runXY(self, x)
188       
189    def evalDistribution(self, x=[]):
190        """
191        Evaluate the model in cartesian coordinates
192       
193        :param x: input q[], or [qx[], qy[]]
194       
195        :return: scattering function P(q[])
196       
197        """
198        return CRPAModel.evalDistribution(self, x)
199       
200    def calculate_ER(self):
201        """
202        Calculate the effective radius for P(q)*S(q)
203       
204        :return: the value of the effective radius
205       
206        """       
207        return CRPAModel.calculate_ER(self)
208       
209    def set_dispersion(self, parameter, dispersion):
210        """
211        Set the dispersion object for a model parameter
212       
213        :param parameter: name of the parameter [string]
214        :param dispersion: dispersion object of type DispersionModel
215       
216        """
217        return CRPAModel.set_dispersion(self, parameter, dispersion.cdisp)
218       
219   
220# End of file
Note: See TracBrowser for help on using the repository browser.