source: sasview/src/sans/models/c_extension/python_wrapper/modelTemplate.txt @ 6b20c4e

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 6b20c4e was 51f14603, checked in by Peter Parker, 11 years ago

Refs #202 - Fix Sphinx build errors (not including park-1.2.1/). Most warnings remain.

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