Ignore:
Timestamp:
Jan 7, 2010 3: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/spheroid.cpp

    rf9bf661 rc451be9  
    9191        double sum = 0.0; 
    9292        double norm = 0.0; 
     93        double vol = 0.0; 
    9394 
    9495        // Loop over major core weight points 
     
    107108                                for(int l=0; l<(int)weights_polar_shell.size(); l++) { 
    108109                                        dp[4] = weights_polar_shell[l].value; 
    109  
     110                                        //Un-normalize  by volume 
    110111                                        sum += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight 
    111                                                 * weights_polar_shell[l].weight * ProlateForm(dp, q); 
     112                                                * weights_polar_shell[l].weight * ProlateForm(dp, q) 
     113                                                * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 
     114                                        //Find average volume 
     115                                        vol += weights_equat_core[i].weight* weights_polar_core[j].weight 
     116                                                * weights_equat_shell[k].weight 
     117                                                * weights_polar_shell[l].weight 
     118                                                * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 
    112119                                        norm += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight 
    113120                                                        * weights_polar_shell[l].weight; 
     
    116123                } 
    117124        } 
     125        if (vol != 0.0 && norm != 0.0) { 
     126                //Re-normalize by avg volume 
     127                sum = sum/(vol/norm);} 
    118128        return sum/norm + background(); 
    119129} 
     
    194204        double sum = 0.0; 
    195205        double norm = 0.0; 
     206        double norm_vol = 0.0; 
     207        double vol = 0.0; 
    196208 
    197209        // Loop over major core weight points 
     
    218230                                                for(int n=0; n< (int)weights_phi.size(); n++) { 
    219231                                                        dp.axis_phi = weights_phi[n].value; 
    220  
     232                                                        //Un-normalize by volume 
    221233                                                        double _ptvalue = weights_equat_core[i].weight *weights_polar_core[j].weight 
    222234                                                                * weights_equat_shell[k].weight * weights_polar_shell[l].weight 
    223235                                                                * weights_theta[m].weight 
    224236                                                                * weights_phi[n].weight 
    225                                                                 * spheroid_analytical_2DXY(&dp, qx, qy); 
     237                                                                * spheroid_analytical_2DXY(&dp, qx, qy) 
     238                                                                * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 
    226239                                                        if (weights_theta.size()>1) { 
    227240                                                                _ptvalue *= sin(weights_theta[m].value); 
    228241                                                        } 
    229242                                                        sum += _ptvalue; 
     243                                                        //Find average volume 
     244                                                        vol += weights_equat_shell[k].weight 
     245                                                                * weights_polar_shell[l].weight 
     246                                                                * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 
     247                                                        //Find norm for volume 
     248                                                        norm_vol += weights_equat_shell[k].weight 
     249                                                                * weights_polar_shell[l].weight; 
    230250 
    231251                                                        norm += weights_equat_core[i].weight *weights_polar_core[j].weight 
     
    242262        // integration (see documentation). 
    243263        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     264 
     265        if (vol != 0.0 && norm_vol != 0.0) { 
     266                //Re-normalize by avg volume 
     267                sum = sum/(vol/norm_vol);} 
     268 
    244269        return sum/norm + background(); 
    245270} 
Note: See TracChangeset for help on using the changeset viewer.