Changeset c451be9 in sasview for sansmodels/src


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

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

Legend:

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

    rfe9c19b4 rc451be9  
    105105    def __getstate__(self): 
    106106        """ return object state for pickling and copying """ 
    107         print "__dict__",self.__dict__ 
    108         #self.__dict__['params'] = self.params 
    109         #self.__dict__['dispersion'] = self.dispersion 
    110         #self.__dict__['log'] = self.log 
    111107        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    112108         
  • sansmodels/src/sans/models/CoreShellEllipsoidModel.py

    rfe9c19b4 rc451be9  
    100100    def __getstate__(self): 
    101101        """ return object state for pickling and copying """ 
    102         print "__dict__",self.__dict__ 
    103         #self.__dict__['params'] = self.params 
    104         #self.__dict__['dispersion'] = self.dispersion 
    105         #self.__dict__['log'] = self.log 
    106102        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    107103         
  • sansmodels/src/sans/models/CoreShellModel.py

    rfe9c19b4 rc451be9  
    8585    def __getstate__(self): 
    8686        """ return object state for pickling and copying """ 
    87         print "__dict__",self.__dict__ 
    88         #self.__dict__['params'] = self.params 
    89         #self.__dict__['dispersion'] = self.dispersion 
    90         #self.__dict__['log'] = self.log 
    9187        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9288         
  • sansmodels/src/sans/models/CylinderModel.py

    rfe9c19b4 rc451be9  
    8888    def __getstate__(self): 
    8989        """ return object state for pickling and copying """ 
    90         print "__dict__",self.__dict__ 
    91         #self.__dict__['params'] = self.params 
    92         #self.__dict__['dispersion'] = self.dispersion 
    93         #self.__dict__['log'] = self.log 
    9490        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9591         
  • sansmodels/src/sans/models/DiamCylFunc.py

    rfe9c19b4 rc451be9  
    6969    def __getstate__(self): 
    7070        """ return object state for pickling and copying """ 
    71         print "__dict__",self.__dict__ 
    72         #self.__dict__['params'] = self.params 
    73         #self.__dict__['dispersion'] = self.dispersion 
    74         #self.__dict__['log'] = self.log 
    7571        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    7672         
  • sansmodels/src/sans/models/DiamEllipFunc.py

    rfe9c19b4 rc451be9  
    7373    def __getstate__(self): 
    7474        """ return object state for pickling and copying """ 
    75         print "__dict__",self.__dict__ 
    76         #self.__dict__['params'] = self.params 
    77         #self.__dict__['dispersion'] = self.dispersion 
    78         #self.__dict__['log'] = self.log 
    7975        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8076         
  • sansmodels/src/sans/models/EllipsoidModel.py

    rfe9c19b4 rc451be9  
    9292    def __getstate__(self): 
    9393        """ return object state for pickling and copying """ 
    94         print "__dict__",self.__dict__ 
    95         #self.__dict__['params'] = self.params 
    96         #self.__dict__['dispersion'] = self.dispersion 
    97         #self.__dict__['log'] = self.log 
    9894        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9995         
  • sansmodels/src/sans/models/EllipticalCylinderModel.py

    rfe9c19b4 rc451be9  
    8484    def __getstate__(self): 
    8585        """ return object state for pickling and copying """ 
    86         print "__dict__",self.__dict__ 
    87         #self.__dict__['params'] = self.params 
    88         #self.__dict__['dispersion'] = self.dispersion 
    89         #self.__dict__['log'] = self.log 
    9086        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9187         
  • sansmodels/src/sans/models/FlexibleCylinderModel.py

    rfe9c19b4 rc451be9  
    7777    def __getstate__(self): 
    7878        """ return object state for pickling and copying """ 
    79         print "__dict__",self.__dict__ 
    80         #self.__dict__['params'] = self.params 
    81         #self.__dict__['dispersion'] = self.dispersion 
    82         #self.__dict__['log'] = self.log 
    8379        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8480         
  • sansmodels/src/sans/models/Gaussian.py

    rfe9c19b4 rc451be9  
    6868    def __getstate__(self): 
    6969        """ return object state for pickling and copying """ 
    70         print "__dict__",self.__dict__ 
    71         #self.__dict__['params'] = self.params 
    72         #self.__dict__['dispersion'] = self.dispersion 
    73         #self.__dict__['log'] = self.log 
    7470        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    7571         
  • sansmodels/src/sans/models/HardsphereStructure.py

    rfe9c19b4 rc451be9  
    7777    def __getstate__(self): 
    7878        """ return object state for pickling and copying """ 
    79         print "__dict__",self.__dict__ 
    80         #self.__dict__['params'] = self.params 
    81         #self.__dict__['dispersion'] = self.dispersion 
    82         #self.__dict__['log'] = self.log 
    8379        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8480         
  • sansmodels/src/sans/models/HayterMSAStructure.py

    rfe9c19b4 rc451be9  
    8787    def __getstate__(self): 
    8888        """ return object state for pickling and copying """ 
    89         print "__dict__",self.__dict__ 
    90         #self.__dict__['params'] = self.params 
    91         #self.__dict__['dispersion'] = self.dispersion 
    92         #self.__dict__['log'] = self.log 
    9389        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9490         
  • sansmodels/src/sans/models/HollowCylinderModel.py

    rfe9c19b4 rc451be9  
    8383    def __getstate__(self): 
    8484        """ return object state for pickling and copying """ 
    85         print "__dict__",self.__dict__ 
    86         #self.__dict__['params'] = self.params 
    87         #self.__dict__['dispersion'] = self.dispersion 
    88         #self.__dict__['log'] = self.log 
    8985        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9086         
  • sansmodels/src/sans/models/LamellarFFHGModel.py

    rfe9c19b4 rc451be9  
    8383    def __getstate__(self): 
    8484        """ return object state for pickling and copying """ 
    85         print "__dict__",self.__dict__ 
    86         #self.__dict__['params'] = self.params 
    87         #self.__dict__['dispersion'] = self.dispersion 
    88         #self.__dict__['log'] = self.log 
    8985        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9086         
  • sansmodels/src/sans/models/LamellarModel.py

    rfe9c19b4 rc451be9  
    8080    def __getstate__(self): 
    8181        """ return object state for pickling and copying """ 
    82         print "__dict__",self.__dict__ 
    83         #self.__dict__['params'] = self.params 
    84         #self.__dict__['dispersion'] = self.dispersion 
    85         #self.__dict__['log'] = self.log 
    8682        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8783         
  • sansmodels/src/sans/models/LamellarPSHGModel.py

    rfe9c19b4 rc451be9  
    100100    def __getstate__(self): 
    101101        """ return object state for pickling and copying """ 
    102         print "__dict__",self.__dict__ 
    103         #self.__dict__['params'] = self.params 
    104         #self.__dict__['dispersion'] = self.dispersion 
    105         #self.__dict__['log'] = self.log 
    106102        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    107103         
  • sansmodels/src/sans/models/LamellarPSModel.py

    rfe9c19b4 rc451be9  
    9393    def __getstate__(self): 
    9494        """ return object state for pickling and copying """ 
    95         print "__dict__",self.__dict__ 
    96         #self.__dict__['params'] = self.params 
    97         #self.__dict__['dispersion'] = self.dispersion 
    98         #self.__dict__['log'] = self.log 
    9995        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    10096         
  • sansmodels/src/sans/models/LogNormal.py

    rfe9c19b4 rc451be9  
    6868    def __getstate__(self): 
    6969        """ return object state for pickling and copying """ 
    70         print "__dict__",self.__dict__ 
    71         #self.__dict__['params'] = self.params 
    72         #self.__dict__['dispersion'] = self.dispersion 
    73         #self.__dict__['log'] = self.log 
    7470        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    7571         
  • sansmodels/src/sans/models/Lorentzian.py

    rfe9c19b4 rc451be9  
    6868    def __getstate__(self): 
    6969        """ return object state for pickling and copying """ 
    70         print "__dict__",self.__dict__ 
    71         #self.__dict__['params'] = self.params 
    72         #self.__dict__['dispersion'] = self.dispersion 
    73         #self.__dict__['log'] = self.log 
    7470        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    7571         
  • sansmodels/src/sans/models/MultiShellModel.py

    rfe9c19b4 rc451be9  
    8686    def __getstate__(self): 
    8787        """ return object state for pickling and copying """ 
    88         print "__dict__",self.__dict__ 
    89         #self.__dict__['params'] = self.params 
    90         #self.__dict__['dispersion'] = self.dispersion 
    91         #self.__dict__['log'] = self.log 
    9288        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9389         
  • sansmodels/src/sans/models/OblateModel.py

    rfe9c19b4 rc451be9  
    9898    def __getstate__(self): 
    9999        """ return object state for pickling and copying """ 
    100         print "__dict__",self.__dict__ 
    101         #self.__dict__['params'] = self.params 
    102         #self.__dict__['dispersion'] = self.dispersion 
    103         #self.__dict__['log'] = self.log 
    104100        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    105101         
  • sansmodels/src/sans/models/ParallelepipedModel.py

    rfe9c19b4 rc451be9  
    8787    def __getstate__(self): 
    8888        """ return object state for pickling and copying """ 
    89         print "__dict__",self.__dict__ 
    90         #self.__dict__['params'] = self.params 
    91         #self.__dict__['dispersion'] = self.dispersion 
    92         #self.__dict__['log'] = self.log 
    9389        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9490         
  • sansmodels/src/sans/models/ProlateModel.py

    rfe9c19b4 rc451be9  
    9494    def __getstate__(self): 
    9595        """ return object state for pickling and copying """ 
    96         print "__dict__",self.__dict__ 
    97         #self.__dict__['params'] = self.params 
    98         #self.__dict__['dispersion'] = self.dispersion 
    99         #self.__dict__['log'] = self.log 
    10096        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    10197         
  • sansmodels/src/sans/models/Schulz.py

    rfe9c19b4 rc451be9  
    7070    def __getstate__(self): 
    7171        """ return object state for pickling and copying """ 
    72         print "__dict__",self.__dict__ 
    73         #self.__dict__['params'] = self.params 
    74         #self.__dict__['dispersion'] = self.dispersion 
    75         #self.__dict__['log'] = self.log 
    7672        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    7773         
  • sansmodels/src/sans/models/SphereModel.py

    rfe9c19b4 rc451be9  
    7979    def __getstate__(self): 
    8080        """ return object state for pickling and copying """ 
    81         print "__dict__",self.__dict__ 
    82         #self.__dict__['params'] = self.params 
    83         #self.__dict__['dispersion'] = self.dispersion 
    84         #self.__dict__['log'] = self.log 
    8581        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8682         
  • sansmodels/src/sans/models/SquareWellStructure.py

    rfe9c19b4 rc451be9  
    8585    def __getstate__(self): 
    8686        """ return object state for pickling and copying """ 
    87         print "__dict__",self.__dict__ 
    88         #self.__dict__['params'] = self.params 
    89         #self.__dict__['dispersion'] = self.dispersion 
    90         #self.__dict__['log'] = self.log 
    9187        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9288         
  • sansmodels/src/sans/models/StackedDisksModel.py

    rfe9c19b4 rc451be9  
    9494    def __getstate__(self): 
    9595        """ return object state for pickling and copying """ 
    96         print "__dict__",self.__dict__ 
    97         #self.__dict__['params'] = self.params 
    98         #self.__dict__['dispersion'] = self.dispersion 
    99         #self.__dict__['log'] = self.log 
    10096        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    10197         
  • sansmodels/src/sans/models/StickyHSStructure.py

    rfe9c19b4 rc451be9  
    8585    def __getstate__(self): 
    8686        """ return object state for pickling and copying """ 
    87         print "__dict__",self.__dict__ 
    88         #self.__dict__['params'] = self.params 
    89         #self.__dict__['dispersion'] = self.dispersion 
    90         #self.__dict__['log'] = self.log 
    9187        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    9288         
  • sansmodels/src/sans/models/TriaxialEllipsoidModel.py

    rfe9c19b4 rc451be9  
    8282    def __getstate__(self): 
    8383        """ return object state for pickling and copying """ 
    84         print "__dict__",self.__dict__ 
    85         #self.__dict__['params'] = self.params 
    86         #self.__dict__['dispersion'] = self.dispersion 
    87         #self.__dict__['log'] = self.log 
    8884        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8985         
  • sansmodels/src/sans/models/VesicleModel.py

    rfe9c19b4 rc451be9  
    7979    def __getstate__(self): 
    8080        """ return object state for pickling and copying """ 
    81         print "__dict__",self.__dict__ 
    82         #self.__dict__['params'] = self.params 
    83         #self.__dict__['dispersion'] = self.dispersion 
    84         #self.__dict__['log'] = self.log 
    8581        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
    8682         
  • sansmodels/src/sans/models/c_models/coreshellcylinder.cpp

    r15f52f8 rc451be9  
    8282        double sum = 0.0; 
    8383        double norm = 0.0; 
     84        double vol = 0.0; 
    8485 
    8586        // Loop over radius weight points 
     
    9495                        for(int k=0; k<weights_thick.size(); k++) { 
    9596                                dp[2] = weights_thick[k].value; 
    96  
     97                                //Un-normalize by volume 
    9798                                sum += weights_rad[i].weight 
    9899                                        * weights_len[j].weight 
    99100                                        * weights_thick[k].weight 
    100                                         * CoreShellCylinder(dp, q); 
     101                                        * CoreShellCylinder(dp, q) 
     102                                        * pow(weights_rad[i].value+weights_thick[k].value,2) 
     103                                        *(weights_len[j].value+2.0*weights_thick[k].value); 
     104                                //Find average volume 
     105                                vol += weights_rad[i].weight 
     106                                        * weights_len[j].weight 
     107                                        * weights_thick[k].weight 
     108                                        * pow(weights_rad[i].value+weights_thick[k].value,2) 
     109                                        *(weights_len[j].value+2.0*weights_thick[k].value); 
    101110                                norm += weights_rad[i].weight 
    102111                                * weights_len[j].weight 
     
    105114                } 
    106115        } 
     116 
     117        if (vol != 0.0 && norm != 0.0) { 
     118                //Re-normalize by avg volume 
     119                sum = sum/(vol/norm);} 
     120 
    107121        return sum/norm + background(); 
    108122} 
     
    151165        double sum = 0.0; 
    152166        double norm = 0.0; 
     167        double norm_vol = 0.0; 
     168        double vol = 0.0; 
    153169 
    154170        // Loop over radius weight points 
     
    172188                                for(int l=0; l<weights_phi.size(); l++) { 
    173189                                        dp.axis_phi = weights_phi[l].value; 
    174  
     190                                        //Un-normalize by volume 
    175191                                        double _ptvalue = weights_rad[i].weight 
    176192                                                * weights_len[j].weight 
     
    178194                                                * weights_theta[k].weight 
    179195                                                * weights_phi[l].weight 
    180                                                 * core_shell_cylinder_analytical_2DXY(&dp, qx, qy); 
     196                                                * core_shell_cylinder_analytical_2DXY(&dp, qx, qy) 
     197                                                * pow(weights_rad[i].value+weights_thick[m].value,2) 
     198                                                *(weights_len[j].value+2.0*weights_thick[m].value); 
     199 
    181200                                        if (weights_theta.size()>1) { 
    182201                                                _ptvalue *= sin(weights_theta[k].value); 
    183202                                        } 
    184203                                        sum += _ptvalue; 
     204 
     205                                        //Find average volume 
     206                                        vol += weights_rad[i].weight 
     207                                                        * weights_len[j].weight 
     208                                                        * weights_thick[m].weight 
     209                                                        * pow(weights_rad[i].value+weights_thick[m].value,2) 
     210                                                        *(weights_len[j].value+2.0*weights_thick[m].value); 
     211                                        //Find norm for volume 
     212                                        norm_vol += weights_rad[i].weight 
     213                                                                * weights_len[j].weight 
     214                                                                * weights_thick[m].weight; 
    185215 
    186216                                        norm += weights_rad[i].weight 
     
    199229        // integration (see documentation). 
    200230        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     231 
     232        if (vol != 0.0 && norm_vol != 0.0) { 
     233                //Re-normalize by avg volume 
     234                sum = sum/(vol/norm_vol);} 
     235 
    201236        return sum/norm + background(); 
    202237} 
  • sansmodels/src/sans/models/c_models/coreshellsphere.cpp

    rf9bf661 rc451be9  
    7575        double sum = 0.0; 
    7676        double norm = 0.0; 
     77        double vol = 0.0; 
    7778 
    7879        // Loop over radius weight points 
     
    8384                for(int j=0; j<weights_thick.size(); j++) { 
    8485                        dp[2] = weights_thick[j].value; 
     86                        //Un-normalize SphereForm by volume 
     87                        sum += weights_rad[i].weight 
     88                                * weights_thick[j].weight * CoreShellForm(dp, q)* pow(weights_rad[i].value+weights_thick[j].value,3); 
    8589 
    86                         sum += weights_rad[i].weight 
    87                                 * weights_thick[j].weight * CoreShellForm(dp, q); 
     90                        //Find average volume 
     91                        vol += weights_rad[i].weight * weights_thick[j].weight 
     92                                * pow(weights_rad[i].value+weights_thick[j].value,3); 
    8893                        norm += weights_rad[i].weight 
    8994                                * weights_thick[j].weight; 
    9095                } 
    9196        } 
     97 
     98        if (vol != 0.0 && norm != 0.0) { 
     99                //Re-normalize by avg volume 
     100                sum = sum/(vol/norm);} 
     101 
    92102        return sum/norm + background(); 
    93103} 
  • 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} 
  • sansmodels/src/sans/models/c_models/ellipsoid.cpp

    rf9bf661 rc451be9  
    7373        double sum = 0.0; 
    7474        double norm = 0.0; 
     75        double vol = 0.0; 
    7576 
    7677        // Loop over radius_a weight points 
     
    8182                for(int j=0; j<weights_rad_b.size(); j++) { 
    8283                        dp[2] = weights_rad_b[j].value; 
    83  
     84                        //Un-normalize  by volume 
    8485                        sum += weights_rad_a[i].weight 
    85                                 * weights_rad_b[j].weight * EllipsoidForm(dp, q); 
     86                                * weights_rad_b[j].weight * EllipsoidForm(dp, q) 
     87                                * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 
     88 
     89                        //Find average volume 
     90                        vol += weights_rad_a[i].weight 
     91                                * weights_rad_b[j].weight 
     92                                * pow(weights_rad_b[j].value,2) 
     93                                * weights_rad_a[i].value; 
    8694                        norm += weights_rad_a[i].weight 
    8795                                * weights_rad_b[j].weight; 
    8896                } 
    8997        } 
     98 
     99        if (vol != 0.0 && norm != 0.0) { 
     100                //Re-normalize by avg volume 
     101                sum = sum/(vol/norm);} 
     102 
    90103        return sum/norm + background(); 
    91104} 
     
    127140        double sum = 0.0; 
    128141        double norm = 0.0; 
     142        double norm_vol = 0.0; 
     143        double vol = 0.0; 
    129144 
    130145        // Loop over radius weight points 
     
    144159                                for(int l=0; l<weights_phi.size(); l++) { 
    145160                                        dp.axis_phi = weights_phi[l].value; 
    146  
     161                                        //Un-normalize by volume 
    147162                                        double _ptvalue = weights_rad_a[i].weight 
    148163                                                * weights_rad_b[j].weight 
    149164                                                * weights_theta[k].weight 
    150165                                                * weights_phi[l].weight 
    151                                                 * ellipsoid_analytical_2DXY(&dp, qx, qy); 
     166                                                * ellipsoid_analytical_2DXY(&dp, qx, qy) 
     167                                                * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 
    152168                                        if (weights_theta.size()>1) { 
    153169                                                _ptvalue *= sin(weights_theta[k].value); 
    154170                                        } 
    155171                                        sum += _ptvalue; 
     172                                        //Find average volume 
     173                                        vol += weights_rad_a[i].weight 
     174                                                * weights_rad_b[j].weight 
     175                                                * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 
     176                                        //Find norm for volume 
     177                                        norm_vol += weights_rad_a[i].weight 
     178                                                * weights_rad_b[j].weight; 
    156179 
    157180                                        norm += weights_rad_a[i].weight 
     
    168191        // integration (see documentation). 
    169192        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     193 
     194        if (vol != 0.0 && norm_vol != 0.0) { 
     195                //Re-normalize by avg volume 
     196                sum = sum/(vol/norm_vol);} 
     197 
    170198        return sum/norm + background(); 
    171199} 
  • sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp

    rf9bf661 rc451be9  
    7979        double sum = 0.0; 
    8080        double norm = 0.0; 
     81        double vol = 0.0; 
    8182 
    8283        // Loop over r_minor weight points 
     
    9192                        for(int k=0; k<weights_len.size(); k++) { 
    9293                                dp[3] = weights_len[k].value; 
    93  
     94                                //Un-normalize  by volume 
    9495                                sum += weights_rad[i].weight 
    9596                                        * weights_len[k].weight 
    9697                                        * weights_rat[j].weight 
    97                                         * EllipCyl20(dp, q); 
     98                                        * EllipCyl20(dp, q) 
     99                                        * pow(weights_rad[i].value,2) * weights_rat[j].value 
     100                                        * weights_len[k].value; 
     101                                //Find average volume 
     102                                vol += weights_rad[i].weight 
     103                                        * weights_len[k].weight 
     104                                        * weights_rat[j].weight 
     105                                        * pow(weights_rad[i].value,2) * weights_rat[j].value 
     106                                        * weights_len[k].value; 
    98107                                norm += weights_rad[i].weight 
    99                                 * weights_len[k].weight 
    100                                 * weights_rat[j].weight; 
     108                                        * weights_len[k].weight 
     109                                        * weights_rat[j].weight; 
    101110                        } 
    102111                } 
    103112        } 
     113 
     114        if (vol != 0.0 && norm != 0.0) { 
     115                //Re-normalize by avg volume 
     116                sum = sum/(vol/norm);} 
     117 
    104118        return sum/norm + background(); 
    105119} 
     
    151165        double sum = 0.0; 
    152166        double norm = 0.0; 
     167        double norm_vol = 0.0; 
     168        double vol = 0.0; 
    153169 
    154170        // Loop over minor radius weight points 
     
    176192                                for(int o=0; o<weights_psi.size(); o++) { 
    177193                                        dp.cyl_psi = weights_psi[o].value; 
    178  
     194                                        //Un-normalize by volume 
    179195                                        double _ptvalue = weights_rad[i].weight 
    180196                                                * weights_len[j].weight 
     
    183199                                                * weights_phi[l].weight 
    184200                                                * weights_psi[o].weight 
    185                                                 * elliptical_cylinder_analytical_2DXY(&dp, qx, qy); 
     201                                                * elliptical_cylinder_analytical_2DXY(&dp, qx, qy) 
     202                                                * pow(weights_rad[i].value,2) 
     203                                                * weights_len[j].value 
     204                                                * weights_rat[m].value; 
    186205                                        if (weights_theta.size()>1) { 
    187206                                                _ptvalue *= sin(weights_theta[k].value); 
    188207                                        } 
    189208                                        sum += _ptvalue; 
     209                                        //Find average volume 
     210                                        vol += weights_rad[i].weight 
     211                                                * weights_len[j].weight 
     212                                                * weights_rat[m].weight 
     213                                                * pow(weights_rad[i].value,2) 
     214                                                * weights_len[j].value 
     215                                                * weights_rat[m].value; 
     216                                        //Find norm for volume 
     217                                        norm_vol += weights_rad[i].weight 
     218                                                * weights_len[j].weight 
     219                                                * weights_rat[m].weight; 
    190220 
    191221                                        norm += weights_rad[i].weight 
     
    206236        // integration (see documentation). 
    207237        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     238 
     239        if (vol != 0.0 && norm_vol != 0.0) { 
     240                //Re-normalize by avg volume 
     241                sum = sum/(vol/norm_vol);} 
     242 
    208243        return sum/norm + background(); 
     244 
    209245} 
    210246 
  • sansmodels/src/sans/models/c_models/flexiblecylinder.cpp

    rf9bf661 rc451be9  
    7979        double sum = 0.0; 
    8080        double norm = 0.0; 
     81        double vol = 0.0; 
    8182 
    8283        // Loop over semi axis A weight points 
     
    9192                        for(int k=0; k< (int)weights_rad.size(); k++) { 
    9293                                dp[3] = weights_rad[k].value; 
    93  
     94                                //Un-normalize by volume 
    9495                                sum += weights_len[i].weight 
    95                                         * weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q); 
     96                                        * weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q) 
     97                                        * pow(weights_rad[k].value,2)*weights_len[i].value; 
     98                                //Find average volume 
     99                                vol += weights_rad[k].weight 
     100                                        * weights_len[i].weight 
     101                                        * weights_kuhn[j].weight 
     102                                        *pow(weights_rad[k].value,2)*weights_len[i].value; 
    96103                                norm += weights_len[i].weight 
    97104                                        * weights_kuhn[j].weight*weights_rad[k].weight; 
     
    99106                } 
    100107        } 
     108        if (vol != 0.0 && norm != 0.0) { 
     109                //Re-normalize by avg volume 
     110                sum = sum/(vol/norm);} 
     111 
    101112        return sum/norm + background(); 
    102113} 
  • 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} 
  • sansmodels/src/sans/models/c_models/multishell.cpp

    rf9bf661 rc451be9  
    8080        double sum = 0.0; 
    8181        double norm = 0.0; 
     82        double vol = 0.0; 
    8283 
    8384        // Loop over radius weight points 
     
    8889                        for(int k=0; k< (int)weights_w_thickness.size(); k++){ 
    8990                                dp[3] = weights_w_thickness[k].value; 
    90  
     91                                //Un-normalize SphereForm by volume 
    9192                                sum += weights_core_radius[i].weight*weights_s_thickness[j].weight 
    92                                         *weights_w_thickness[k].weight* MultiShell(dp, q); 
     93                                        *weights_w_thickness[k].weight* MultiShell(dp, q) 
     94                                        *pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3); 
     95                                //Find average volume 
     96                                vol += weights_core_radius[i].weight*weights_s_thickness[j].weight 
     97                                        *weights_w_thickness[k].weight 
     98                                        *pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3); 
    9399                                norm += weights_core_radius[i].weight*weights_s_thickness[j].weight 
    94100                                        *weights_w_thickness[k].weight; 
     
    96102                } 
    97103        } 
     104        if (vol != 0.0 && norm != 0.0) { 
     105                //Re-normalize by avg volume 
     106                sum = sum/(vol/norm);} 
    98107        return sum/norm + background(); 
    99108} 
  • sansmodels/src/sans/models/c_models/parallelepiped.cpp

    rf9bf661 rc451be9  
    8484        double sum = 0.0; 
    8585        double norm = 0.0; 
     86        double vol = 0.0; 
    8687 
    8788        // Loop over short_edgeA weight points 
     
    9697                        for(int k=0; k< (int)weights_long_c.size(); k++) { 
    9798                                dp[3] = weights_long_c[k].value; 
     99                                //Un-normalize  by volume 
    98100                                sum += weights_short_a[i].weight * weights_short_b[j].weight 
    99                                         * weights_long_c[k].weight * Parallelepiped(dp, q); 
     101                                        * weights_long_c[k].weight * Parallelepiped(dp, q) 
     102                                        * weights_short_a[i].value*weights_short_b[j].value 
     103                                        * weights_long_c[k].value; 
     104                                //Find average volume 
     105                                vol += weights_short_a[i].weight * weights_short_b[j].weight 
     106                                        * weights_long_c[k].weight 
     107                                        * weights_short_a[i].value * weights_short_b[j].value 
     108                                        * weights_long_c[k].value; 
    100109 
    101110                                norm += weights_short_a[i].weight 
     
    104113                } 
    105114        } 
     115        if (vol != 0.0 && norm != 0.0) { 
     116                //Re-normalize by avg volume 
     117                sum = sum/(vol/norm);} 
    106118 
    107119        return sum/norm + background(); 
     
    155167        double sum = 0.0; 
    156168        double norm = 0.0; 
     169        double norm_vol = 0.0; 
     170        double vol = 0.0; 
    157171 
    158172        // Loop over radius weight points 
     
    179193                                                for(int n=0; n< (int)weights_parallel_psi.size(); n++) { 
    180194                                                        dp.parallel_psi = weights_parallel_psi[n].value; 
    181  
     195                                                        //Un-normalize by volume 
    182196                                                        double _ptvalue = weights_short_a[i].weight 
    183197                                                                * weights_short_b[j].weight 
     
    186200                                                                * weights_parallel_phi[m].weight 
    187201                                                                * weights_parallel_psi[n].weight 
    188                                                                 * parallelepiped_analytical_2DXY(&dp, qx, qy); 
     202                                                                * parallelepiped_analytical_2DXY(&dp, qx, qy) 
     203                                                                * weights_short_a[i].value*weights_short_b[j].value 
     204                                                                * weights_long_c[k].value; 
     205 
    189206                                                        if (weights_parallel_theta.size()>1) { 
    190207                                                                _ptvalue *= sin(weights_parallel_theta[l].value); 
    191208                                                        } 
    192209                                                        sum += _ptvalue; 
     210                                                        //Find average volume 
     211                                                        vol += weights_short_a[i].weight 
     212                                                                * weights_short_b[j].weight 
     213                                                                * weights_long_c[k].weight 
     214                                                                * weights_short_a[i].value*weights_short_b[j].value 
     215                                                                * weights_long_c[k].value; 
     216                                                        //Find norm for volume 
     217                                                        norm_vol += weights_short_a[i].weight 
     218                                                                * weights_short_b[j].weight 
     219                                                                * weights_long_c[k].weight; 
    193220 
    194221                                                        norm += weights_short_a[i].weight 
     
    209236        // integration (see documentation). 
    210237        if (weights_parallel_theta.size()>1) norm = norm / asin(1.0); 
     238 
     239        if (vol != 0.0 && norm_vol != 0.0) { 
     240                //Re-normalize by avg volume 
     241                sum = sum/(vol/norm_vol);} 
     242 
    211243        return sum/norm + background(); 
    212244} 
  • sansmodels/src/sans/models/c_models/sphere.cpp

    rf9bf661 rc451be9  
    6262        double sum = 0.0; 
    6363        double norm = 0.0; 
     64        double vol = 0.0; 
    6465 
    6566        // Loop over radius weight points 
     
    6768                dp[1] = weights_rad[i].value; 
    6869 
     70                //Un-normalize SphereForm by volume 
    6971                sum += weights_rad[i].weight 
    70                         * SphereForm(dp, q); 
     72                        * SphereForm(dp, q) * pow(weights_rad[i].value,3); 
     73                //Find average volume 
     74                vol += weights_rad[i].weight 
     75                        * pow(weights_rad[i].value,3); 
     76 
    7177                norm += weights_rad[i].weight; 
    7278        } 
     79 
     80        if (vol != 0.0 && norm != 0.0) { 
     81                //Re-normalize by avg volume 
     82                sum = sum/(vol/norm);} 
    7383        return sum/norm + background(); 
    7484} 
  • 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} 
  • 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} 
  • sansmodels/src/sans/models/c_models/triaxialellipsoid.cpp

    rf9bf661 rc451be9  
    8181        double sum = 0.0; 
    8282        double norm = 0.0; 
     83        double vol = 0.0; 
    8384 
    8485        // Loop over semi axis A weight points 
     
    9394                        for(int k=0; k< (int)weights_semi_axisC.size(); k++) { 
    9495                                dp[3] = weights_semi_axisC[k].value; 
    95  
     96                                //Un-normalize  by volume 
    9697                                sum += weights_semi_axisA[i].weight 
    97                                         * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight* TriaxialEllipsoid(dp, q); 
     98                                        * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight* TriaxialEllipsoid(dp, q) 
     99                                        * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 
     100                                //Find average volume 
     101                                vol += weights_semi_axisA[i].weight 
     102                                        * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight 
     103                                        * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 
     104 
    98105                                norm += weights_semi_axisA[i].weight 
    99106                                        * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight; 
     
    101108                } 
    102109        } 
     110        if (vol != 0.0 && norm != 0.0) { 
     111                //Re-normalize by avg volume 
     112                sum = sum/(vol/norm);} 
     113 
    103114        return sum/norm + background(); 
    104115} 
     
    150161        double sum = 0.0; 
    151162        double norm = 0.0; 
     163        double norm_vol = 0.0; 
     164        double vol = 0.0; 
    152165 
    153166        // Loop over semi axis A weight points 
     
    173186                                                for(int n=0; n <(int)weights_psi.size(); n++) { 
    174187                                                        dp.axis_psi = weights_psi[n].value; 
    175  
     188                                                        //Un-normalize  by volume 
    176189                                                        double _ptvalue = weights_semi_axisA[i].weight 
    177190                                                                * weights_semi_axisB[j].weight 
     
    180193                                                                * weights_phi[m].weight 
    181194                                                                * weights_psi[n].weight 
    182                                                                 * triaxial_ellipsoid_analytical_2DXY(&dp, qx, qy); 
     195                                                                * triaxial_ellipsoid_analytical_2DXY(&dp, qx, qy) 
     196                                                                * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 
    183197                                                        if (weights_theta.size()>1) { 
    184198                                                                _ptvalue *= sin(weights_theta[k].value); 
    185199                                                        } 
    186200                                                        sum += _ptvalue; 
     201                                                        //Find average volume 
     202                                                        vol += weights_semi_axisA[i].weight 
     203                                                                * weights_semi_axisB[j].weight 
     204                                                                * weights_semi_axisC[k].weight 
     205                                                                * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 
     206                                                        //Find norm for volume 
     207                                                        norm_vol += weights_semi_axisA[i].weight 
     208                                                                * weights_semi_axisB[j].weight 
     209                                                                * weights_semi_axisC[k].weight; 
    187210 
    188211                                                        norm += weights_semi_axisA[i].weight 
     
    203226        // integration (see documentation). 
    204227        if (weights_theta.size()>1) norm = norm / asin(1.0); 
     228 
     229        if (vol != 0.0 && norm_vol != 0.0) { 
     230                //Re-normalize by avg volume 
     231                sum = sum/(vol/norm_vol);} 
     232 
    205233        return sum/norm + background(); 
    206234} 
  • sansmodels/src/sans/models/c_models/vesicle.cpp

    rf9bf661 rc451be9  
    7171        double sum = 0.0; 
    7272        double norm = 0.0; 
     73        double vol = 0.0; 
    7374 
    7475        // Loop over radius weight points 
     
    7879                        dp[2] = weights_thickness[j].value; 
    7980                        sum += weights_radius[i].weight 
    80                                 * weights_thickness[j].weight * VesicleForm(dp, q); 
     81                                * weights_thickness[j].weight * VesicleForm(dp, q) 
     82                                *(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3)); 
     83                        //Find average volume 
     84                        vol += weights_radius[i].weight * weights_thickness[j].weight 
     85                                *(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3)); 
    8186                        norm += weights_radius[i].weight * weights_thickness[j].weight; 
    8287                } 
    8388        } 
     89        if (vol != 0.0 && norm != 0.0) { 
     90                //Re-normalize by avg volume 
     91                sum = sum/(vol/norm);} 
     92 
    8493        return sum/norm + background(); 
    8594} 
Note: See TracChangeset for help on using the changeset viewer.