Changeset a5e14410 in sasview for sansmodels/src


Ignore:
Timestamp:
Sep 16, 2011 4:48:48 PM (13 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:
b9958b3
Parents:
fafdfd3
Message:

safer default values for polydispersion and lognormal fix

File:
1 edited

Legend:

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

    r0ad5703 ra5e14410  
    9191 
    9292GaussianDispersion :: GaussianDispersion() { 
    93         npts  = 11; 
     93        npts  = 100; 
    9494        width = 0.0; 
    95         nsigmas = 2.5; 
     95        nsigmas = 10; 
    9696}; 
    9797 
     
    123123                width = 0.0; 
    124124                npts  = 1; 
    125                 nsigmas = 2.5; 
     125                nsigmas = 10; 
    126126        } 
    127127 
     
    158158 
    159159RectangleDispersion :: RectangleDispersion() { 
    160         npts  = 11; 
     160        npts  = 100; 
    161161        width = 0.0; 
    162162        nsigmas = 1.73205; 
     
    228228 
    229229LogNormalDispersion :: LogNormalDispersion() { 
    230         npts  = 15; 
     230        npts  = 100; 
    231231        width = 0.0; 
    232         nsigmas = 4.0; 
     232        nsigmas = 10.0; 
    233233}; 
    234234 
     
    243243 
    244244        double sigma2 = pow(sigma, 2.0); 
    245         return 1.0/(x*sigma) * exp( -pow((log(x) -log(mean)), 2.0) / (2.0*sigma2)); 
     245        return 1.0/(x*sigma) * exp( -pow((log(x) - mean), 2.0) / (2.0*sigma2)); 
    246246 
    247247} 
     
    259259                width = 0.0; 
    260260                npts  = 1; 
    261                 nsigmas = 4.0; 
     261                nsigmas = 10.0; 
    262262        } 
    263263 
     
    265265        double value = (*par)(); 
    266266        double sig; 
     267        double log_value; 
    267268        if (npts<2) { 
    268269                weights.insert(weights.end(), WeightPoint(value, 1.0)); 
     
    272273                        if ((*par).has_min==false){ 
    273274                                // sig  for angles 
    274                                 sig = width / value; 
     275                                sig = width; 
    275276                        } 
    276277                        else{ 
    277278                                // by lognormal definition, PD is same as sigma 
    278                                 sig = width; 
    279                         } 
    280  
     279                                sig = width * value; 
     280                        } 
     281                         
    281282                        // We cover n(nsigmas) times sigmas on each side of the mean 
     283                        //constant bin in real space 
    282284                        double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas); 
    283  
     285                        // sigma in the lognormal function is in ln(R) space, thus needs converting 
     286                        sig = fabs(sig/value);  
    284287                        if ( ((*par).has_min==false || val>(*par).min) 
    285288                          && ((*par).has_max==false || val<(*par).max)  ) { 
    286                                 double _w = lognormal_weight(value, sig, val); 
     289                                double _w = lognormal_weight(log(value), sig, val); 
    287290                                weights.insert(weights.end(), WeightPoint(val, _w)); 
     291                                //printf("%g \t %g\n",val,_w); 
     292 
    288293                        } 
    289294                } 
     
    298303 
    299304SchulzDispersion :: SchulzDispersion() { 
    300         npts  = 11; 
     305        npts  = 100; 
    301306        width = 0.0; 
    302         nsigmas = 3.0; 
     307        nsigmas = 10.0; 
    303308}; 
    304309 
     
    332337                width = 0.0; 
    333338                npts  = 1; 
    334                 nsigmas = 3.0; 
     339                nsigmas = 10.0; 
    335340        } 
    336341 
Note: See TracChangeset for help on using the changeset viewer.