source: sasview/src/sans/models/Poly_GaussCoil.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@…>, 11 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.4 KB
RevLine 
[81b524f]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\polygausscoil.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CPoly_GaussCoil
26
27def create_Poly_GaussCoil():
28    """
29       Create a model instance
30    """
31    obj = Poly_GaussCoil()
32    # CPoly_GaussCoil.__init__(obj) is called by
33    # the Poly_GaussCoil constructor
34    return obj
35
36class Poly_GaussCoil(CPoly_GaussCoil, BaseComponent):
37    """
38    Class that evaluates a Poly_GaussCoil model.
39    This file was auto-generated from src\sans\models\include\polygausscoil.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
43         rg              = 60.0 [A]
44         scale           = 1.0
45         poly_m          = 2.0 [Mw/Mn]
46         background      = 0.001 [1/cm]
47
48    """
49       
50    def __init__(self, multfactor=1):
51        """ Initialization """
52        self.__dict__ = {}
53       
54        # Initialize BaseComponent first, then sphere
55        BaseComponent.__init__(self)
56        #apply(CPoly_GaussCoil.__init__, (self,))
57
58        CPoly_GaussCoil.__init__(self)
59        self.is_multifunc = False
60                       
61        ## Name of the model
62        self.name = "Poly_GaussCoil"
63        ## Model description
64        self.description = """
65        I(q)=(scale)*2*[(1+U*x)^(-1/U)+x-1]/[(1+U)*x^2] + background
66                where x = [rg^2*q^2]
67                and the polydispersity is
68                U = [M_w/M_n]-1.
69                scale = scale factor * volume fraction
70                rg = radius of gyration
71                poly_m = polydispersity of molecular weight
72                background = incoherent background
73        """
74       
75        ## Parameter details [units, min, max]
76        self.details = {}
77        self.details['rg'] = ['[A]', None, None]
78        self.details['scale'] = ['', None, None]
79        self.details['poly_m'] = ['[Mw/Mn]', None, None]
80        self.details['background'] = ['[1/cm]', None, None]
81
82        ## fittable parameters
83        self.fixed = []
84       
85        ## non-fittable parameters
86        self.non_fittable = []
87       
88        ## parameters with orientation
89        self.orientation_params = []
90
91        ## parameters with magnetism
92        self.magnetic_params = []
93
94        self.category = None
95        self.multiplicity_info = None
96       
97    def __setstate__(self, state):
98        """
99        restore the state of a model from pickle
100        """
101        self.__dict__, self.params, self.dispersion = state
102       
103    def __reduce_ex__(self, proto):
104        """
105        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
106        c model.
107        """
108        state = (self.__dict__, self.params, self.dispersion)
109        return (create_Poly_GaussCoil, tuple(), state, None, None)
110       
111    def clone(self):
112        """ Return a identical copy of self """
113        return self._clone(Poly_GaussCoil())   
114       
115    def run(self, x=0.0):
116        """
117        Evaluate the model
118       
119        :param x: input q, or [q,phi]
120       
121        :return: scattering function P(q)
122       
123        """
124        return CPoly_GaussCoil.run(self, x)
125   
126    def runXY(self, x=0.0):
127        """
128        Evaluate the model in cartesian coordinates
129       
130        :param x: input q, or [qx, qy]
131       
132        :return: scattering function P(q)
133       
134        """
135        return CPoly_GaussCoil.runXY(self, x)
136       
137    def evalDistribution(self, x):
138        """
139        Evaluate the model in cartesian coordinates
140       
141        :param x: input q[], or [qx[], qy[]]
142       
143        :return: scattering function P(q[])
144       
145        """
146        return CPoly_GaussCoil.evalDistribution(self, x)
147       
148    def calculate_ER(self):
149        """
150        Calculate the effective radius for P(q)*S(q)
151       
152        :return: the value of the effective radius
153       
154        """       
155        return CPoly_GaussCoil.calculate_ER(self)
156       
157    def calculate_VR(self):
158        """
159        Calculate the volf ratio for P(q)*S(q)
160       
161        :return: the value of the volf ratio
162       
163        """       
164        return CPoly_GaussCoil.calculate_VR(self)
165             
166    def set_dispersion(self, parameter, dispersion):
167        """
168        Set the dispersion object for a model parameter
169       
170        :param parameter: name of the parameter [string]
171        :param dispersion: dispersion object of type DispersionModel
172       
173        """
174        return CPoly_GaussCoil.set_dispersion(self,
175               parameter, dispersion.cdisp)
176       
177   
178# End of file
179
Note: See TracBrowser for help on using the repository browser.