source: sasmodels/example/laplace.py @ c5b059c

Last change on this file since c5b059c was c5b059c, checked in by Paul Kienzle <pkienzle@…>, 4 years ago

add laplace and cyclic gaussian example distributions

  • Property mode set to 100644
File size: 465 bytes
Line 
1import numpy as np
2from scipy.stats import laplace
3
4from sasmodels import weights
5
6class Dispersion(weights.Dispersion):
7    r"""
8    Laplace distribution
9
10    .. math::
11
12        w(x) = e^{-\sigma |x - \mu|}
13    """
14    type = "laplace"
15    default = dict(npts=35, width=0, nsigmas=3)  # default values
16    def _weights(self, center, sigma, lb, ub):
17        x = self._linspace(center, sigma, lb, ub)
18        wx = laplace.pdf(x, center, sigma)
19        return x, wx
20
Note: See TracBrowser for help on using the repository browser.