Changeset 79ac6f8 in sasview for sansmodels/src/sans/models/AddComponent.py
- Timestamp:
- Jun 4, 2010 5:04:49 PM (14 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:
- 5062bbf
- Parents:
- 7116b6e0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/AddComponent.py
r3db3895 r79ac6f8 1 1 #!/usr/bin/env python 2 """ Provide base functionality for all model components 3 @author: Mathieu Doucet / UTK 4 @contact: mathieu.doucet@nist.gov 2 3 """ 4 Provide base functionality for all model components 5 6 :author: Mathieu Doucet / UTK 7 8 :contact: mathieu.doucet@nist.gov 9 5 10 """ 6 11 … … 13 18 14 19 class AddComponent(BaseComponent): 15 """ Basic model component for Addition 16 Provides basic arithmetics 20 """ 21 Basic model component for Addition 22 Provides basic arithmetics 17 23 """ 18 24 19 25 def __init__(self, base=None, other=None): 20 26 """ 21 @param base: component to add to 22 @param other: component to add 27 :param base: component to add to 28 :param other: component to add 29 23 30 """ 24 31 BaseComponent.__init__(self) … … 32 39 def run(self, x=0): 33 40 """ 34 Evaluate each part of the component and sum the results 35 @param x: input parameter 36 @return: value of the model at x 41 Evaluate each part of the component and sum the results 42 43 :param x: input parameter 44 45 :return: value of the model at x 46 37 47 """ 38 48 return self.operateOn.run(x) + self.other.run(x) … … 40 50 def runXY(self, x=0): 41 51 """ 42 Evaluate each part of the component and sum the results 43 @param x: input parameter 44 @return: value of the model at x 52 Evaluate each part of the component and sum the results 53 54 :param x: input parameter 55 56 :return: value of the model at x 57 45 58 """ 46 59 return self.operateOn.runXY(x) + self.other.runXY(x) … … 48 61 def setParam(self, name, value): 49 62 """ 50 Set the value of a model parameter 51 @param name: name of parameter to set 52 @param value: value to give the paramter 63 Set the value of a model parameter 64 65 :param name: name of parameter to set 66 :param value: value to give the paramter 67 53 68 """ 54 69 return BaseComponent.setParamWithToken(self, name, … … 57 72 def getParam(self, name): 58 73 """ 59 Set the value of a model parameter 60 @param name: name of the parameter 61 @return: value of the parameter 74 Set the value of a model parameter 75 76 :param name: name of the parameter 77 78 :return: value of the parameter 79 62 80 """ 63 81 return BaseComponent.getParamWithToken(self, name, 'add', self.other) 64 82 65 83 def getParamList(self): 66 """ Return a list of all available parameters for the model 84 """ 85 Return a list of all available parameters for the model 67 86 """ 68 87 return BaseComponent.getParamListWithToken(self, 'add', self.other)
Note: See TracChangeset
for help on using the changeset viewer.