Changeset 59b9b675 in sasview for sansmodels/src/sans/models/c_models
- Timestamp:
- Feb 25, 2011 9:20:10 AM (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:
- 01b6bd0
- Parents:
- ea5692d
- Location:
- sansmodels/src/sans/models/c_models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/c_models.cpp
r770bab1 r59b9b675 290 290 addCMultiShellModel(m); 291 291 addCBinaryHSModel(m); 292 //addDisperser(m);293 //addCGaussian(m);294 //addCSchulz(m);295 //addCLogNormal(m);296 //addCLorentzian(m);292 addDisperser(m); 293 addCGaussian(m); 294 addCSchulz(m); 295 addCLogNormal(m); 296 addCLorentzian(m); 297 297 addCVesicleModel(m); 298 298 addCPoly_GaussCoil(m); -
sansmodels/src/sans/models/c_models/parameters.cpp
r8dc02d8b r59b9b675 58 58 Parameter* par = (Parameter*)param; 59 59 double value = (*par)(); 60 61 if (npts<2) { 62 weights.insert(weights.end(), WeightPoint(value, 1.0)); 63 } else { 64 for(int i=0; i<npts; i++) { 65 double val = value + width * (1.0*double(i)/double(npts-1) - 0.5); 66 60 double sig; 61 if (npts<2) { 62 weights.insert(weights.end(), WeightPoint(value, 1.0)); 63 } else { 64 for(int i=0; i<npts; i++) { 65 66 if ((*par).has_min==false){ 67 // width = sigma for angles 68 sig = width; 69 } 70 else{ 71 //width = polydispersity (=sigma/value) for length 72 sig = width * value; 73 } 74 double val = value + sig * (1.0*double(i)/double(npts-1) - 0.5); 67 75 if ( ((*par).has_min==false || val>(*par).min) 68 76 && ((*par).has_max==false || val<(*par).max) ) … … 83 91 84 92 GaussianDispersion :: GaussianDispersion() { 85 npts = 21;93 npts = 11; 86 94 width = 0.0; 87 nsigmas = 3.0;95 nsigmas = 2.5; 88 96 }; 89 97 … … 115 123 width = 0.0; 116 124 npts = 1; 117 nsigmas = 3.0; 118 } 119 120 Parameter* par = (Parameter*)param; 121 double value = (*par)(); 122 123 if (npts<2) { 124 weights.insert(weights.end(), WeightPoint(value, 1.0)); 125 } else { 126 for(int i=0; i<npts; i++) { 125 nsigmas = 2.5; 126 } 127 128 Parameter* par = (Parameter*)param; 129 double value = (*par)(); 130 double sig; 131 if (npts<2) { 132 weights.insert(weights.end(), WeightPoint(value, 1.0)); 133 } else { 134 for(int i=0; i<npts; i++) { 135 if ((*par).has_min==false){ 136 // width = sigma for angles 137 sig = width; 138 } 139 else{ 140 //width = polydispersity (=sigma/value) for length 141 sig = width * value; 142 } 127 143 // We cover n(nsigmas) times sigmas on each side of the mean 128 double val = value + width* (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);144 double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 129 145 if ( ((*par).has_min==false || val>(*par).min) 130 146 && ((*par).has_max==false || val<(*par).max) ) { 131 double _w = gaussian_weight(value, width, val);147 double _w = gaussian_weight(value, sig, val); 132 148 weights.insert(weights.end(), WeightPoint(val, _w)); 133 149 } … … 142 158 143 159 RectangleDispersion :: RectangleDispersion() { 144 npts = 21;160 npts = 11; 145 161 width = 0.0; 146 162 nsigmas = 1.0; … … 182 198 Parameter* par = (Parameter*)param; 183 199 double value = (*par)(); 184 185 if (npts<2) { 186 weights.insert(weights.end(), WeightPoint(value, 1.0)); 187 } else { 188 for(int i=0; i<npts; i++) { 200 double sig; 201 if (npts<2) { 202 weights.insert(weights.end(), WeightPoint(value, 1.0)); 203 } else { 204 for(int i=0; i<npts; i++) { 205 if ((*par).has_min==false){ 206 // width = sigma for angles 207 sig = width; 208 } 209 else{ 210 //width = polydispersity (=sigma/value) for length 211 sig = width * value; 212 } 189 213 // We cover n(nsigmas) times sigmas on each side of the mean 190 double val = value + width* (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);214 double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 191 215 if ( ((*par).has_min==false || val>(*par).min) 192 216 && ((*par).has_max==false || val<(*par).max) ) { 193 double _w = rectangle_weight(value, width, val);217 double _w = rectangle_weight(value, sig, val); 194 218 weights.insert(weights.end(), WeightPoint(val, _w)); 195 219 } … … 204 228 205 229 LogNormalDispersion :: LogNormalDispersion() { 206 npts = 21;230 npts = 11; 207 231 width = 0.0; 208 232 nsigmas = 3.0; … … 240 264 Parameter* par = (Parameter*)param; 241 265 double value = (*par)(); 242 243 if (npts<2) { 244 weights.insert(weights.end(), WeightPoint(value, 1.0)); 245 } else { 246 for(int i=0; i<npts; i++) { 266 double sig; 267 if (npts<2) { 268 weights.insert(weights.end(), WeightPoint(value, 1.0)); 269 } else { 270 for(int i=0; i<npts; i++) { 271 if ((*par).has_min==false){ 272 // width = sigma for angles 273 sig = width; 274 } 275 else{ 276 //width = polydispersity (=sigma/value) for length 277 sig = width * value; 278 } 247 279 // We cover n(nsigmas) times sigmas on each side of the mean 248 double val = value + width* (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);280 double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 249 281 250 282 if ( ((*par).has_min==false || val>(*par).min) 251 283 && ((*par).has_max==false || val<(*par).max) ) { 252 double _w = lognormal_weight(value, width, val);284 double _w = lognormal_weight(value, sig, val); 253 285 weights.insert(weights.end(), WeightPoint(val, _w)); 254 286 } … … 264 296 265 297 SchulzDispersion :: SchulzDispersion() { 266 npts = 21;298 npts = 11; 267 299 width = 0.0; 268 300 nsigmas = 3.0; … … 303 335 Parameter* par = (Parameter*)param; 304 336 double value = (*par)(); 305 306 if (npts<2) { 307 weights.insert(weights.end(), WeightPoint(value, 1.0)); 308 } else { 309 for(int i=0; i<npts; i++) { 337 double sig; 338 if (npts<2) { 339 weights.insert(weights.end(), WeightPoint(value, 1.0)); 340 } else { 341 for(int i=0; i<npts; i++) { 342 if ((*par).has_min==false){ 343 // width = sigma for angles 344 sig = width; 345 } 346 else{ 347 //width = polydispersity (=sigma/value) for length 348 sig = width * value; 349 } 310 350 // We cover n(nsigmas) times sigmas on each side of the mean 311 double val = value + width* (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);351 double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 312 352 313 353 if ( ((*par).has_min==false || val>(*par).min) 314 354 && ((*par).has_max==false || val<(*par).max) ) { 315 double _w = schulz_weight(value, width, val);355 double _w = schulz_weight(value, sig, val); 316 356 weights.insert(weights.end(), WeightPoint(val, _w)); 317 357 } … … 346 386 for(int i=0; i<npts; i++) { 347 387 double val = _values[i]; //+ value; //ToDo: Talk to Paul and put back the 'value'. 388 348 389 if ( ((*par).has_min==false || val>(*par).min) 349 390 && ((*par).has_max==false || val<(*par).max) )
Note: See TracChangeset
for help on using the changeset viewer.