Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
fixes to one more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dilawar Singh committed Apr 4, 2020
1 parent c90986a commit 349f8ea
Showing 1 changed file with 14 additions and 31 deletions.
45 changes: 14 additions & 31 deletions tests/py_rdesigneur/test_76_func_func_control_reac_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,42 +64,25 @@ def test_reac_rates():
moose.reinit()
moose.start(10)

E = (np.array([0.76793869, 0.69093771, 0.61740932, 0.55290337, 0.50043755,
0.46090277, 0.43395074, 0.41882627, 0.41492281, 0.42206285,
0.4405646 , 0.47111808, 0.51443061, 0.57058404, 0.63814939,
0.71337226, 0.79003606, 0.86055299, 0.91814872, 0.95908718,
0.9836508 , 0.99540289, 0.99934529, 0.99998887, 0.99999589,
1. , 1.19866933, 1.38941834, 1.56464247, 1.71735609,
1.84147098, 1.93203909, 1.98544973, 1.9995736 , 1.97384763,
1.90929743, 1.8084964 , 1.67546318, 1.51550137, 1.33498815,
1.14112001, 0.94162586, 0.7444589 , 0.55747956, 0.38814211,
0.2431975 , 0.12842423, 0.04839793, 0.006309 , 0.00383539]),
np.array([1.35368806e-01, 1.74391515e-01, 2.08263083e-01, 2.34835055e-01,
2.53957994e-01, 2.66695461e-01, 2.74465660e-01, 2.78476408e-01,
2.79468906e-01, 2.77640055e-01, 2.72631277e-01, 2.63551810e-01,
2.49094224e-01, 2.27869755e-01, 1.99072915e-01, 1.63375068e-01,
1.23566311e-01, 8.42635843e-02, 5.04491469e-02, 2.55522217e-02,
1.02890632e-02, 2.90344842e-03, 4.13990858e-04, 7.03942852e-06,
2.60159221e-06, 0.00000000e+00, 0.00000000e+00, 2.22044605e-16,
0.00000000e+00, 0.00000000e+00, 2.22044605e-16, 2.22044605e-16,
2.22044605e-16, 2.22044605e-16, 4.44089210e-16, 0.00000000e+00,
2.22044605e-16, 2.22044605e-16, 0.00000000e+00, 2.22044605e-16,
2.22044605e-16, 0.00000000e+00, 1.11022302e-16, 0.00000000e+00,
0.00000000e+00, 2.77555756e-17, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00]))



A = []
for t in moose.wildcardFind('/##[TYPE=Table2]'):
A.append(t.vector)

m = np.mean(A, axis=1)
u = np.std(A, axis=1)
m0, u0 = np.mean(A, axis=0), np.std(A, axis=0)
m1, u1 = np.mean(A, axis=1), np.std(A, axis=1)

a, b = m0.mean(), m0.std()
assert np.allclose((0.8839693450611644, 0.06768440311215577), (a,b)), (a,b)

a, b = m1.mean(), m1.std()
assert np.allclose((0.8839693450611644, 0.1160306549388357), (a,b)), (a,b)

a, b = u0.mean(), u0.std()
assert np.allclose((0.11603065493883559, 0.06768440311215572), (a,b)), (a,b)

a, b = u1.mean(), u1.std()
assert np.allclose((0.06768440311215573, 0.06768440311215573),(a,b)), (a,b)

# multithreaded version given different results.
assert np.allclose(m, E[0], rtol=1e-3), (m-E[0])
assert np.allclose(u, E[1], rtol=1e-3), (u-E[1])
print('all done')

if __name__ == '__main__':
Expand Down

0 comments on commit 349f8ea

Please sign in to comment.