Changeset 8dc0b746 in sasview for sansmodels/src/sans/models/c_models
- Timestamp:
- Aug 4, 2009 6:17:28 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:
- 9188cc1
- Parents:
- 96b59384
- Location:
- sansmodels/src/sans/models/c_models
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/COblateModel.cpp
r27a0771 r8dc0b746 108 108 self->model->minor_shell.dispersion->accept_as_source(visitor, self->model->minor_shell.dispersion, disp_dict); 109 109 PyDict_SetItemString(self->dispersion, "minor_shell", disp_dict); 110 disp_dict = PyDict_New();111 self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);112 PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);113 disp_dict = PyDict_New();114 self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);115 PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);116 110 117 111 … … 187 181 disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell"); 188 182 self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict); 189 disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");190 self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);191 disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");192 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);193 183 194 184 … … 263 253 disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell"); 264 254 self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict); 265 disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");266 self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);267 disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");268 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);269 255 270 256 … … 330 316 } else if (!strcmp(par_name, "minor_shell")) { 331 317 self->model->minor_shell.dispersion = dispersion; 332 } else if (!strcmp(par_name, "axis_theta")) {333 self->model->axis_theta.dispersion = dispersion;334 } else if (!strcmp(par_name, "axis_phi")) {335 self->model->axis_phi.dispersion = dispersion;336 318 } else { 337 319 PyErr_SetString(COblateModelError, -
sansmodels/src/sans/models/c_models/CProlateModel.cpp
r72a90bd r8dc0b746 86 86 PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000)); 87 87 PyDict_SetItemString(self->params,"minor_core",Py_BuildValue("d",50.000000)); 88 PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",1.000000));89 88 PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006)); 90 PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",1.000000));91 89 PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000)); 92 90 PyDict_SetItemString(self->params,"major_shell",Py_BuildValue("d",110.000000)); … … 108 106 self->model->minor_shell.dispersion->accept_as_source(visitor, self->model->minor_shell.dispersion, disp_dict); 109 107 PyDict_SetItemString(self->dispersion, "minor_shell", disp_dict); 110 disp_dict = PyDict_New();111 self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);112 PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);113 disp_dict = PyDict_New();114 self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);115 PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);116 108 117 109 … … 169 161 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 170 162 self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") ); 171 self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );172 163 self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") ); 173 self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );174 164 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 175 165 self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") ); … … 187 177 disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell"); 188 178 self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict); 189 disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");190 self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);191 disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");192 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);193 179 194 180 … … 245 231 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 246 232 self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") ); 247 self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );248 233 self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") ); 249 self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );250 234 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 251 235 self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") ); … … 263 247 disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell"); 264 248 self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict); 265 disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");266 self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);267 disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");268 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);269 249 270 250 … … 330 310 } else if (!strcmp(par_name, "minor_shell")) { 331 311 self->model->minor_shell.dispersion = dispersion; 332 } else if (!strcmp(par_name, "axis_theta")) {333 self->model->axis_theta.dispersion = dispersion;334 } else if (!strcmp(par_name, "axis_phi")) {335 self->model->axis_phi.dispersion = dispersion;336 312 } else { 337 313 PyErr_SetString(CProlateModelError, -
sansmodels/src/sans/models/c_models/prolate.cpp
r27a0771 r8dc0b746 45 45 sld_solvent = Parameter(6.3e-6); 46 46 background = Parameter(0.0); 47 axis_theta = Parameter(0.0, true);48 axis_phi = Parameter(0.0, true);49 47 } 50 48 … … 67 65 dp[5] = contrast(); 68 66 dp[6] = sld_solvent(); 69 dp[7] = background();70 67 dp[7] = 0.0; 68 71 69 // Get the dispersion points for the major core 72 70 vector<WeightPoint> weights_major_core; … … 106 104 dp[4] = weights_minor_shell[l].value; 107 105 108 sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 106 sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 109 107 * weights_minor_shell[l].weight * ProlateForm(dp, q); 110 norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 108 norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 111 109 * weights_minor_shell[l].weight; 112 110 } … … 123 121 * @return: function value 124 122 */ 123 double ProlateModel :: operator()(double qx, double qy) { 124 double q = sqrt(qx*qx + qy*qy); 125 126 return (*this).operator()(q); 127 } 128 129 /** 130 * Function to evaluate 2D scattering function 131 * @param pars: parameters of the prolate 132 * @param q: q-value 133 * @param phi: angle phi 134 * @return: function value 135 */ 136 double ProlateModel :: evaluate_rphi(double q, double phi) { 137 return (*this).operator()(q); 138 } 139 /* 125 140 double ProlateModel :: operator()(double qx, double qy) { 126 141 ProlateParameters dp; … … 216 231 } 217 232 218 /** 219 * Function to evaluate 2D scattering function 220 * @param pars: parameters of the prolate 221 * @param q: q-value 222 * @param phi: angle phi 223 * @return: function value 224 */ 225 double ProlateModel :: evaluate_rphi(double q, double phi) { 226 double qx = q*cos(phi); 227 double qy = q*sin(phi); 228 return (*this).operator()(qx, qy); 229 } 233 */
Note: See TracChangeset
for help on using the changeset viewer.