Changeset c93122e in sasview for src/sas/models/c_extension
- Timestamp:
- Mar 2, 2015 3:46:50 PM (10 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 6bd3a8d1
- Parents:
- e3f77d8b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/models/c_extension/python_wrapper/modelTemplate.txt
r8836849 rc93122e 13 13 ############################################################################## 14 14 15 """ 15 """ 16 16 Provide functionality for a C extension model 17 17 … … 38 38 39 39 class [PYTHONCLASS]([CPYTHONCLASS], BaseComponent): 40 """ 41 Class that evaluates a [PYTHONCLASS] model. 40 """ 41 Class that evaluates a [PYTHONCLASS] model. 42 42 This file was auto-generated from [INCLUDE_FILE]. 43 43 Refer to that file and the structure it contains … … 45 45 [DEFAULT_LIST] 46 46 """ 47 47 48 48 def __init__(self, multfactor=1): 49 49 """ Initialization """ 50 50 self.__dict__ = {} 51 51 52 52 # Initialize BaseComponent first, then sphere 53 53 BaseComponent.__init__(self) … … 55 55 56 56 [CALL_CPYTHON_INIT] 57 57 58 58 ## Name of the model 59 59 self.name = "[PYTHONCLASS]" … … 62 62 [DESCRIPTION] 63 63 """ 64 64 65 65 [PAR_DETAILS] 66 66 ## fittable parameters 67 67 self.fixed = [FIXED] 68 68 69 69 ## non-fittable parameters 70 70 self.non_fittable = [NON_FITTABLE_PARAMS] 71 71 72 72 ## parameters with orientation 73 73 self.orientation_params = [ORIENTATION_PARAMS] … … 78 78 self.category = [CATEGORY] 79 79 self.multiplicity_info = [MULTIPLICITY_INFO] 80 80 81 81 def __setstate__(self, state): 82 82 """ … … 84 84 """ 85 85 self.__dict__, self.params, self.dispersion = state 86 86 87 87 def __reduce_ex__(self, proto): 88 88 """ 89 Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of 89 Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of 90 90 c model. 91 91 """ 92 92 state = (self.__dict__, self.params, self.dispersion) 93 93 return (create_[PYTHONCLASS], tuple(), state, None, None) 94 94 95 95 def clone(self): 96 96 """ Return a identical copy of self """ 97 return self._clone([PYTHONCLASS]()) 98 97 return self._clone([PYTHONCLASS]()) 98 99 99 def run(self, x=0.0): 100 """ 100 """ 101 101 Evaluate the model 102 103 102 :param x: input q, or [q,phi] 104 105 103 :return: scattering function P(q) 106 107 104 """ 108 105 return [CPYTHONCLASS].run(self, x) 109 106 110 107 def runXY(self, x=0.0): 111 """ 108 """ 112 109 Evaluate the model in cartesian coordinates 113 114 110 :param x: input q, or [qx, qy] 115 116 111 :return: scattering function P(q) 117 118 112 """ 119 113 return [CPYTHONCLASS].runXY(self, x) 120 114 121 115 def evalDistribution(self, x): 122 """ 116 """ 123 117 Evaluate the model in cartesian coordinates 124 125 118 :param x: input q[], or [qx[], qy[]] 126 127 119 :return: scattering function P(q[]) 128 129 120 """ 130 121 return [CPYTHONCLASS].evalDistribution(self, x) 131 122 132 123 def calculate_ER(self): 133 """ 124 """ 134 125 Calculate the effective radius for P(q)*S(q) 135 136 126 :return: the value of the effective radius 137 138 """ 127 """ 139 128 return [CPYTHONCLASS].calculate_ER(self) 140 129 141 130 def calculate_VR(self): 142 """ 131 """ 143 132 Calculate the volf ratio for P(q)*S(q) 144 145 133 :return: the value of the volf ratio 146 147 """ 134 """ 148 135 return [CPYTHONCLASS].calculate_VR(self) 149 136 150 137 def set_dispersion(self, parameter, dispersion): 151 138 """ 152 139 Set the dispersion object for a model parameter 153 154 140 :param parameter: name of the parameter [string] 155 141 :param dispersion: dispersion object of type DispersionModel 156 157 142 """ 158 143 return [CPYTHONCLASS].set_dispersion(self, 159 144 parameter, dispersion.cdisp) 160 161 145 162 146 # End of file
Note: See TracChangeset
for help on using the changeset viewer.