Ignore:
Timestamp:
Jan 7, 2010 5:04:25 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:
dfa8832
Parents:
4cbaf35
Message:

corrections on the definition of polydispersity as suggested by steve K: should be normalized by average volume

File:
1 edited

Legend:

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

    rf9bf661 rc451be9  
    7878        double sum = 0.0; 
    7979        double norm = 0.0; 
     80        double vol = 0.0; 
    8081 
    8182        // Loop over core radius weight points 
     
    9091                        for(int k=0; k< (int)weights_radius.size(); k++) { 
    9192                                dp[2] = weights_radius[k].value; 
    92  
     93                                //Un-normalize  by volume 
    9394                                sum += weights_core_radius[i].weight 
    9495                                        * weights_length[j].weight 
    9596                                        * weights_radius[k].weight 
    96                                         * HollowCylinder(dp, q); 
     97                                        * HollowCylinder(dp, q) 
     98                                        * (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2)) 
     99                                        * weights_length[j].value; 
     100                                //Find average volume 
     101                                vol += weights_core_radius[i].weight 
     102                                        * weights_length[j].weight 
     103                                        * weights_radius[k].weight 
     104                                        * (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2)) 
     105                                        * weights_length[j].value; 
     106 
    97107                                norm += weights_core_radius[i].weight 
    98                                 * weights_length[j].weight 
    99                                 * weights_radius[k].weight; 
     108                                        * weights_length[j].weight 
     109                                        * weights_radius[k].weight; 
    100110                        } 
    101111                } 
    102112        } 
     113        if (vol != 0.0 && norm != 0.0) { 
     114                //Re-normalize by avg volume 
     115                sum = sum/(vol/norm);} 
     116 
    103117        return sum/norm + background(); 
    104118} 
     
    145159        double sum = 0.0; 
    146160        double norm = 0.0; 
     161        double norm_vol = 0.0; 
     162        double vol = 0.0; 
    147163 
    148164        // Loop over core radius weight points 
     
    166182                                for(int l=0; l< (int)weights_phi.size(); l++) { 
    167183                                        dp.axis_phi = weights_phi[l].value; 
    168  
     184                                        //Un-normalize by volume 
    169185                                        double _ptvalue = weights_core_radius[i].weight 
    170186                                                * weights_length[j].weight 
     
    172188                                                * weights_theta[k].weight 
    173189                                                * weights_phi[l].weight 
    174                                                 * hollow_cylinder_analytical_2DXY(&dp, qx, qy); 
     190                                                * hollow_cylinder_analytical_2DXY(&dp, qx, qy) 
     191                                                * (pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2)) 
     192                                                * weights_length[j].value; 
    175193                                        if (weights_theta.size()>1) { 
    176194                                                _ptvalue *= sin(weights_theta[k].value); 
    177195                                        } 
    178196                                        sum += _ptvalue; 
     197                                        //Find average volume 
     198                                        vol += weights_core_radius[i].weight 
     199                                                * weights_length[j].weight 
     200                                                * weights_radius[k].weight 
     201                                                * (pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2)) 
     202                                                * weights_length[j].value; 
     203                                        //Find norm for volume 
     204                                        norm_vol += weights_core_radius[i].weight 
     205                                                * weights_length[j].weight 
     206                                                * weights_radius[m].weight; 
    179207 
    180208                                        norm += weights_core_radius[i].weight 
     
    193221        // integration (see documentation). 
    194222        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     223        if (vol != 0.0 && norm_vol != 0.0) { 
     224                //Re-normalize by avg volume 
     225                sum = sum/(vol/norm_vol);} 
    195226        return sum/norm + background(); 
    196227} 
Note: See TracChangeset for help on using the changeset viewer.