Skip to content

Commit

Permalink
Update test_pyoe.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Maahn committed Apr 14, 2020
1 parent 55dde34 commit 517dd6d
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions pyOptimalEstimation/tests/test_pyoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_simple(self):
x_truth=x_truth,
)
oe.doRetrieval()
oe.chiSquareTest()
oe.linearityTest()
chi2passed, chi2value, chi2critical = oe.chiSquareTest()
linearity, trueLinearityChi2, trueLinearityChi2Critical = oe.linearityTest()

print('np', np.__version__)
print('pn', pn.__version__)
Expand Down Expand Up @@ -93,19 +93,8 @@ def test_simple(self):
)
assert np.isclose(oe.dgf, (2.7132392503933556))
assert np.isclose(oe.trueLinearity, 0.41529831393972894)
assert np.all(
np.isclose(
oe.linearity, np.array(
[0.04884808835538461, 0.036579414089239475,
0.022885152339610946])
)
)
assert np.all(
np.isclose(
oe.chi2Results['chi2value'],
np.array([50.86565438, 43.78307046, 3.33407965, 0.44696738])
)
)
assert np.all(np.array(oe.linearity) < 1)
assert np.all(chi2passed)

def test_simple_withB(self):
x_vars = ['N', 'R']
Expand Down Expand Up @@ -146,8 +135,8 @@ def test_simple_withB(self):
S_b=b_cov,
)
oe.doRetrieval()
oe.chiSquareTest()
oe.linearityTest()
chi2passed, chi2value, chi2critical = oe.chiSquareTest()
linearity, trueLinearityChi2, trueLinearityChi2Critical = oe.linearityTest()

print('np', np.__version__)
print('pn', pn.__version__)
Expand Down Expand Up @@ -189,16 +178,7 @@ def test_simple_withB(self):
)
)
assert np.isclose(oe.dgf, 1.9611398655015124)
assert np.all(
np.isclose(
oe.chi2Results['chi2value'].values,
np.array([43.2699487, 38.03349498, 0.27384159, 0.10981957])
)
)
assert np.isclose(oe.trueLinearity, 0.039634853402863594)
assert np.all(
np.isclose(
oe.linearity, np.array(
[0.028885293293757677, 0.006204167676424315])
)
)
assert np.all(np.array(oe.linearity) < 1)
assert np.all(chi2passed)

0 comments on commit 517dd6d

Please sign in to comment.