parent
e1ed205bd2
commit
83bda6890a
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
||||
from wafo.transform.models import TrHermite, TrOchi, TrLinear
|
||||
|
||||
def test_trhermite():
|
||||
'''
|
||||
>>> std = 7./4
|
||||
>>> g = TrHermite(sigma=std, ysigma=std)
|
||||
>>> g.dist2gauss()
|
||||
3.9858776379926808
|
||||
|
||||
>>> g.mean
|
||||
0.0
|
||||
>>> g.sigma
|
||||
1.75
|
||||
>>> g.dat2gauss([0,1,2,3])
|
||||
array([ 0.04654321, 1.03176393, 1.98871279, 2.91930895])
|
||||
|
||||
'''
|
||||
def test_trochi():
|
||||
'''
|
||||
>>> std = 7./4
|
||||
>>> g = TrOchi(sigma=std, ysigma=std)
|
||||
>>> g.dist2gauss()
|
||||
5.9322684525265501
|
||||
>>> g.mean
|
||||
0.0
|
||||
>>> g.sigma
|
||||
1.75
|
||||
>>> g.dat2gauss([0,1,2,3])
|
||||
array([ 6.21927960e-04, 9.90237621e-01, 1.96075606e+00,
|
||||
2.91254576e+00])
|
||||
'''
|
||||
def test_trlinear():
|
||||
'''
|
||||
>>> std = 7./4
|
||||
>>> g = TrLinear(sigma=std, ysigma=std)
|
||||
>>> g.dist2gauss()
|
||||
0.0
|
||||
>>> g.mean
|
||||
0.0
|
||||
>>> g.sigma
|
||||
1.75
|
||||
>>> g.dat2gauss([0,1,2,3])
|
||||
array([ 0., 1., 2., 3.])
|
||||
'''
|
||||
if __name__=='__main__':
|
||||
import doctest
|
||||
doctest.testmod()
|
@ -0,0 +1,32 @@
|
||||
from wafo.transform import TrData
|
||||
|
||||
def test_trdata():
|
||||
'''
|
||||
Construct a linear transformation model
|
||||
>>> import numpy as np
|
||||
>>> sigma = 5; mean = 1
|
||||
>>> u = np.linspace(-5,5); x = sigma*u+mean; y = u
|
||||
>>> g = TrData(y,x)
|
||||
>>> g.mean
|
||||
array([ 1.])
|
||||
>>> g.sigma
|
||||
array([ 5.])
|
||||
|
||||
>>> g = TrData(y,x,mean=1,sigma=5)
|
||||
>>> g.mean
|
||||
1
|
||||
>>> g.sigma
|
||||
5
|
||||
>>> g.dat2gauss(1,2,3)
|
||||
[array([ 0.]), array([ 0.4]), array([ 0.6])]
|
||||
>>> g.dat2gauss([0,1,2,3])
|
||||
array([-0.2, 0. , 0.2, 0.4])
|
||||
|
||||
Check that the departure from a Gaussian model is zero
|
||||
>>> g.dist2gauss() < 1e-16
|
||||
True
|
||||
'''
|
||||
|
||||
if __name__=='__main__':
|
||||
import doctest
|
||||
doctest.testmod()
|
Loading…
Reference in New Issue