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

    r870f131 r5eb9154  
    344344        }        
    345345} 
    346  
     346/** 
     347 * Function to call to calculate_ER 
     348 * @return: effective radius value  
     349 */ 
     350static PyObject * calculate_ER(CSphereModel *self) { 
     351 
     352        PyObject* pars; 
     353        int npars; 
     354         
     355        // Get parameters 
     356         
     357            // Reader parameter dictionary 
     358    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
     359    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") ); 
     360    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 
     361    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 
     362    // Read in dispersion parameters 
     363    PyObject* disp_dict; 
     364    DispersionVisitor* visitor = new DispersionVisitor(); 
     365    disp_dict = PyDict_GetItemString(self->dispersion, "radius"); 
     366    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict); 
     367 
     368                 
     369        return Py_BuildValue("d",(*(self->model)).calculate_ER()); 
     370 
     371} 
    347372/** 
    348373 * Function to call to evaluate model in cartesian coordinates 
     
    443468    {"runXY",      (PyCFunction)runXY     , METH_VARARGS, 
    444469      "Evaluate the model at a given Q or Qx, Qy"}, 
     470    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS, 
     471      "Evaluate the model at a given Q or Q, phi"}, 
    445472       
    446473    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS, 
Note: See TracChangeset for help on using the changeset viewer.