Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/CEllipsoidModel.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/CEllipsoidModel.cpp
r870f131 r5eb9154 374 374 } 375 375 } 376 377 376 /** 378 * Function to call to evaluate model in cartesian coordinates 379 * @param args: input q or [qx, qy]] 380 * @return: function value 377 * Function to call to calculate_ER 378 * @return: effective radius value 381 379 */ 382 static PyObject * runXY(CEllipsoidModel *self, PyObject *args) {383 double qx_value, qy_value; 380 static PyObject * calculate_ER(CEllipsoidModel *self) { 381 384 382 PyObject* pars; 385 383 int npars; … … 407 405 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict); 408 406 407 408 return Py_BuildValue("d",(*(self->model)).calculate_ER()); 409 410 } 411 /** 412 * Function to call to evaluate model in cartesian coordinates 413 * @param args: input q or [qx, qy]] 414 * @return: function value 415 */ 416 static PyObject * runXY(CEllipsoidModel *self, PyObject *args) { 417 double qx_value, qy_value; 418 PyObject* pars; 419 int npars; 420 421 // Get parameters 422 423 // Reader parameter dictionary 424 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 425 self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") ); 426 self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") ); 427 self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") ); 428 self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") ); 429 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 430 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 431 // Read in dispersion parameters 432 PyObject* disp_dict; 433 DispersionVisitor* visitor = new DispersionVisitor(); 434 disp_dict = PyDict_GetItemString(self->dispersion, "radius_a"); 435 self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict); 436 disp_dict = PyDict_GetItemString(self->dispersion, "radius_b"); 437 self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict); 438 disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta"); 439 self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict); 440 disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi"); 441 self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict); 442 409 443 410 444 // Get input and determine whether we have to supply a 1D or 2D return value. … … 488 522 {"runXY", (PyCFunction)runXY , METH_VARARGS, 489 523 "Evaluate the model at a given Q or Qx, Qy"}, 524 {"calculate_ER", (PyCFunction)calculate_ER , METH_VARARGS, 525 "Evaluate the model at a given Q or Q, phi"}, 490 526 491 527 {"evalDistribution", (PyCFunction)evalDistribution , METH_VARARGS,
Note: See TracChangeset
for help on using the changeset viewer.