Changeset 3740b11 in sasview
- Timestamp:
- Apr 10, 2009 7:32:51 PM (16 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:
- 249bae9
- Parents:
- 24276b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/MultiplicationModel.py
r24415e9 r3740b11 3 3 import numpy, math 4 4 import copy 5 from sans.models.pluginmodel import Model1DPlugin 6 from sans.models.DiamCylFunc import DiamCylFunc 7 from sans.models.DiamEllipFunc import DiamEllipFunc 5 8 class MultiplicationModel(BaseComponent): 6 9 """ … … 26 29 self.name = model1.name 27 30 self.description= model1.description 28 29 31 32 #For virial coefficients for only two P(Q) models,"CylinderModel","EllipsoidModel". SphereModel works w/o it. 33 modelDiam = None 34 if model1.__class__.__name__ == "CylinderModel": 35 Model1DPlugin("DiamCylFunc") 36 modelDiam = DiamCylFunc() 37 para1 = 'radius' 38 para2 = 'length' 39 40 elif model1.__class__.__name__ == "EllipsoidModel": 41 Model1DPlugin("DiamEllipFunc") 42 modelDiam = DiamEllipFunc() 43 para1 = 'radius_a' 44 para2 = 'radius_b' 45 46 self.modelD = modelDiam 47 48 if model1.__class__.__name__ == "CylinderModel" \ 49 or model1.__class__.__name__ == "EllipsoidModel": 50 51 self.para1 = para1 52 self.para2 = para2 53 30 54 31 55 self.model1= model1 32 56 self.model2= model2 57 58 #if modelDiam != None: 59 #self.model2.params["radius"]= DiamEllipFunc() 60 61 #print "self.modelD",self.modelD.params,self.model1.params,self.model2.params 62 33 63 ## dispersion 34 64 self._set_dispersion() … … 63 93 64 94 for name , value in self.model2.dispersion.iteritems(): 65 if not name in self.dispersion.keys() :95 if not name in self.dispersion.keys()and name !='radius': 66 96 self.dispersion[name]= value 97 98 67 99 68 100 … … 72 104 this model parameters 73 105 """ 106 74 107 for name , value in self.model1.params.iteritems(): 75 108 self.params[name]= value 76 if name in self.model2.getParamList(): 109 110 if self.modelD !=None: 111 if name == self.para1 or name == self.para2: 112 self.modelD.params[name]= value 113 elif name in self.model2.getParamList() and name !='radius': 114 self.model2.setParam( name, value) 115 116 elif name in self.model2.getParamList(): 77 117 self.model2.setParam(name, value) 118 if self.modelD !=None: 119 self.model2.setParam('radius', self.modelD.run()) 78 120 79 121 for name , value in self.model2.params.iteritems(): 80 if not name in self.params.keys() :122 if not name in self.params.keys()and name != 'radius': 81 123 self.params[name]= value 82 124 … … 90 132 91 133 for name , detail in self.model2.details.iteritems(): 92 if not name in self.details.keys() :134 if not name in self.details.keys()and name != 'radius': 93 135 self.details[name]= detail 94 136 … … 100 142 @param value: value of the parameter 101 143 """ 102 144 145 self._setParamHelper( name, value) 146 103 147 if name in self.model1.getParamList(): 104 148 self.model1.setParam( name, value) 105 106 if name in self.model2.getParamList(): 149 150 151 if self.modelD !=None: 152 if name == self.para1 or name == self.para2: 153 self.modelD.params[name]= value 154 elif name in self.model2.getParamList() and name != 'radius': 155 self.model2.setParam( name, value) 156 elif name in self.model2.getParamList()and name != 'radius': 107 157 self.model2.setParam( name, value) 158 108 159 109 160 self._setParamHelper( name, value) … … 153 204 @return: (DAB value) 154 205 """ 155 156 return self.model1.run(x)* self.model2.run(x) 206 #MultiplicationModel(self.model1, self.model2 ) 207 208 if self.modelD!=None: 209 value = self.modelD.run(x) 210 self.model2.setParam( "radius", value) 211 212 print "self.model2.setParam( radius, value)",value 213 return self.model1.run(x)*self.model2.run(x) 157 214 158 215 def runXY(self, x = 0.0):
Note: See TracChangeset
for help on using the changeset viewer.