Last change
on this file since 9ce5bcb was
342b3dd,
checked in by Paul Kienzle <pkienzle@…>, 7 years ago
|
add laplace and cyclic gaussian example distributions in example/weights
|
-
Property mode set to
100644
|
File size:
465 bytes
|
Line | |
---|
1 | import numpy as np |
---|
2 | from scipy.stats import laplace |
---|
3 | |
---|
4 | from sasmodels import weights |
---|
5 | |
---|
6 | class 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.