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/CMultiShellModel.cpp

    r870f131 r5eb9154  
    370370        }        
    371371} 
    372  
    373 /** 
    374  * Function to call to evaluate model in cartesian coordinates 
    375  * @param args: input q or [qx, qy]] 
    376  * @return: function value 
    377  */ 
    378 static PyObject * runXY(CMultiShellModel *self, PyObject *args) { 
    379         double qx_value, qy_value; 
     372/** 
     373 * Function to call to calculate_ER 
     374 * @return: effective radius value  
     375 */ 
     376static PyObject * calculate_ER(CMultiShellModel *self) { 
     377 
    380378        PyObject* pars; 
    381379        int npars; 
     
    402400    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict); 
    403401 
     402                 
     403        return Py_BuildValue("d",(*(self->model)).calculate_ER()); 
     404 
     405} 
     406/** 
     407 * Function to call to evaluate model in cartesian coordinates 
     408 * @param args: input q or [qx, qy]] 
     409 * @return: function value 
     410 */ 
     411static PyObject * runXY(CMultiShellModel *self, PyObject *args) { 
     412        double qx_value, qy_value; 
     413        PyObject* pars; 
     414        int npars; 
     415         
     416        // Get parameters 
     417         
     418            // Reader parameter dictionary 
     419    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") ); 
     420    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") ); 
     421    self->model->n_pairs = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_pairs") ); 
     422    self->model->w_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "w_thickness") ); 
     423    self->model->s_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_thickness") ); 
     424    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
     425    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 
     426    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") ); 
     427    // Read in dispersion parameters 
     428    PyObject* disp_dict; 
     429    DispersionVisitor* visitor = new DispersionVisitor(); 
     430    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius"); 
     431    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict); 
     432    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness"); 
     433    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict); 
     434    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness"); 
     435    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict); 
     436 
    404437         
    405438        // Get input and determine whether we have to supply a 1D or 2D return value. 
     
    481514    {"runXY",      (PyCFunction)runXY     , METH_VARARGS, 
    482515      "Evaluate the model at a given Q or Qx, Qy"}, 
     516    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS, 
     517      "Evaluate the model at a given Q or Q, phi"}, 
    483518       
    484519    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS, 
Note: See TracChangeset for help on using the changeset viewer.