Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/CParallelepipedModel.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/CParallelepipedModel.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(CParallelepipedModel *self, PyObject *args) {403 double qx_value, qy_value; 400 static PyObject * calculate_ER(CParallelepipedModel *self) { 401 404 402 PyObject* pars; 405 403 int npars; … … 433 431 self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.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(CParallelepipedModel *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->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 451 self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 452 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 453 self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 454 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 455 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 456 self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") ); 457 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 458 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 459 // Read in dispersion parameters 460 PyObject* disp_dict; 461 DispersionVisitor* visitor = new DispersionVisitor(); 462 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 463 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 464 disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 465 self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 466 disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 467 self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 468 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 469 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); 470 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi"); 471 self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict); 472 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta"); 473 self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.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.