Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/CHollowCylinderModel.cpp
- Timestamp:
- Aug 31, 2009 5:25:44 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:
- 5be36bb
- Parents:
- 572beba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/CHollowCylinderModel.cpp
re2afadf r5eb9154 384 384 } 385 385 } 386 387 386 /** 388 * Function to call to evaluate model in cartesian coordinates 389 * @param args: input q or [qx, qy]] 390 * @return: function value 387 * Function to call to calculate_ER 388 * @return: effective radius value 391 389 */ 392 static PyObject * runXY(CHollowCylinderModel *self, PyObject *args) {393 double qx_value, qy_value; 390 static PyObject * calculate_ER(CHollowCylinderModel *self) { 391 394 392 PyObject* pars; 395 393 int npars; … … 420 418 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict); 421 419 420 421 return Py_BuildValue("d",(*(self->model)).calculate_ER()); 422 423 } 424 /** 425 * Function to call to evaluate model in cartesian coordinates 426 * @param args: input q or [qx, qy]] 427 * @return: function value 428 */ 429 static PyObject * runXY(CHollowCylinderModel *self, PyObject *args) { 430 double qx_value, qy_value; 431 PyObject* pars; 432 int npars; 433 434 // Get parameters 435 436 // Reader parameter dictionary 437 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 438 self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") ); 439 self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") ); 440 self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") ); 441 self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") ); 442 self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") ); 443 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 444 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 445 // Read in dispersion parameters 446 PyObject* disp_dict; 447 DispersionVisitor* visitor = new DispersionVisitor(); 448 disp_dict = PyDict_GetItemString(self->dispersion, "core_radius"); 449 self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict); 450 disp_dict = PyDict_GetItemString(self->dispersion, "radius"); 451 self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict); 452 disp_dict = PyDict_GetItemString(self->dispersion, "length"); 453 self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict); 454 disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta"); 455 self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict); 456 disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi"); 457 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict); 458 422 459 423 460 // Get input and determine whether we have to supply a 1D or 2D return value. … … 503 540 {"runXY", (PyCFunction)runXY , METH_VARARGS, 504 541 "Evaluate the model at a given Q or Qx, Qy"}, 542 {"calculate_ER", (PyCFunction)calculate_ER , METH_VARARGS, 543 "Evaluate the model at a given Q or Q, phi"}, 505 544 506 545 {"evalDistribution", (PyCFunction)evalDistribution , METH_VARARGS,
Note: See TracChangeset
for help on using the changeset viewer.