Ignore:
Timestamp:
Aug 31, 2009 3: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/CFlexibleCylinderModel.cpp

    r870f131 r5eb9154  
    364364        }        
    365365} 
    366  
    367 /** 
    368  * Function to call to evaluate model in cartesian coordinates 
    369  * @param args: input q or [qx, qy]] 
    370  * @return: function value 
    371  */ 
    372 static PyObject * runXY(CFlexibleCylinderModel *self, PyObject *args) { 
    373         double qx_value, qy_value; 
     366/** 
     367 * Function to call to calculate_ER 
     368 * @return: effective radius value  
     369 */ 
     370static PyObject * calculate_ER(CFlexibleCylinderModel *self) { 
     371 
    374372        PyObject* pars; 
    375373        int npars; 
     
    394392    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict); 
    395393 
     394                 
     395        return Py_BuildValue("d",(*(self->model)).calculate_ER()); 
     396 
     397} 
     398/** 
     399 * Function to call to evaluate model in cartesian coordinates 
     400 * @param args: input q or [qx, qy]] 
     401 * @return: function value 
     402 */ 
     403static PyObject * runXY(CFlexibleCylinderModel *self, PyObject *args) { 
     404        double qx_value, qy_value; 
     405        PyObject* pars; 
     406        int npars; 
     407         
     408        // Get parameters 
     409         
     410            // Reader parameter dictionary 
     411    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
     412    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") ); 
     413    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") ); 
     414    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 
     415    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") ); 
     416    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 
     417    // Read in dispersion parameters 
     418    PyObject* disp_dict; 
     419    DispersionVisitor* visitor = new DispersionVisitor(); 
     420    disp_dict = PyDict_GetItemString(self->dispersion, "length"); 
     421    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict); 
     422    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length"); 
     423    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict); 
     424    disp_dict = PyDict_GetItemString(self->dispersion, "radius"); 
     425    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict); 
     426 
    396427         
    397428        // Get input and determine whether we have to supply a 1D or 2D return value. 
     
    473504    {"runXY",      (PyCFunction)runXY     , METH_VARARGS, 
    474505      "Evaluate the model at a given Q or Qx, Qy"}, 
     506    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS, 
     507      "Evaluate the model at a given Q or Q, phi"}, 
    475508       
    476509    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS, 
Note: See TracChangeset for help on using the changeset viewer.