Changeset 8b677ec in sasview for sansmodels/src/sans
- Timestamp:
- Sep 8, 2009 11:02:19 AM (15 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:
- 4785dec
- Parents:
- ec38f27
- Location:
- sansmodels/src/sans/models
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/MultiplicationModel.py
r59930f3 r8b677ec 6 6 class MultiplicationModel(BaseComponent): 7 7 """ 8 Use for P(Q)*S(Q); function call m aut be in order of P(Q) and then S(Q).9 Perform mult plication of two models.8 Use for P(Q)*S(Q); function call must be in order of P(Q) and then S(Q). 9 Perform multiplication of two models. 10 10 Contains the models parameters combined. 11 11 """ … … 16 16 ## Setting model name model description 17 17 self.description="" 18 if model1.name != "NoStructure" and model2.name != "NoStructure":18 if model1.name != "NoStructure" and model2.name != "NoStructure": 19 19 self.name = model1.name +" * "+ model2.name 20 20 self.description= self.name+"\n" 21 self.description +="see %s description and %s description"%( model1.name, 22 model2.name ) 21 self.fill_description(model1, model2) 23 22 elif model2.name != "NoStructure": 24 23 self.name = model2.name … … 47 46 for item in self.model2.orientation_params: 48 47 if not item in self.orientation_params: 49 if item != 'effect_radius': 50 self.orientation_params.append(item) 48 self.orientation_params.append(item) 51 49 52 50 … … 74 72 75 73 for name , value in self.model2.dispersion.iteritems(): 76 # S(Q) has only 'radius' for dispersion. 74 ## All S(Q) has only 'effect_radius' for dispersion which 75 # will not be allowed for now. 77 76 if not name in self.dispersion.keys(): 78 77 if name != 'effect_radius': … … 93 92 for name , value in self.model2.params.iteritems(): 94 93 if not name in self.params.keys(): 94 #effect_radius is not treated as a parameter anymore. 95 95 if name != 'effect_radius': 96 96 self.params[name]= value … … 105 105 106 106 for name , detail in self.model2.details.iteritems(): 107 if not name in self.details.keys()and name != 'effect_radius': #???? 108 self.details[name]= detail 107 if not name in self.details.keys(): 108 if name != 'effect_radius': 109 self.details[name]= detail 109 110 110 111 def setParam(self, name, value): … … 155 156 for item in self.model1.fixed: 156 157 self.fixed.append(item) 157 158 for item in self.model2.fixed: 159 if not item in self.fixed: 160 self.fixed.append(item) 158 #S(Q) should not have fixed items for P*S for now. 159 #for item in self.model2.fixed: 160 # if not item in self.fixed: 161 # self.fixed.append(item) 162 161 163 self.fixed.sort() 162 164 … … 180 182 @return: DAB value 181 183 """ 184 182 185 #Reset radius of model2 just before the run 183 186 effective_radius = None … … 200 203 #There is no dispersion for the structure factors(S(Q)). 201 204 #ToDo: need to decide whether or not the dispersion for S(Q) has to be considered for P*S. 202 elif parameter in self.model2.dispersion.keys():203 if item != 'effect_radius':204 value= self.model2.set_dispersion(parameter, dispersion)205 #elif parameter in self.model2.dispersion.keys(): 206 # if item != 'effect_radius': 207 # value= self.model2.set_dispersion(parameter, dispersion) 205 208 self._set_dispersion() 206 209 return value … … 208 211 raise 209 212 210 211 213 def fill_description(self, model1, model2): 214 """ 215 Fill the description for P(Q)*S(Q) 216 """ 217 description = "" 218 description += "Note:1) The effect_radius (effective radius) of %s \n"% (model2.name) 219 description +=" is automatically calculated from size parameters (radius...).\n" 220 description += " 2) For non-spherical shape, this approximation is valid \n" 221 description += " only for highly dilute systems. Thus, use it at your own risk.\n" 222 description +="See %s description and %s description \n"%( model1.name,model2.name ) 223 description += " for details." 224 self.description += description 225 -
sansmodels/src/sans/models/c_extensions/HayterMSA.c
r42ae1d9 r8b677ec 15 15 * @return: function value 16 16 */ 17 17 18 double HayterMSA_analytical_1D(HayterMSAParameters *pars, double q) { 18 19 double dp[6]; 19 20 //Hayer takes diameter. 20 dp[0] = 2.0 *pars->effect_radius;21 dp[0] = 2.0 * pars->effect_radius; 21 22 dp[1] = pars->charge; 22 dp[ 1] = pars->volfraction;23 dp[2] = pars->volfraction; 23 24 dp[3] = pars->temperature; 24 25 dp[4] = pars->saltconc; -
sansmodels/src/sans/models/c_extensions/HayterMSA.h
r5eb9154 r8b677ec 50 50 } HayterMSAParameters; 51 51 52 53 54 52 /// 1D scattering function 55 53 double HayterMSA_analytical_1D(HayterMSAParameters *pars, double q); -
sansmodels/src/sans/models/c_models/HayterMSA.cpp
r42ae1d9 r8b677ec 91 91 HayterMSAParameters dp; 92 92 // Fill parameter array 93 dp.effect_radius = 2.0*effect_radius();93 dp.effect_radius = effect_radius(); 94 94 dp.charge = charge(); 95 95 dp.volfraction = volfraction(); … … 108 108 // Loop over radius weight points 109 109 for(int i=0; i<weights_rad.size(); i++) { 110 dp.effect_radius = 2.0*weights_rad[i].value;110 dp.effect_radius = weights_rad[i].value; 111 111 112 113 114 112 double _ptvalue = weights_rad[i].weight 113 * HayterMSA_analytical_2DXY(&dp, qx, qy); 114 sum += _ptvalue; 115 115 116 116 norm += weights_rad[i].weight; 117 117 } 118 118 // Averaging in theta needs an extra normalization
Note: See TracChangeset
for help on using the changeset viewer.