Changeset cb62bd5 in sasview for src/sas/sascalc/pr/c_extensions


Ignore:
Timestamp:
Aug 4, 2017 4:22:51 AM (7 years ago)
Author:
lewis
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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1abd19c
Parents:
a0e6b1b
Message:

Use manually inputted background level in Pr calculation

Location:
src/sas/sascalc/pr/c_extensions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/pr/c_extensions/Cinvertor.c

    r959eb01 rcb62bd5  
    294294} 
    295295 
    296 const char set_has_bck_doc[] = 
     296const char set_est_bck_doc[] = 
    297297        "Sets background flag\n"; 
    298298 
     
    300300 * Sets the maximum distance 
    301301 */ 
    302 static PyObject * set_has_bck(Cinvertor *self, PyObject *args) { 
    303         int has_bck; 
    304  
    305         if (!PyArg_ParseTuple(args, "i", &has_bck)) return NULL; 
    306         self->params.has_bck = has_bck; 
    307         return Py_BuildValue("i", self->params.has_bck); 
    308 } 
    309  
    310 const char get_has_bck_doc[] = 
     302static PyObject * set_est_bck(Cinvertor *self, PyObject *args) { 
     303        int est_bck; 
     304 
     305        if (!PyArg_ParseTuple(args, "i", &est_bck)) return NULL; 
     306        self->params.est_bck = est_bck; 
     307        return Py_BuildValue("i", self->params.est_bck); 
     308} 
     309 
     310const char get_est_bck_doc[] = 
    311311        "Gets background flag\n"; 
    312312 
     
    314314 * Gets the maximum distance 
    315315 */ 
    316 static PyObject * get_has_bck(Cinvertor *self, PyObject *args) { 
    317         return Py_BuildValue("i", self->params.has_bck); 
     316static PyObject * get_est_bck(Cinvertor *self, PyObject *args) { 
     317        return Py_BuildValue("i", self->params.est_bck); 
    318318} 
    319319 
     
    882882        sqrt_alpha = sqrt(self->params.alpha); 
    883883        pi = acos(-1.0); 
    884         offset = (self->params.has_bck==1) ? 0 : 1; 
     884        offset = (self->params.est_bck==1) ? 0 : 1; 
    885885 
    886886    for (j=0; j<nfunc; j++) { 
     
    892892            } 
    893893            if (accept_q(self, self->params.x[i])){ 
    894                 if (self->params.has_bck==1 && j==0) { 
     894                if (self->params.est_bck==1 && j==0) { 
    895895                    a[i*nfunc+j] = 1.0/self->params.err[i]; 
    896896                } else { 
     
    906906        } 
    907907        for (i_r=0; i_r<nr; i_r++){ 
    908             if (self->params.has_bck==1 && j==0) { 
     908            if (self->params.est_bck==1 && j==0) { 
    909909                a[(i_r+self->params.npoints)*nfunc+j] = 0.0; 
    910910            } else { 
     
    10291029                   {"set_slit_height", (PyCFunction)set_slit_height, METH_VARARGS, set_slit_height_doc}, 
    10301030                   {"get_slit_height", (PyCFunction)get_slit_height, METH_VARARGS, get_slit_height_doc}, 
    1031                    {"set_has_bck", (PyCFunction)set_has_bck, METH_VARARGS, set_has_bck_doc}, 
    1032                    {"get_has_bck", (PyCFunction)get_has_bck, METH_VARARGS, get_has_bck_doc}, 
     1031                   {"set_est_bck", (PyCFunction)set_est_bck, METH_VARARGS, set_est_bck_doc}, 
     1032                   {"get_est_bck", (PyCFunction)get_est_bck, METH_VARARGS, get_est_bck_doc}, 
    10331033                   {"get_nx", (PyCFunction)get_nx, METH_VARARGS, get_nx_doc}, 
    10341034                   {"get_ny", (PyCFunction)get_ny, METH_VARARGS, get_ny_doc}, 
  • src/sas/sascalc/pr/c_extensions/invertor.c

    r959eb01 rcb62bd5  
    2020        pars->q_min = -1.0; 
    2121        pars->q_max = -1.0; 
    22         pars->has_bck = 0; 
     22        pars->est_bck = 0; 
    2323} 
    2424 
     
    313313    return sqrt(sum_r2/(2.0*sum)); 
    314314} 
    315  
  • src/sas/sascalc/pr/c_extensions/invertor.h

    r959eb01 rcb62bd5  
    2727    double q_max; 
    2828    /// Flag for whether or not to evalute a constant background while inverting 
    29     int has_bck; 
     29    int est_bck; 
    3030    /// Slit height in units of q [A-1] 
    3131    double slit_height; 
Note: See TracChangeset for help on using the changeset viewer.