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

    rf9bf661 rc451be9  
    8989        double sum = 0.0; 
    9090        double norm = 0.0; 
     91        double vol = 0.0; 
    9192 
    9293        // Loop over length weight points 
     
    101102                        for(int k=0; k< (int)weights_layer_thick.size(); k++) { 
    102103                                dp[3] = weights_layer_thick[k].value; 
    103  
     104                                //Un-normalize by volume 
    104105                                sum += weights_radius[i].weight 
    105                                         * weights_core_thick[j].weight * weights_layer_thick[k].weight* StackedDiscs(dp, q); 
     106                                        * weights_core_thick[j].weight * weights_layer_thick[k].weight* StackedDiscs(dp, q) 
     107                                        *pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value); 
     108                                //Find average volume 
     109                                vol += weights_radius[i].weight 
     110                                        * weights_core_thick[j].weight * weights_layer_thick[k].weight 
     111                                        *pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value); 
    106112                                norm += weights_radius[i].weight 
    107113                                        * weights_core_thick[j].weight* weights_layer_thick[k].weight; 
     
    109115                } 
    110116        } 
     117        if (vol != 0.0 && norm != 0.0) { 
     118                //Re-normalize by avg volume 
     119                sum = sum/(vol/norm);} 
     120 
    111121        return sum/norm + background(); 
    112122} 
     
    157167        double sum = 0.0; 
    158168        double norm = 0.0; 
     169        double norm_vol = 0.0; 
     170        double vol = 0.0; 
    159171 
    160172        // Loop over length weight points 
     
    177189                                                        dp.axis_phi = weights_phi[m].value; 
    178190 
     191                                                        //Un-normalize by volume 
    179192                                                        double _ptvalue = weights_core_thick[i].weight 
    180193                                                                * weights_radius[j].weight 
     
    182195                                                                * weights_theta[l].weight 
    183196                                                                * weights_phi[m].weight 
    184                                                                 * stacked_disks_analytical_2DXY(&dp, qx, qy); 
     197                                                                * stacked_disks_analytical_2DXY(&dp, qx, qy) 
     198                                                                *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value); 
    185199                                                        if (weights_theta.size()>1) { 
    186200                                                                _ptvalue *= sin(weights_theta[l].value); 
    187201                                                        } 
    188202                                                        sum += _ptvalue; 
     203                                                        //Find average volume 
     204                                                        vol += weights_radius[j].weight 
     205                                                                * weights_core_thick[i].weight * weights_layer_thick[k].weight 
     206                                                                *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value); 
     207                                                        //Find norm for volume 
     208                                                        norm_vol += weights_radius[j].weight 
     209                                                                * weights_core_thick[i].weight * weights_layer_thick[k].weight; 
    189210 
    190211                                                        norm += weights_core_thick[i].weight 
     
    202223        // integration (see documentation). 
    203224        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     225        if (vol != 0.0 && norm_vol != 0.0) { 
     226                //Re-normalize by avg volume 
     227                sum = sum/(vol/norm_vol);} 
    204228        return sum/norm + background(); 
    205229} 
Note: See TracChangeset for help on using the changeset viewer.