Changeset 3d58247 in sasmodels for sasmodels/weights.py


Ignore:
Timestamp:
Jan 12, 2018 8:57:34 AM (6 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.