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

    r870f131 r5eb9154  
    376376        }        
    377377} 
    378  
    379378/** 
    380  * Function to call to evaluate model in cartesian coordinates 
    381  * @param args: input q or [qx, qy]] 
    382  * @return: function value 
     379 * Function to call to calculate_ER 
     380 * @return: effective radius value  
    383381 */ 
    384 static PyObject * runXY(CLamellarPSHGModel *self, PyObject *args) { 
    385         double qx_value, qy_value; 
     382static PyObject * calculate_ER(CLamellarPSHGModel *self) { 
     383 
    386384        PyObject* pars; 
    387385        int npars; 
     
    410408    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict); 
    411409 
     410                 
     411        return Py_BuildValue("d",(*(self->model)).calculate_ER()); 
     412 
     413} 
     414/** 
     415 * Function to call to evaluate model in cartesian coordinates 
     416 * @param args: input q or [qx, qy]] 
     417 * @return: function value 
     418 */ 
     419static PyObject * runXY(CLamellarPSHGModel *self, PyObject *args) { 
     420        double qx_value, qy_value; 
     421        PyObject* pars; 
     422        int npars; 
     423         
     424        // Get parameters 
     425         
     426            // Reader parameter dictionary 
     427    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") ); 
     428    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
     429    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") ); 
     430    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") ); 
     431    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") ); 
     432    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") ); 
     433    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") ); 
     434    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") ); 
     435    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 
     436    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") ); 
     437    // Read in dispersion parameters 
     438    PyObject* disp_dict; 
     439    DispersionVisitor* visitor = new DispersionVisitor(); 
     440    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT"); 
     441    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict); 
     442    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH"); 
     443    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict); 
     444    disp_dict = PyDict_GetItemString(self->dispersion, "spacing"); 
     445    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict); 
     446 
    412447         
    413448        // Get input and determine whether we have to supply a 1D or 2D return value. 
     
    489524    {"runXY",      (PyCFunction)runXY     , METH_VARARGS, 
    490525      "Evaluate the model at a given Q or Qx, Qy"}, 
     526    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS, 
     527      "Evaluate the model at a given Q or Q, phi"}, 
    491528       
    492529    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS, 
Note: See TracChangeset for help on using the changeset viewer.