Skip to content
Snippets Groups Projects
Commit e38e2cf9 authored by Matthijs van der Wild's avatar Matthijs van der Wild
Browse files

Improved error handling

Former-commit-id: 82018ffe [formerly 436d0cca]
Former-commit-id: c2b5e634
Former-commit-id: 93f1fd05
parent a8a1cffb
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ def main(check, control):
control_path : str
Path to control results directory
"""
error = False
#Check that all expected output files are present
dcmp = dircmp(check, control)
......@@ -30,6 +31,7 @@ def main(check, control):
if len(dcmp.right_only) > 0:
print('ERROR: The following files are present in the control but not in the '
'output: {}'.format(dcmp.right_only))
error = True
check_path = check + '/cal_values/cal_solutions.h5'
control_path = control + '/cal_values/cal_solutions.h5'
......@@ -65,6 +67,7 @@ def main(check, control):
axis=freq_axis_index)
if not np.allclose(check_soltabval, matching_vals,
rtol=1e-03, atol=1e-03, equal_nan=True):
error = True
print("Val array of soltab {} does not match the control".format(soltabname))
with open("check_soltab.{}.val".format(soltabname), "w") as f:
f.write(str(check_soltabval[:]))
......@@ -74,7 +77,7 @@ def main(check, control):
print("Val array of soltab {} matches the control".format(soltabname))
check_h5.close()
control_h5.close()
sys.exit(0)
sys.exit(error)
if __name__ == '__main__':
descriptiontext = "Checks the output of a workflow run.\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment