Changeset 8e36cdd in sasview for sansmodels/src/sans/models/c_models


Ignore:
Timestamp:
Aug 20, 2009 1:24:23 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:
1d67243
Parents:
191b369
Message:

fixed and tested ppmodel 2d and cleaned it up.

Location:
sansmodels/src/sans/models/c_models
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/CParallelepipedModel.cpp

    r2cb89e7 r8e36cdd  
    8787        // Initialize parameter dictionary 
    8888        PyDict_SetItemString(self->params,"short_a",Py_BuildValue("d",35.000000)); 
     89        PyDict_SetItemString(self->params,"short_b",Py_BuildValue("d",75.000000)); 
    8990        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000)); 
    90         PyDict_SetItemString(self->params,"long_b",Py_BuildValue("d",75.000000)); 
    91         PyDict_SetItemString(self->params,"longer_c",Py_BuildValue("d",400.000000)); 
     91        PyDict_SetItemString(self->params,"long_c",Py_BuildValue("d",400.000000)); 
    9292        PyDict_SetItemString(self->params,"parallel_psi",Py_BuildValue("d",0.000000)); 
    9393        PyDict_SetItemString(self->params,"parallel_phi",Py_BuildValue("d",0.000000)); 
     
    102102        PyDict_SetItemString(self->dispersion, "short_a", disp_dict); 
    103103        disp_dict = PyDict_New(); 
    104         self->model->long_b.dispersion->accept_as_source(visitor, self->model->long_b.dispersion, disp_dict); 
    105         PyDict_SetItemString(self->dispersion, "long_b", disp_dict); 
     104        self->model->short_b.dispersion->accept_as_source(visitor, self->model->short_b.dispersion, disp_dict); 
     105        PyDict_SetItemString(self->dispersion, "short_b", disp_dict); 
    106106        disp_dict = PyDict_New(); 
    107         self->model->longer_c.dispersion->accept_as_source(visitor, self->model->longer_c.dispersion, disp_dict); 
    108         PyDict_SetItemString(self->dispersion, "longer_c", disp_dict); 
     107        self->model->long_c.dispersion->accept_as_source(visitor, self->model->long_c.dispersion, disp_dict); 
     108        PyDict_SetItemString(self->dispersion, "long_c", disp_dict); 
    109109        disp_dict = PyDict_New(); 
    110110        self->model->parallel_phi.dispersion->accept_as_source(visitor, self->model->parallel_phi.dispersion, disp_dict); 
     
    247247            // Reader parameter dictionary 
    248248    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 
     249    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 
    249250    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
    250     self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 
    251     self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 
     251    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 
    252252    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 
    253253    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 
     
    260260    disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 
    261261    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 
    262     disp_dict = PyDict_GetItemString(self->dispersion, "long_b"); 
    263     self->model->long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict); 
    264     disp_dict = PyDict_GetItemString(self->dispersion, "longer_c"); 
    265     self->model->longer_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict); 
     262    disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 
     263    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 
     264    disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 
     265    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 
    266266    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 
    267267    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); 
     
    333333            // Reader parameter dictionary 
    334334    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 
     335    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 
    335336    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
    336     self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 
    337     self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 
     337    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 
    338338    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 
    339339    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 
     
    346346    disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 
    347347    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 
    348     disp_dict = PyDict_GetItemString(self->dispersion, "long_b"); 
    349     self->model->long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict); 
    350     disp_dict = PyDict_GetItemString(self->dispersion, "longer_c"); 
    351     self->model->longer_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict); 
     348    disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 
     349    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 
     350    disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 
     351    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 
    352352    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 
    353353    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); 
     
    408408            // Reader parameter dictionary 
    409409    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 
     410    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 
    410411    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 
    411     self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 
    412     self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 
     412    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 
    413413    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 
    414414    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 
     
    421421    disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 
    422422    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 
    423     disp_dict = PyDict_GetItemString(self->dispersion, "long_b"); 
    424     self->model->long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict); 
    425     disp_dict = PyDict_GetItemString(self->dispersion, "longer_c"); 
    426     self->model->longer_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict); 
     423    disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 
     424    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 
     425    disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 
     426    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 
    427427    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 
    428428    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); 
     
    488488    if (!strcmp(par_name, "short_a")) { 
    489489        self->model->short_a.dispersion = dispersion; 
    490     } else    if (!strcmp(par_name, "long_b")) { 
    491         self->model->long_b.dispersion = dispersion; 
    492     } else    if (!strcmp(par_name, "longer_c")) { 
    493         self->model->longer_c.dispersion = dispersion; 
     490    } else    if (!strcmp(par_name, "short_b")) { 
     491        self->model->short_b.dispersion = dispersion; 
     492    } else    if (!strcmp(par_name, "long_c")) { 
     493        self->model->long_c.dispersion = dispersion; 
    494494    } else    if (!strcmp(par_name, "parallel_phi")) { 
    495495        self->model->parallel_phi.dispersion = dispersion; 
  • sansmodels/src/sans/models/c_models/models.hh

    reddff027 r8e36cdd  
    5050        Parameter scale; 
    5151        Parameter short_a; 
    52         Parameter long_b; 
    53         Parameter longer_c; 
     52        Parameter short_b; 
     53        Parameter long_c; 
    5454        Parameter contrast; 
    5555        Parameter background; 
  • sansmodels/src/sans/models/c_models/parallelepiped.cpp

    r3c102d4 r8e36cdd  
    3737        short_a     = Parameter(35.0, true); 
    3838        short_a.set_max(1.0); 
    39         long_b     = Parameter(75.0, true); 
    40         long_b.set_min(1.0); 
    41         longer_c     = Parameter(400.0, true); 
    42         longer_c.set_min(1.0); 
     39        short_b     = Parameter(75.0, true); 
     40        short_b.set_min(1.0); 
     41        long_c     = Parameter(400.0, true); 
     42        long_c.set_min(1.0); 
    4343        contrast   = Parameter(53.e-7); 
    4444        background = Parameter(0.0); 
     
    6161        dp[0] = scale(); 
    6262        dp[1] = short_a(); 
    63         dp[2] = long_b(); 
    64         dp[3] = longer_c(); 
     63        dp[2] = short_b(); 
     64        dp[3] = long_c(); 
    6565        dp[4] = contrast(); 
    6666        dp[5] = 0.0; 
     
    7171 
    7272        // Get the dispersion points for the longer_edgeB 
    73         vector<WeightPoint> weights_long_b; 
    74         long_b.get_weights(weights_long_b); 
     73        vector<WeightPoint> weights_short_b; 
     74        short_b.get_weights(weights_short_b); 
    7575 
    7676        // Get the dispersion points for the longuest_edgeC 
    77         vector<WeightPoint> weights_longer_c; 
    78         longer_c.get_weights(weights_longer_c); 
     77        vector<WeightPoint> weights_long_c; 
     78        long_c.get_weights(weights_long_c); 
    7979 
    8080 
     
    8989 
    9090                // Loop over longer_edgeB weight points 
    91                 for(int j=0; j< (int)weights_long_b.size(); j++) { 
    92                         dp[2] = weights_long_b[j].value; 
     91                for(int j=0; j< (int)weights_short_b.size(); j++) { 
     92                        dp[2] = weights_short_b[j].value; 
    9393 
    9494                        // Loop over longuest_edgeC weight points 
    95                         for(int k=0; k< (int)weights_longer_c.size(); k++) { 
    96                                 dp[3] = weights_longer_c[k].value; 
    97  
    98                                 sum += weights_short_a[i].weight * weights_long_b[j].weight 
    99                                         * weights_longer_c[k].weight * Parallelepiped(dp, q); 
     95                        for(int k=0; k< (int)weights_long_c.size(); k++) { 
     96                                dp[3] = weights_long_c[k].value; 
     97 
     98                                sum += weights_short_a[i].weight * weights_short_b[j].weight 
     99                                        * weights_long_c[k].weight * Parallelepiped(dp, q); 
    100100 
    101101                                norm += weights_short_a[i].weight 
    102                                          * weights_long_b[j].weight * weights_longer_c[k].weight; 
     102                                         * weights_short_b[j].weight * weights_long_c[k].weight; 
    103103                        } 
    104104                } 
     
    117117        dp.scale      = scale(); 
    118118        dp.short_a   = short_a(); 
    119         dp.long_b   = long_b(); 
    120         dp.longer_c  = longer_c(); 
     119        dp.short_b   = short_b(); 
     120        dp.long_c  = long_c(); 
    121121        dp.contrast   = contrast(); 
    122122        dp.background = 0.0; 
     
    132132 
    133133        // Get the dispersion points for the longer_edgeB 
    134         vector<WeightPoint> weights_long_b; 
    135         long_b.get_weights(weights_long_b); 
     134        vector<WeightPoint> weights_short_b; 
     135        short_b.get_weights(weights_short_b); 
    136136 
    137137        // Get angular averaging for the longuest_edgeC 
    138         vector<WeightPoint> weights_longer_c; 
    139         longer_c.get_weights(weights_longer_c); 
     138        vector<WeightPoint> weights_long_c; 
     139        long_c.get_weights(weights_long_c); 
    140140 
    141141        // Get angular averaging for theta 
     
    160160 
    161161                // Loop over longer_edgeB weight points 
    162                 for(int j=0; j< (int)weights_long_b.size(); j++) { 
    163                         dp.long_b = weights_long_b[j].value; 
     162                for(int j=0; j< (int)weights_short_b.size(); j++) { 
     163                        dp.short_b = weights_short_b[j].value; 
    164164 
    165165                        // Average over longuest_edgeC distribution 
    166                         for(int k=0; k< (int)weights_longer_c.size(); k++) { 
    167                                 dp.longer_c = weights_longer_c[k].value; 
     166                        for(int k=0; k< (int)weights_long_c.size(); k++) { 
     167                                dp.long_c = weights_long_c[k].value; 
    168168 
    169169                                // Average over theta distribution 
     
    180180 
    181181                                                        double _ptvalue = weights_short_a[i].weight 
    182                                                                 * weights_long_b[j].weight 
    183                                                                 * weights_longer_c[k].weight 
     182                                                                * weights_short_b[j].weight 
     183                                                                * weights_long_c[k].weight 
    184184                                                                * weights_parallel_theta[l].weight 
    185185                                                                * weights_parallel_phi[m].weight 
     
    192192 
    193193                                                        norm += weights_short_a[i].weight 
    194                                                                 * weights_long_b[j].weight 
    195                                                                 * weights_longer_c[k].weight 
     194                                                                * weights_short_b[j].weight 
     195                                                                * weights_long_c[k].weight 
    196196                                                                * weights_parallel_theta[l].weight 
    197197                                                                * weights_parallel_phi[m].weight 
Note: See TracChangeset for help on using the changeset viewer.