Ignore:
Timestamp:
Aug 31, 2009 5:25:44 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
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
Message:

calculation of the effective radius are added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/CCoreShellEllipsoidModel.cpp

    r870f131 r5eb9154  
    397397        }        
    398398} 
    399  
    400399/** 
    401  * Function to call to evaluate model in cartesian coordinates 
    402  * @param args: input q or [qx, qy]] 
    403  * @return: function value 
     400 * Function to call to calculate_ER 
     401 * @return: effective radius value  
    404402 */ 
    405 static PyObject * runXY(CCoreShellEllipsoidModel *self, PyObject *args) { 
    406         double qx_value, qy_value; 
     403static PyObject * calculate_ER(CCoreShellEllipsoidModel *self) { 
     404 
    407405        PyObject* pars; 
    408406        int npars; 
     
    437435    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict); 
    438436 
     437                 
     438        return Py_BuildValue("d",(*(self->model)).calculate_ER()); 
     439 
     440} 
     441/** 
     442 * Function to call to evaluate model in cartesian coordinates 
     443 * @param args: input q or [qx, qy]] 
     444 * @return: function value 
     445 */ 
     446static PyObject * runXY(CCoreShellEllipsoidModel *self, PyObject *args) { 
     447        double qx_value, qy_value; 
     448        PyObject* pars; 
     449        int npars; 
     450         
     451        // Get parameters 
     452         
     453            // Reader parameter dictionary 
     454    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
     455    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") ); 
     456    self->model->polar_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_shell") ); 
     457    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") ); 
     458    self->model->equat_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_shell") ); 
     459    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") ); 
     460    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 
     461    self->model->equat_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_core") ); 
     462    self->model->polar_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_core") ); 
     463    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 
     464    // Read in dispersion parameters 
     465    PyObject* disp_dict; 
     466    DispersionVisitor* visitor = new DispersionVisitor(); 
     467    disp_dict = PyDict_GetItemString(self->dispersion, "equat_core"); 
     468    self->model->equat_core.dispersion->accept_as_destination(visitor, self->model->equat_core.dispersion, disp_dict); 
     469    disp_dict = PyDict_GetItemString(self->dispersion, "polar_core"); 
     470    self->model->polar_core.dispersion->accept_as_destination(visitor, self->model->polar_core.dispersion, disp_dict); 
     471    disp_dict = PyDict_GetItemString(self->dispersion, "equat_shell"); 
     472    self->model->equat_shell.dispersion->accept_as_destination(visitor, self->model->equat_shell.dispersion, disp_dict); 
     473    disp_dict = PyDict_GetItemString(self->dispersion, "polar_shell"); 
     474    self->model->polar_shell.dispersion->accept_as_destination(visitor, self->model->polar_shell.dispersion, disp_dict); 
     475    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi"); 
     476    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict); 
     477    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta"); 
     478    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict); 
     479 
    439480         
    440481        // Get input and determine whether we have to supply a 1D or 2D return value. 
     
    522563    {"runXY",      (PyCFunction)runXY     , METH_VARARGS, 
    523564      "Evaluate the model at a given Q or Qx, Qy"}, 
     565    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS, 
     566      "Evaluate the model at a given Q or Q, phi"}, 
    524567       
    525568    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS, 
Note: See TracChangeset for help on using the changeset viewer.