source: sasview/src/sans/models/MassSurfaceFractal.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: 5.7 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\masssurfacefractal.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CMassSurfaceFractal
28
29def create_MassSurfaceFractal():
30    """
31       Create a model instance
32    """
33    obj = MassSurfaceFractal()
34    # CMassSurfaceFractal.__init__(obj) is called by
35    # the MassSurfaceFractal constructor
36    return obj
37
38class MassSurfaceFractal(CMassSurfaceFractal, BaseComponent):
39    """
40    Class that evaluates a MassSurfaceFractal model.
41    This file was auto-generated from src\sans\models\include\masssurfacefractal.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    * mass_dim        = 1.8
49    * surface_dim     = 2.3
50    * cluster_rg      = 86.7 [A]
51    * primary_rg      = 4000.0 [A]
52    * background      = 0.0
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(CMassSurfaceFractal.__init__, (self,))
63
64        CMassSurfaceFractal.__init__(self)
65        self.is_multifunc = False
66                       
67        ## Name of the model
68        self.name = "MassSurfaceFractal"
69        ## Model description
70        self.description = """
71         The scattering intensity  I(x) = scale*P(x) + background,
72                p(x)= {[1+(x^2*a)]^(Dm/2) * [1+(x^2*b)]^(6-Ds-Dm)/2}^(-1)
73                a = Rg^2/(3*Dm/2)
74                b = rg^2/(3*(6-Ds-Dm)/2)
75                scale        =  scale factor * N*Volume^2*contrast^2
76                mass_dim       =  Dm (mass fractal dimension)
77                surface_dim  =  Ds
78                cluster_rg  =  Rg
79                primary_rg    =  rg
80                background   =  background
81                Ref: Schmidt, J Appl Cryst, eq(19), (1991), 24, 414-435
82                : Hurd, Schaefer, Martin, Phys Rev A, eq(2),(1987),35, 2361-2364
83                Note that 0 < Ds< 6 and 0 < Dm < 6.
84        """
85       
86        ## Parameter details [units, min, max]
87        self.details = {}
88        self.details['scale'] = ['', None, None]
89        self.details['mass_dim'] = ['', None, None]
90        self.details['surface_dim'] = ['', None, None]
91        self.details['cluster_rg'] = ['[A]', None, None]
92        self.details['primary_rg'] = ['[A]', None, None]
93        self.details['background'] = ['', None, None]
94
95        ## fittable parameters
96        self.fixed = []
97       
98        ## non-fittable parameters
99        self.non_fittable = []
100       
101        ## parameters with orientation
102        self.orientation_params = []
103
104        ## parameters with magnetism
105        self.magnetic_params = []
106
107        self.category = None
108        self.multiplicity_info = None
109       
110    def __setstate__(self, state):
111        """
112        restore the state of a model from pickle
113        """
114        self.__dict__, self.params, self.dispersion = state
115       
116    def __reduce_ex__(self, proto):
117        """
118        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
119        c model.
120        """
121        state = (self.__dict__, self.params, self.dispersion)
122        return (create_MassSurfaceFractal, tuple(), state, None, None)
123       
124    def clone(self):
125        """ Return a identical copy of self """
126        return self._clone(MassSurfaceFractal())   
127       
128    def run(self, x=0.0):
129        """
130        Evaluate the model
131       
132        :param x: input q, or [q,phi]
133       
134        :return: scattering function P(q)
135       
136        """
137        return CMassSurfaceFractal.run(self, x)
138   
139    def runXY(self, x=0.0):
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 CMassSurfaceFractal.runXY(self, x)
149       
150    def evalDistribution(self, x):
151        """
152        Evaluate the model in cartesian coordinates
153       
154        :param x: input q[], or [qx[], qy[]]
155       
156        :return: scattering function P(q[])
157       
158        """
159        return CMassSurfaceFractal.evalDistribution(self, x)
160       
161    def calculate_ER(self):
162        """
163        Calculate the effective radius for P(q)*S(q)
164       
165        :return: the value of the effective radius
166       
167        """       
168        return CMassSurfaceFractal.calculate_ER(self)
169       
170    def calculate_VR(self):
171        """
172        Calculate the volf ratio for P(q)*S(q)
173       
174        :return: the value of the volf ratio
175       
176        """       
177        return CMassSurfaceFractal.calculate_VR(self)
178             
179    def set_dispersion(self, parameter, dispersion):
180        """
181        Set the dispersion object for a model parameter
182       
183        :param parameter: name of the parameter [string]
184        :param dispersion: dispersion object of type DispersionModel
185       
186        """
187        return CMassSurfaceFractal.set_dispersion(self,
188               parameter, dispersion.cdisp)
189       
190   
191# End of file
192
Note: See TracBrowser for help on using the repository browser.