Changeset 1d78e4b in sasview for sansmodels/src/sans
- Timestamp:
- Jan 19, 2011 6:00:50 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:
- a0da535
- Parents:
- 12c5b87
- Location:
- sansmodels/src/sans/models/c_models
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/dispersion_visitor.cpp
reba9885 r1d78e4b 27 27 PyDict_SetItemString(dict, "npts", Py_BuildValue("i", disp->npts)); 28 28 PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width)); 29 PyDict_SetItemString(dict, "nsigmas", Py_BuildValue(" i", disp->nsigmas));29 PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas)); 30 30 #endif 31 31 } … … 39 39 PyDict_SetItemString(dict, "npts", Py_BuildValue("i", disp->npts)); 40 40 PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width)); 41 PyDict_SetItemString(dict, "nsigmas", Py_BuildValue(" i", disp->nsigmas));41 PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas)); 42 42 #endif 43 43 } … … 52 52 PyDict_SetItemString(dict, "npts", Py_BuildValue("i", disp->npts)); 53 53 PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width)); 54 PyDict_SetItemString(dict, "nsigmas", Py_BuildValue(" i", disp->nsigmas));54 PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas)); 55 55 #endif 56 56 } -
sansmodels/src/sans/models/c_models/parameters.cpp
r0fff338f r1d78e4b 63 63 } else { 64 64 for(int i=0; i<npts; i++) { 65 double val = value + width * (1.0* i/float(npts-1) - 0.5);65 double val = value + width * (1.0*double(i)/double(npts-1) - 0.5); 66 66 67 67 if ( ((*par).has_min==false || val>(*par).min) … … 85 85 npts = 21; 86 86 width = 0.0; 87 nsigmas = 3 ;87 nsigmas = 3.0; 88 88 }; 89 89 … … 115 115 width = 0.0; 116 116 npts = 1; 117 nsigmas = 3 ;117 nsigmas = 3.0; 118 118 } 119 119 … … 126 126 for(int i=0; i<npts; i++) { 127 127 // We cover n(nsigmas) times sigmas on each side of the mean 128 double val = value + width * (2.0*nsigmas*i/float(npts-1) - nsigmas); 129 128 double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 130 129 if ( ((*par).has_min==false || val>(*par).min) 131 130 && ((*par).has_max==false || val<(*par).max) ) { … … 145 144 npts = 21; 146 145 width = 0.0; 147 nsigmas = 3 ;146 nsigmas = 3.0; 148 147 }; 149 148 … … 157 156 double lognormal_weight(double mean, double sigma, double x) { 158 157 159 double sigma2 = pow(sigma, 2 );160 return 1 /(x*sigma2) * exp( -pow((log(x) -mean), 2) / (2*sigma2));158 double sigma2 = pow(sigma, 2.0); 159 return 1.0/(x*sigma2) * exp( -pow((log(x) -mean), 2.0) / (2.0*sigma2)); 161 160 162 161 } … … 174 173 width = 0.0; 175 174 npts = 1; 176 nsigmas = 3 ;175 nsigmas = 3.0; 177 176 } 178 177 … … 185 184 for(int i=0; i<npts; i++) { 186 185 // We cover n(nsigmas) times sigmas on each side of the mean 187 double val = value + width * (2.0*nsigmas* i/float(npts-1) - nsigmas);186 double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 188 187 189 188 if ( ((*par).has_min==false || val>(*par).min) … … 205 204 npts = 21; 206 205 width = 0.0; 207 nsigmas = 3 ;206 nsigmas = 3.0; 208 207 }; 209 208 … … 217 216 double schulz_weight(double mean, double sigma, double x) { 218 217 double vary, expo_value; 219 double z = pow(mean/ sigma, 2 )-1;218 double z = pow(mean/ sigma, 2.0)-1.0; 220 219 double R= x/mean; 221 double zz= z+1 ;220 double zz= z+1.0; 222 221 double expo; 223 222 expo = zz*log(zz)+z*log(R)-R*zz-log(mean)-lgamma(zz); … … 237 236 width = 0.0; 238 237 npts = 1; 239 nsigmas = 3 ;238 nsigmas = 3.0; 240 239 } 241 240 … … 248 247 for(int i=0; i<npts; i++) { 249 248 // We cover n(nsigmas) times sigmas on each side of the mean 250 double val = value + width * (2.0*nsigmas* i/float(npts-1) - nsigmas);249 double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 251 250 252 251 if ( ((*par).has_min==false || val>(*par).min) -
sansmodels/src/sans/models/c_models/parameters.hh
reba9885 r1d78e4b 68 68 public: 69 69 /// Number of sigmas on each side of the mean 70 intnsigmas;70 double nsigmas; 71 71 72 72 GaussianDispersion(); … … 82 82 public: 83 83 /// Number of sigmas on each side of the mean 84 intnsigmas;84 double nsigmas; 85 85 86 86 SchulzDispersion(); … … 96 96 public: 97 97 /// Number of sigmas on each side of the mean 98 intnsigmas;98 double nsigmas; 99 99 100 100 LogNormalDispersion();
Note: See TracChangeset
for help on using the changeset viewer.