Changeset 3d58247 in sasmodels


Ignore:
Timestamp:
Jan 12, 2018 8:57:34 AM (7 years ago)
Author:
dirk
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
92d330fd
Parents:
3c44c34
Message:

uniform distribution ignores nsigma

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • doc/guide/pd/polydispersity.rst

    r22279a4 r3d58247  
    7171where $\bar x$ is the mean of the distribution, $w$ is the half-width, and 
    7272*Norm* is a normalization factor which is determined during the numerical 
    73 calculation. 
     73calculation.  
    7474 
    7575Note that the standard deviation and the half width $w$ are different! 
     
    8686 
    8787    Rectangular distribution. 
     88     
     89 
    8890 
    8991Uniform Distribution 
     
    102104    where $\bar x$ is the mean of the distribution, $\sigma$ is the half-width, and 
    103105    *Norm* is a normalization factor which is determined during the numerical 
    104     calculation. 
     106    calculation.  
    105107 
    106108    Note that the polydispersity is given by 
     
    111113 
    112114        Uniform distribution. 
     115         
     116The value $N_\sigma$ is ignored for this distribution.         
    113117 
    114118.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    196200 
    197201Note that larger values of PD might need larger number of points and $N_\sigma$. 
    198 For example, at PD=0.7 and radius=60 |Ang|, Npts>=160 and Nsigmas>=15 at least. 
     202For example, at PD=0.7 and radius=60 |Ang|, Npts>=160 and $N_\sigma$>=15 at least. 
    199203 
    200204.. figure:: pd_schulz.jpg 
  • sasmodels/weights.py

    r3c44c34 r3d58247  
    106106    """ 
    107107    type = "uniform" 
    108     default = dict(npts=35, width=0, nsigmas=1) 
    109     def _weights(self, center, sigma, lb, ub): 
    110         x = self._linspace(center, sigma, lb, ub) 
    111         x = x[np.fabs(x-center) <= np.fabs(sigma)] 
     108    default = dict(npts=35, width=0, nsigmas=None) 
     109    def _weights(self, center, sigma, lb, ub): 
     110        x = np.linspace(center-sigma, center+sigma, self.npts) 
     111        x = x[(x >= lb) & (x <= ub)] 
    112112        return x, np.ones_like(x) 
    113113 
     
    123123    default = dict(npts=35, width=0, nsigmas=1.73205) 
    124124    def _weights(self, center, sigma, lb, ub): 
    125         x = self._linspace(center, sigma, lb, ub) 
    126         x = x[np.fabs(x-center) <= np.fabs(sigma)*sqrt(3.0)] 
    127         return x, np.ones_like(x) 
    128  
     125         x = self._linspace(center, sigma, lb, ub) 
     126         x = x[np.fabs(x-center) <= np.fabs(sigma)*sqrt(3.0)] 
     127         return x, np.ones_like(x) 
    129128 
    130129class LogNormalDispersion(Dispersion): 
Note: See TracChangeset for help on using the changeset viewer.