Commit 1bf53b37 authored by Aaron Jones's avatar Aaron Jones

Handled zeros

parent e0d98137
......@@ -140,6 +140,9 @@ def diff(katfile,finesse3=False):
diff = np.any(rel_diff >= diff_rel_eps)
# Check that all the zeros in the ref array are close to zero
zeros_check = np.any(np.abs(out_arr[np.logical_not(nzix)]) >= diff_rel_eps)
if diff:
diffFound = True
......@@ -152,6 +155,10 @@ def diff(katfile,finesse3=False):
print('Max relative difference: '+str(np.max(rel_diff)))
raise DiffException("Difference larger than " + str(diff_rel_eps), katfile)
elif zeros_check:
diffFound = True
raise DiffException("Value was supposed to be zero and was larger than " + str(diff_rel_eps), katfile)
else:
mx = np.max(rel_diff)
print("All differences smaller than " + str(diff_rel_eps))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment