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