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/cylinder.cpp

    rf9bf661 rc451be9  
    7373        double sum = 0.0; 
    7474        double norm = 0.0; 
     75        double vol = 0.0; 
    7576 
    7677        // Loop over radius weight points 
     
    8182                for(int j=0; j<weights_len.size(); j++) { 
    8283                        dp[2] = weights_len[j].value; 
    83  
     84                        //Un-normalize by volume 
    8485                        sum += weights_rad[i].weight 
    85                                 * weights_len[j].weight * CylinderForm(dp, q); 
     86                                * weights_len[j].weight * CylinderForm(dp, q) 
     87                                *pow(weights_rad[i].value,2)*weights_len[j].value; 
     88 
     89                        //Find average volume 
     90                        vol += weights_rad[i].weight 
     91                                * weights_len[j].weight *pow(weights_rad[i].value,2)*weights_len[j].value; 
    8692                        norm += weights_rad[i].weight 
    8793                                * weights_len[j].weight; 
    8894                } 
    8995        } 
     96        if (vol != 0.0 && norm != 0.0) { 
     97                //Re-normalize by avg volume 
     98                sum = sum/(vol/norm);} 
     99 
    90100        return sum/norm + background(); 
    91101} 
     
    127137        double sum = 0.0; 
    128138        double norm = 0.0; 
     139        double norm_vol = 0.0; 
     140        double vol = 0.0; 
    129141 
    130142        // Loop over radius weight points 
     
    144156                                for(int l=0; l<weights_phi.size(); l++) { 
    145157                                        dp.cyl_phi = weights_phi[l].value; 
    146  
     158                                        //Un-normalize by volume 
    147159                                        double _ptvalue = weights_rad[i].weight 
    148160                                                * weights_len[j].weight 
    149161                                                * weights_theta[k].weight 
    150162                                                * weights_phi[l].weight 
    151                                                 * cylinder_analytical_2DXY(&dp, qx, qy); 
     163                                                * cylinder_analytical_2DXY(&dp, qx, qy) 
     164                                                *pow(weights_rad[i].value,2)*weights_len[j].value; 
    152165                                        if (weights_theta.size()>1) { 
    153166                                                _ptvalue *= sin(weights_theta[k].value); 
    154167                                        } 
    155168                                        sum += _ptvalue; 
     169                                        //Find average volume 
     170                                        vol += weights_rad[i].weight 
     171                                                        * weights_len[j].weight 
     172                                                        * pow(weights_rad[i].value,2)*weights_len[j].value; 
     173                                        //Find norm for volume 
     174                                        norm_vol += weights_rad[i].weight 
     175                                                        * weights_len[j].weight; 
    156176 
    157177                                        norm += weights_rad[i].weight 
     
    168188        // integration (see documentation). 
    169189        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     190        if (vol != 0.0 && norm_vol != 0.0) { 
     191                //Re-normalize by avg volume 
     192                sum = sum/(vol/norm_vol);} 
     193 
    170194        return sum/norm + background(); 
    171195} 
Note: See TracChangeset for help on using the changeset viewer.