Changed doctest for normndprb into a unittest

master
pbrod 9 years ago
parent 3495621f69
commit 4fd4e5349e

@ -67,7 +67,7 @@ def test_rind():
assert_array_almost_equal(err3, 0.00013838) assert_array_almost_equal(err3, 0.00013838)
assert_array_almost_equal(terr3, 1.00000000e-10) assert_array_almost_equal(terr3, 1.00000000e-10)
E4, err4, terr4 = rind2(Sc2,m2,Blo2,Bup2,indI2,nt=0) E4, err4, terr4 = rind2(Sc2, m2, Blo2, Bup2, indI2, nt=0)
assert_array_almost_equal(E4, 0.24127499) assert_array_almost_equal(E4, 0.24127499)
assert_array_almost_equal(err4, 0.00013838) assert_array_almost_equal(err4, 0.00013838)
assert_array_almost_equal(terr4, 1.00000000e-10) assert_array_almost_equal(terr4, 1.00000000e-10)
@ -123,21 +123,21 @@ def test_prbnormndpc():
def test_prbnormnd(): def test_prbnormnd():
'''
>>> import numpy as np Et = 0.001946 # exact prob.
>>> Et = 0.001946 # # exact prob. n = 5
>>> n = 5 Blo = -np.inf
>>> Blo =-np.inf; Bup=-1.2 Bup = -1.2
>>> m = np.zeros(n); rho = 0.3; m = np.zeros(n)
>>> Sc =(np.ones((n,n))-np.eye(n))*rho+np.eye(n) rho = 0.3
>>> A = np.repeat(Blo,n) Sc = (np.ones((n, n)) - np.eye(n)) * rho + np.eye(n)
>>> B = np.repeat(Bup,n)-m A = np.repeat(Blo, n)
>>> [val,err,inform] = prbnormnd(Sc,A,B) B = np.repeat(Bup, n) - m
>>> np.abs(val-Et)< err [val, err, _inform] = prbnormnd(Sc, A, B)
True assert(np.abs(val - Et) < err)
>>> 'val = %2.5f' % val
'val = 0.00195' t = 'val = %2.5f' % val
''' assert(t == 'val = 0.00195')
def test_cdfnorm2d(): def test_cdfnorm2d():

Loading…
Cancel
Save