source: sasview/src/sans/models/SLDCalFunc.py @ d09f0ae1

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 d09f0ae1 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.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::
19
20   THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
21   DO NOT MODIFY THIS FILE, MODIFY
22   src\sans\models\include\sld_cal.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CSLDCalFunc
28
29def create_SLDCalFunc():
30    """
31       Create a model instance
32    """
33    obj = SLDCalFunc()
34    # CSLDCalFunc.__init__(obj) is called by
35    # the SLDCalFunc constructor
36    return obj
37
38class SLDCalFunc(CSLDCalFunc, BaseComponent):
39    """
40    Class that evaluates a SLDCalFunc model.
41    This file was auto-generated from src\sans\models\include\sld_cal.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    * fun_type        = 0.0
48    * npts_inter      = 21.0
49    * shell_num       = 0.0
50    * nu_inter        = 2.5
51    * sld_left        = 0.0 [1/A^(2)]
52    * sld_right       = 0.0 [1/A^(2)]
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(CSLDCalFunc.__init__, (self,))
63
64        CSLDCalFunc.__init__(self)
65        self.is_multifunc = False
66                       
67        ## Name of the model
68        self.name = "SLDCalFunc"
69        ## Model description
70        self.description = """
71        To calculate sld values
72        """
73       
74        ## Parameter details [units, min, max]
75        self.details = {}
76        self.details['fun_type'] = ['', None, None]
77        self.details['npts_inter'] = ['', None, None]
78        self.details['shell_num'] = ['', None, None]
79        self.details['nu_inter'] = ['', None, None]
80        self.details['sld_left'] = ['[1/A^(2)]', None, None]
81        self.details['sld_right'] = ['[1/A^(2)]', None, None]
82
83        ## fittable parameters
84        self.fixed = ['</text>']
85       
86        ## non-fittable parameters
87        self.non_fittable = []
88       
89        ## parameters with orientation
90        self.orientation_params = []
91
92        ## parameters with magnetism
93        self.magnetic_params = []
94
95        self.category = None
96        self.multiplicity_info = None
97       
98    def __setstate__(self, state):
99        """
100        restore the state of a model from pickle
101        """
102        self.__dict__, self.params, self.dispersion = state
103       
104    def __reduce_ex__(self, proto):
105        """
106        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
107        c model.
108        """
109        state = (self.__dict__, self.params, self.dispersion)
110        return (create_SLDCalFunc, tuple(), state, None, None)
111       
112    def clone(self):
113        """ Return a identical copy of self """
114        return self._clone(SLDCalFunc())   
115       
116    def run(self, x=0.0):
117        """
118        Evaluate the model
119       
120        :param x: input q, or [q,phi]
121       
122        :return: scattering function P(q)
123       
124        """
125        return CSLDCalFunc.run(self, x)
126   
127    def runXY(self, x=0.0):
128        """
129        Evaluate the model in cartesian coordinates
130       
131        :param x: input q, or [qx, qy]
132       
133        :return: scattering function P(q)
134       
135        """
136        return CSLDCalFunc.runXY(self, x)
137       
138    def evalDistribution(self, x):
139        """
140        Evaluate the model in cartesian coordinates
141       
142        :param x: input q[], or [qx[], qy[]]
143       
144        :return: scattering function P(q[])
145       
146        """
147        return CSLDCalFunc.evalDistribution(self, x)
148       
149    def calculate_ER(self):
150        """
151        Calculate the effective radius for P(q)*S(q)
152       
153        :return: the value of the effective radius
154       
155        """       
156        return CSLDCalFunc.calculate_ER(self)
157       
158    def calculate_VR(self):
159        """
160        Calculate the volf ratio for P(q)*S(q)
161       
162        :return: the value of the volf ratio
163       
164        """       
165        return CSLDCalFunc.calculate_VR(self)
166             
167    def set_dispersion(self, parameter, dispersion):
168        """
169        Set the dispersion object for a model parameter
170       
171        :param parameter: name of the parameter [string]
172        :param dispersion: dispersion object of type DispersionModel
173       
174        """
175        return CSLDCalFunc.set_dispersion(self,
176               parameter, dispersion.cdisp)
177       
178   
179# End of file
180
Note: See TracBrowser for help on using the repository browser.