Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/CEllipticalCylinderModel.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/CEllipticalCylinderModel.cpp
r870f131 r5eb9154 394 394 } 395 395 } 396 397 396 /** 398 * Function to call to evaluate model in cartesian coordinates 399 * @param args: input q or [qx, qy]] 400 * @return: function value 397 * Function to call to calculate_ER 398 * @return: effective radius value 401 399 */ 402 static PyObject * runXY(CEllipticalCylinderModel *self, PyObject *args) {403 double qx_value, qy_value; 400 static PyObject * calculate_ER(CEllipticalCylinderModel *self) { 401 404 402 PyObject* pars; 405 403 int npars; … … 433 431 self->model->cyl_psi.dispersion->accept_as_destination(visitor, self->model->cyl_psi.dispersion, disp_dict); 434 432 433 434 return Py_BuildValue("d",(*(self->model)).calculate_ER()); 435 436 } 437 /** 438 * Function to call to evaluate model in cartesian coordinates 439 * @param args: input q or [qx, qy]] 440 * @return: function value 441 */ 442 static PyObject * runXY(CEllipticalCylinderModel *self, PyObject *args) { 443 double qx_value, qy_value; 444 PyObject* pars; 445 int npars; 446 447 // Get parameters 448 449 // Reader parameter dictionary 450 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 451 self->model->cyl_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_psi") ); 452 self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") ); 453 self->model->r_minor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_minor") ); 454 self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") ); 455 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 456 self->model->r_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_ratio") ); 457 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 458 self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") ); 459 // Read in dispersion parameters 460 PyObject* disp_dict; 461 DispersionVisitor* visitor = new DispersionVisitor(); 462 disp_dict = PyDict_GetItemString(self->dispersion, "r_minor"); 463 self->model->r_minor.dispersion->accept_as_destination(visitor, self->model->r_minor.dispersion, disp_dict); 464 disp_dict = PyDict_GetItemString(self->dispersion, "r_ratio"); 465 self->model->r_ratio.dispersion->accept_as_destination(visitor, self->model->r_ratio.dispersion, disp_dict); 466 disp_dict = PyDict_GetItemString(self->dispersion, "length"); 467 self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict); 468 disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta"); 469 self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict); 470 disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi"); 471 self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict); 472 disp_dict = PyDict_GetItemString(self->dispersion, "cyl_psi"); 473 self->model->cyl_psi.dispersion->accept_as_destination(visitor, self->model->cyl_psi.dispersion, disp_dict); 474 435 475 436 476 // Get input and determine whether we have to supply a 1D or 2D return value. … … 518 558 {"runXY", (PyCFunction)runXY , METH_VARARGS, 519 559 "Evaluate the model at a given Q or Qx, Qy"}, 560 {"calculate_ER", (PyCFunction)calculate_ER , METH_VARARGS, 561 "Evaluate the model at a given Q or Q, phi"}, 520 562 521 563 {"evalDistribution", (PyCFunction)evalDistribution , METH_VARARGS,
Note: See TracChangeset
for help on using the changeset viewer.