Skip to content
Snippets Groups Projects
Commit 8b020888 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Updated diffing script to only check relative differences if the numbers are larger than 1e-6.

parent 6d077c19
No related branches found
No related tags found
No related merge requests found
......@@ -89,13 +89,12 @@ for i in range(n_lines_to_check):
abs_diff = abs(data1[i,j] - data2[i,j])
sum = abs(data1[i,j] + data2[i,j])
if abs(data1[i,j]) + abs(data2[i,j]) < 2.5e-7: continue
if sum > 0:
rel_diff = abs(data1[i,j] - data2[i,j]) / sum
else:
rel_diff = 0.
if( abs_diff > absTol[j]):
if( abs_diff > 1.1*absTol[j]):
print "Absolute difference larger than tolerance (%e) for particle %d, column %d:"%(absTol[j], i,j)
print "%10s: a = %e"%("File 1", data1[i,j])
print "%10s: b = %e"%("File 2", data2[i,j])
......@@ -103,7 +102,9 @@ for i in range(n_lines_to_check):
print ""
error = True
if( rel_diff > relTol[j]):
if abs(data1[i,j]) < 1e-6 and + abs(data2[i,j]) < 1e-6 : continue
if( rel_diff > 1.1*relTol[j]):
print "Relative difference larger than tolerance (%e) for particle %d, column %d:"%(relTol[j], i,j)
print "%10s: a = %e"%("File 1", data1[i,j])
print "%10s: b = %e"%("File 2", data2[i,j])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment