Changeset 2cc633b in sasview


Ignore:
Timestamp:
Aug 3, 2009 7:44:15 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:
42f193a
Parents:
0f3fefe
Message:

FIXED A BUG

Location:
sansmodels/src/sans/models
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/MultiShellModel.py

    r2c4b289 r2cc633b  
    5353        self.name = "MultiShellModel" 
    5454        ## Model description 
    55         self.description =""" 
    56                 Model parameters: 
     55        self.description ="""Model parameters: 
    5756                scale : scale factor 
    5857                core_radius : Core radius of the multishell 
     
    7675 
    7776                ## fittable parameters 
    78         self.fixed=['radius.width'] 
     77        self.fixed=['core_radius.width', 's_thickness.width', 'w_thickness.width'] 
    7978         
    8079        ## parameters with orientation 
  • sansmodels/src/sans/models/c_extensions/multishell.h

    r3d25331f r2cc633b  
    66 
    77        [PYTHONCLASS] = MultiShellModel 
    8         [DISP_PARAMS] = core_radius 
    9         [DESCRIPTION] =<text> 
    10                                                 Model parameters: 
    11                                                 scale : scale factor 
    12                                                 core_radius : Core radius of the multishell  
    13                                                 s_thickness: shell thickness 
    14                                                 w_thickness: water thickness 
    15                                                 core_sld: core scattering length density 
    16                                                 shell_sld: shell scattering length density 
    17                                                 n_pairs:number of pairs of water/shell 
    18                                                 background: incoherent background 
     8        [DISP_PARAMS] = core_radius, s_thickness, w_thickness 
     9        [DESCRIPTION] =<text>Model parameters: 
     10                                scale : scale factor 
     11                                core_radius : Core radius of the multishell 
     12                                s_thickness: shell thickness 
     13                                w_thickness: water thickness 
     14                                core_sld: core scattering length density 
     15                                shell_sld: shell scattering length density 
     16                                n_pairs:number of pairs of water/shell 
     17                                background: incoherent background 
    1918               </text> 
    20         [FIXED]=  core_radius.width 
     19        [FIXED]=  core_radius.width; s_thickness.width; w_thickness.width 
    2120        [ORIENTATION_PARAMS]= <text> </text> 
    2221 */ 
  • sansmodels/src/sans/models/c_models/CMultiShellModel.cpp

    r3d25331f r2cc633b  
    9797        self->model->core_radius.dispersion->accept_as_source(visitor, self->model->core_radius.dispersion, disp_dict); 
    9898        PyDict_SetItemString(self->dispersion, "core_radius", disp_dict); 
     99        disp_dict = PyDict_New(); 
     100        self->model->s_thickness.dispersion->accept_as_source(visitor, self->model->s_thickness.dispersion, disp_dict); 
     101        PyDict_SetItemString(self->dispersion, "s_thickness", disp_dict); 
     102        disp_dict = PyDict_New(); 
     103        self->model->w_thickness.dispersion->accept_as_source(visitor, self->model->w_thickness.dispersion, disp_dict); 
     104        PyDict_SetItemString(self->dispersion, "w_thickness", disp_dict); 
    99105 
    100106 
     
    162168    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius"); 
    163169    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict); 
     170    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness"); 
     171    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict); 
     172    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness"); 
     173    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict); 
    164174 
    165175         
     
    226236    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius"); 
    227237    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict); 
     238    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness"); 
     239    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict); 
     240    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness"); 
     241    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict); 
    228242 
    229243         
     
    283297    if (!strcmp(par_name, "core_radius")) { 
    284298        self->model->core_radius.dispersion = dispersion; 
     299    } else    if (!strcmp(par_name, "s_thickness")) { 
     300        self->model->s_thickness.dispersion = dispersion; 
     301    } else    if (!strcmp(par_name, "w_thickness")) { 
     302        self->model->w_thickness.dispersion = dispersion; 
    285303    } else { 
    286304            PyErr_SetString(CMultiShellModelError, 
  • sansmodels/src/sans/models/c_models/flexiblecylinder.cpp

    re6fa43e r2cc633b  
    5252 */ 
    5353double FlexibleCylinderModel :: operator()(double q) { 
    54         double dp[5]; 
     54        double dp[6]; 
    5555 
    5656        // Fill parameter array for IGOR library 
     
    6464 
    6565        // Get the dispersion points for the length 
    66         vector<WeightPoint> weights_length; 
    67         length.get_weights(weights_length); 
     66        vector<WeightPoint> weights_len; 
     67        length.get_weights(weights_len); 
    6868 
    6969        // Get the dispersion points for the kuhn_length 
    70         vector<WeightPoint> weights_kuhn_length; 
    71         kuhn_length.get_weights(weights_kuhn_length); 
     70        vector<WeightPoint> weights_kuhn; 
     71        kuhn_length.get_weights(weights_kuhn); 
    7272 
    7373        // Get the dispersion points for the radius 
    74         vector<WeightPoint> weights_radius; 
    75         radius.get_weights(weights_radius); 
     74        vector<WeightPoint> weights_rad; 
     75        radius.get_weights(weights_rad); 
    7676 
    7777        // Perform the computation, with all weight points 
     
    8080 
    8181        // Loop over semi axis A weight points 
    82         for(int i=0; i< (int)weights_length.size(); i++) { 
    83                 dp[1] = weights_length[i].value; 
     82        for(int i=0; i< (int)weights_len.size(); i++) { 
     83                dp[1] = weights_len[i].value; 
    8484 
    8585                // Loop over semi axis B weight points 
    86                 for(int j=0; j< (int)weights_kuhn_length.size(); j++) { 
    87                         dp[2] = weights_kuhn_length[j].value; 
     86                for(int j=0; j< (int)weights_kuhn.size(); j++) { 
     87                        dp[2] = weights_kuhn[j].value; 
    8888 
    8989                        // Loop over semi axis C weight points 
    90                         for(int k=0; k< (int)weights_radius.size(); k++) { 
    91                                 dp[3] = weights_radius[k].value; 
     90                        for(int k=0; k< (int)weights_rad.size(); k++) { 
     91                                dp[3] = weights_rad[k].value; 
    9292 
    93                                 sum += weights_length[i].weight 
    94                                         * weights_kuhn_length[j].weight * weights_radius[k].weight * FlexExclVolCyl(dp, q); 
    95                                 norm += weights_length[i].weight 
    96                                         * weights_kuhn_length[j]*weights_radius[k].weight; 
     93                                sum += weights_len[i].weight 
     94                                        * weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q); 
     95                                norm += weights_len[i].weight 
     96                                        * weights_kuhn[j].weight*weights_rad[k].weight; 
     97                        } 
    9798                } 
    9899        } 
  • sansmodels/src/sans/models/c_models/multishell.cpp

    r3d25331f r2cc633b  
    6666        core_radius.get_weights(weights_core_radius); 
    6767 
     68        // Get the dispersion points for the s_thickness 
     69        vector<WeightPoint> weights_s_thickness; 
     70        s_thickness.get_weights(weights_s_thickness); 
     71 
     72        // Get the dispersion points for the w_thickness 
     73        vector<WeightPoint> weights_w_thickness; 
     74        w_thickness.get_weights(weights_w_thickness); 
     75 
    6876        // Perform the computation, with all weight points 
    6977        double sum = 0.0; 
     
    7381        for(int i=0; i< (int)weights_core_radius.size(); i++) { 
    7482                dp[1] = weights_core_radius[i].value; 
     83                for(int j=0; j< (int)weights_s_thickness.size(); j++){ 
     84                        dp[2] = weights_s_thickness[j].value; 
     85                        for(int k=0; k< (int)weights_w_thickness.size(); k++){ 
     86                                dp[3] = weights_w_thickness[k].value; 
    7587 
    76                 sum += weights_core_radius[i].weight 
    77                         * MultiShell(dp, q); 
    78                 norm += weights_core_radius[i].weight; 
     88                                sum += weights_core_radius[i].weight*weights_s_thickness[j].weight 
     89                                        *weights_w_thickness[k].weight* MultiShell(dp, q); 
     90                                norm += weights_core_radius[i].weight*weights_s_thickness[j].weight 
     91                                        *weights_w_thickness[k].weight; 
     92                        } 
     93                } 
    7994        } 
    8095        return sum/norm + background(); 
Note: See TracChangeset for help on using the changeset viewer.