source: sasview/src/sans/models/MicelleSphCoreModel.py @ 5d63ea0

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 5d63ea0 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.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\micelleSphCore.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CMicelleSphCoreModel
28
29def create_MicelleSphCoreModel():
30    """
31       Create a model instance
32    """
33    obj = MicelleSphCoreModel()
34    # CMicelleSphCoreModel.__init__(obj) is called by
35    # the MicelleSphCoreModel constructor
36    return obj
37
38class MicelleSphCoreModel(CMicelleSphCoreModel, BaseComponent):
39    """
40    Class that evaluates a MicelleSphCoreModel model.
41    This file was auto-generated from src\sans\models\include\micelleSphCore.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    * ndensity        = 8.94e+15 [1/cm^(3)]
49    * v_core          = 62624.0 [A^3]
50    * v_corona        = 61940.0 [A^(3)]
51    * rho_solv        = 6.4e-06 [1/A^(2)]
52    * rho_core        = 3.4e-07 [1/A^(2)]
53    * rho_corona      = 8e-07 [1/A^(2)]
54    * radius_core     = 45.0 [A]
55    * radius_gyr      = 20.0 [A]
56    * d_penetration   = 1.0
57    * n_aggreg        = 6.0
58    * background      = 0.0 [1/cm]
59
60    """
61       
62    def __init__(self, multfactor=1):
63        """ Initialization """
64        self.__dict__ = {}
65       
66        # Initialize BaseComponent first, then sphere
67        BaseComponent.__init__(self)
68        #apply(CMicelleSphCoreModel.__init__, (self,))
69
70        CMicelleSphCoreModel.__init__(self)
71        self.is_multifunc = False
72                       
73        ## Name of the model
74        self.name = "MicelleSphCoreModel"
75        ## Model description
76        self.description = """
77       
78                Model parameters:
79                ndensity : number density of micelles
80                v_core: volume block in core
81                v_corona: volume block in corona
82                rho_solv: sld of solvent
83                rho_core: sld of core
84                rho_corona: sld of corona
85                radius_core: radius of core
86                radius_gyr: radius of gyration of chains in corona
87                d_penetration: close to unity, mimics non-penetration of gaussian chains
88                n_aggreg: aggregation number of the micelle
89                background: incoherent background
90                scale : scale factor
91        """
92       
93        ## Parameter details [units, min, max]
94        self.details = {}
95        self.details['scale'] = ['', None, None]
96        self.details['ndensity'] = ['[1/cm^(3)]', None, None]
97        self.details['v_core'] = ['[A^3]', None, None]
98        self.details['v_corona'] = ['[A^(3)]', None, None]
99        self.details['rho_solv'] = ['[1/A^(2)]', None, None]
100        self.details['rho_core'] = ['[1/A^(2)]', None, None]
101        self.details['rho_corona'] = ['[1/A^(2)]', None, None]
102        self.details['radius_core'] = ['[A]', None, None]
103        self.details['radius_gyr'] = ['[A]', None, None]
104        self.details['d_penetration'] = ['', None, None]
105        self.details['n_aggreg'] = ['', None, None]
106        self.details['background'] = ['[1/cm]', None, None]
107
108        ## fittable parameters
109        self.fixed = ['radius_core.width',
110                      'radius_gyr.width']
111       
112        ## non-fittable parameters
113        self.non_fittable = []
114       
115        ## parameters with orientation
116        self.orientation_params = []
117
118        ## parameters with magnetism
119        self.magnetic_params = []
120
121        self.category = None
122        self.multiplicity_info = None
123       
124    def __setstate__(self, state):
125        """
126        restore the state of a model from pickle
127        """
128        self.__dict__, self.params, self.dispersion = state
129       
130    def __reduce_ex__(self, proto):
131        """
132        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
133        c model.
134        """
135        state = (self.__dict__, self.params, self.dispersion)
136        return (create_MicelleSphCoreModel, tuple(), state, None, None)
137       
138    def clone(self):
139        """ Return a identical copy of self """
140        return self._clone(MicelleSphCoreModel())   
141       
142    def run(self, x=0.0):
143        """
144        Evaluate the model
145       
146        :param x: input q, or [q,phi]
147       
148        :return: scattering function P(q)
149       
150        """
151        return CMicelleSphCoreModel.run(self, x)
152   
153    def runXY(self, x=0.0):
154        """
155        Evaluate the model in cartesian coordinates
156       
157        :param x: input q, or [qx, qy]
158       
159        :return: scattering function P(q)
160       
161        """
162        return CMicelleSphCoreModel.runXY(self, x)
163       
164    def evalDistribution(self, x):
165        """
166        Evaluate the model in cartesian coordinates
167       
168        :param x: input q[], or [qx[], qy[]]
169       
170        :return: scattering function P(q[])
171       
172        """
173        return CMicelleSphCoreModel.evalDistribution(self, x)
174       
175    def calculate_ER(self):
176        """
177        Calculate the effective radius for P(q)*S(q)
178       
179        :return: the value of the effective radius
180       
181        """       
182        return CMicelleSphCoreModel.calculate_ER(self)
183       
184    def calculate_VR(self):
185        """
186        Calculate the volf ratio for P(q)*S(q)
187       
188        :return: the value of the volf ratio
189       
190        """       
191        return CMicelleSphCoreModel.calculate_VR(self)
192             
193    def set_dispersion(self, parameter, dispersion):
194        """
195        Set the dispersion object for a model parameter
196       
197        :param parameter: name of the parameter [string]
198        :param dispersion: dispersion object of type DispersionModel
199       
200        """
201        return CMicelleSphCoreModel.set_dispersion(self,
202               parameter, dispersion.cdisp)
203       
204   
205# End of file
206
Note: See TracBrowser for help on using the repository browser.