Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for field in expected_results.keys():
if field == 'diagnosis':
for subfield in ['J', 'xdot']:
check_results(rdata, subfield,
expected_results[field][subfield][()],
assert_fun, 1e-8, 1e-8)
else:
if field == 's2llh':
check_results(rdata, field, expected_results[field][()],
assert_fun, 1e-4, 1e-3)
else:
check_results(rdata, field, expected_results[field][()],
assert_fun, atol, rtol)
for attr in expected_results.attrs.keys():
check_results(rdata, attr, expected_results.attrs[attr], assert_fun,
atol, rtol)
rtol: relative tolerance
"""
if expected_results.attrs['status'][0] != 0:
assert rdata['status'] == expected_results.attrs['status'][0]
return
for field in expected_results.keys():
if field == 'diagnosis':
for subfield in ['J', 'xdot']:
check_results(rdata, subfield,
expected_results[field][subfield][()],
assert_fun, 1e-8, 1e-8)
else:
if field == 's2llh':
check_results(rdata, field, expected_results[field][()],
assert_fun, 1e-4, 1e-3)
else:
check_results(rdata, field, expected_results[field][()],
assert_fun, atol, rtol)
for attr in expected_results.attrs.keys():
check_results(rdata, attr, expected_results.attrs[attr], assert_fun,
atol, rtol)
Arguments:
rdata: simulation results as returned by amici.runAmiciSimulation
expected_results: stored test results
atol: absolute tolerance
rtol: relative tolerance
"""
if expected_results.attrs['status'][0] != 0:
assert rdata['status'] == expected_results.attrs['status'][0]
return
for field in expected_results.keys():
if field == 'diagnosis':
for subfield in ['J', 'xdot']:
check_results(rdata, subfield,
expected_results[field][subfield][()],
assert_fun, 1e-8, 1e-8)
else:
if field == 's2llh':
check_results(rdata, field, expected_results[field][()],
assert_fun, 1e-4, 1e-3)
else:
check_results(rdata, field, expected_results[field][()],
assert_fun, atol, rtol)
for attr in expected_results.attrs.keys():
check_results(rdata, attr, expected_results.attrs[attr], assert_fun,
atol, rtol)
if expected_results.attrs['status'][0] != 0:
assert rdata['status'] == expected_results.attrs['status'][0]
return
for field in expected_results.keys():
if field == 'diagnosis':
for subfield in ['J', 'xdot']:
check_results(rdata, subfield,
expected_results[field][subfield][()],
assert_fun, 1e-8, 1e-8)
else:
if field == 's2llh':
check_results(rdata, field, expected_results[field][()],
assert_fun, 1e-4, 1e-3)
else:
check_results(rdata, field, expected_results[field][()],
assert_fun, atol, rtol)
for attr in expected_results.attrs.keys():
check_results(rdata, attr, expected_results.attrs[attr], assert_fun,
atol, rtol)