Changeset 2cc633b in sasview
- Timestamp:
- Aug 3, 2009 7:44:15 PM (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:
- 42f193a
- Parents:
- 0f3fefe
- Location:
- sansmodels/src/sans/models
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/MultiShellModel.py
r2c4b289 r2cc633b 53 53 self.name = "MultiShellModel" 54 54 ## Model description 55 self.description =""" 56 Model parameters: 55 self.description ="""Model parameters: 57 56 scale : scale factor 58 57 core_radius : Core radius of the multishell … … 76 75 77 76 ## fittable parameters 78 self.fixed=[' radius.width']77 self.fixed=['core_radius.width', 's_thickness.width', 'w_thickness.width'] 79 78 80 79 ## parameters with orientation -
sansmodels/src/sans/models/c_extensions/multishell.h
r3d25331f r2cc633b 6 6 7 7 [PYTHONCLASS] = MultiShellModel 8 [DISP_PARAMS] = core_radius 9 [DESCRIPTION] =<text> 10 Model parameters: 11 scale : scale factor 12 core_radius : Core radius of the multishell 13 s_thickness: shell thickness 14 w_thickness: water thickness 15 core_sld: core scattering length density 16 shell_sld: shell scattering length density 17 n_pairs:number of pairs of water/shell 18 background: incoherent background 8 [DISP_PARAMS] = core_radius, s_thickness, w_thickness 9 [DESCRIPTION] =<text>Model parameters: 10 scale : scale factor 11 core_radius : Core radius of the multishell 12 s_thickness: shell thickness 13 w_thickness: water thickness 14 core_sld: core scattering length density 15 shell_sld: shell scattering length density 16 n_pairs:number of pairs of water/shell 17 background: incoherent background 19 18 </text> 20 [FIXED]= core_radius.width 19 [FIXED]= core_radius.width; s_thickness.width; w_thickness.width 21 20 [ORIENTATION_PARAMS]= <text> </text> 22 21 */ -
sansmodels/src/sans/models/c_models/CMultiShellModel.cpp
r3d25331f r2cc633b 97 97 self->model->core_radius.dispersion->accept_as_source(visitor, self->model->core_radius.dispersion, disp_dict); 98 98 PyDict_SetItemString(self->dispersion, "core_radius", disp_dict); 99 disp_dict = PyDict_New(); 100 self->model->s_thickness.dispersion->accept_as_source(visitor, self->model->s_thickness.dispersion, disp_dict); 101 PyDict_SetItemString(self->dispersion, "s_thickness", disp_dict); 102 disp_dict = PyDict_New(); 103 self->model->w_thickness.dispersion->accept_as_source(visitor, self->model->w_thickness.dispersion, disp_dict); 104 PyDict_SetItemString(self->dispersion, "w_thickness", disp_dict); 99 105 100 106 … … 162 168 disp_dict = PyDict_GetItemString(self->dispersion, "core_radius"); 163 169 self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict); 170 disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness"); 171 self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict); 172 disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness"); 173 self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict); 164 174 165 175 … … 226 236 disp_dict = PyDict_GetItemString(self->dispersion, "core_radius"); 227 237 self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict); 238 disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness"); 239 self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict); 240 disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness"); 241 self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict); 228 242 229 243 … … 283 297 if (!strcmp(par_name, "core_radius")) { 284 298 self->model->core_radius.dispersion = dispersion; 299 } else if (!strcmp(par_name, "s_thickness")) { 300 self->model->s_thickness.dispersion = dispersion; 301 } else if (!strcmp(par_name, "w_thickness")) { 302 self->model->w_thickness.dispersion = dispersion; 285 303 } else { 286 304 PyErr_SetString(CMultiShellModelError, -
sansmodels/src/sans/models/c_models/flexiblecylinder.cpp
re6fa43e r2cc633b 52 52 */ 53 53 double FlexibleCylinderModel :: operator()(double q) { 54 double dp[ 5];54 double dp[6]; 55 55 56 56 // Fill parameter array for IGOR library … … 64 64 65 65 // Get the dispersion points for the length 66 vector<WeightPoint> weights_len gth;67 length.get_weights(weights_len gth);66 vector<WeightPoint> weights_len; 67 length.get_weights(weights_len); 68 68 69 69 // Get the dispersion points for the kuhn_length 70 vector<WeightPoint> weights_kuhn _length;71 kuhn_length.get_weights(weights_kuhn _length);70 vector<WeightPoint> weights_kuhn; 71 kuhn_length.get_weights(weights_kuhn); 72 72 73 73 // Get the dispersion points for the radius 74 vector<WeightPoint> weights_rad ius;75 radius.get_weights(weights_rad ius);74 vector<WeightPoint> weights_rad; 75 radius.get_weights(weights_rad); 76 76 77 77 // Perform the computation, with all weight points … … 80 80 81 81 // Loop over semi axis A weight points 82 for(int i=0; i< (int)weights_len gth.size(); i++) {83 dp[1] = weights_len gth[i].value;82 for(int i=0; i< (int)weights_len.size(); i++) { 83 dp[1] = weights_len[i].value; 84 84 85 85 // Loop over semi axis B weight points 86 for(int j=0; j< (int)weights_kuhn _length.size(); j++) {87 dp[2] = weights_kuhn _length[j].value;86 for(int j=0; j< (int)weights_kuhn.size(); j++) { 87 dp[2] = weights_kuhn[j].value; 88 88 89 89 // Loop over semi axis C weight points 90 for(int k=0; k< (int)weights_rad ius.size(); k++) {91 dp[3] = weights_rad ius[k].value;90 for(int k=0; k< (int)weights_rad.size(); k++) { 91 dp[3] = weights_rad[k].value; 92 92 93 sum += weights_length[i].weight 94 * weights_kuhn_length[j].weight * weights_radius[k].weight * FlexExclVolCyl(dp, q); 95 norm += weights_length[i].weight 96 * weights_kuhn_length[j]*weights_radius[k].weight; 93 sum += weights_len[i].weight 94 * weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q); 95 norm += weights_len[i].weight 96 * weights_kuhn[j].weight*weights_rad[k].weight; 97 } 97 98 } 98 99 } -
sansmodels/src/sans/models/c_models/multishell.cpp
r3d25331f r2cc633b 66 66 core_radius.get_weights(weights_core_radius); 67 67 68 // Get the dispersion points for the s_thickness 69 vector<WeightPoint> weights_s_thickness; 70 s_thickness.get_weights(weights_s_thickness); 71 72 // Get the dispersion points for the w_thickness 73 vector<WeightPoint> weights_w_thickness; 74 w_thickness.get_weights(weights_w_thickness); 75 68 76 // Perform the computation, with all weight points 69 77 double sum = 0.0; … … 73 81 for(int i=0; i< (int)weights_core_radius.size(); i++) { 74 82 dp[1] = weights_core_radius[i].value; 83 for(int j=0; j< (int)weights_s_thickness.size(); j++){ 84 dp[2] = weights_s_thickness[j].value; 85 for(int k=0; k< (int)weights_w_thickness.size(); k++){ 86 dp[3] = weights_w_thickness[k].value; 75 87 76 sum += weights_core_radius[i].weight 77 * MultiShell(dp, q); 78 norm += weights_core_radius[i].weight; 88 sum += weights_core_radius[i].weight*weights_s_thickness[j].weight 89 *weights_w_thickness[k].weight* MultiShell(dp, q); 90 norm += weights_core_radius[i].weight*weights_s_thickness[j].weight 91 *weights_w_thickness[k].weight; 92 } 93 } 79 94 } 80 95 return sum/norm + background();
Note: See TracChangeset
for help on using the changeset viewer.