Commit 2ae3306b authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added an option to the difffloat script to ignore a certain column if the...

Added an option to the difffloat script to ignore a certain column if the numbers are too close to 0. Used this feature for the test27perturbed column rho_dh
parent ccbd33df
......@@ -35,13 +35,18 @@ file1 = sys.argv[1]
file2 = sys.argv[2]
number_to_check = -1
if len(sys.argv) == 5:
number_to_check = int(sys.argv[4])
fileTol = ""
if len(sys.argv) >= 4:
fileTol = sys.argv[3]
if len(sys.argv) >= 5:
number_to_check = int(sys.argv[4])
if len(sys.argv) == 6:
ignoreSmallRhoDh = int(sys.argv[5])
else:
ignoreSmallRhoDh = 0
data1 = loadtxt(file1)
data2 = loadtxt(file2)
if fileTol != "":
......@@ -102,8 +107,11 @@ for i in range(n_lines_to_check):
print ""
error = True
if abs(data1[i,j]) < 1e-6 and + abs(data2[i,j]) < 1e-6 : continue
if abs(data1[i,j]) + abs(data2[i,j]) < 1e-6 : continue
# Ignore pathological cases with rho_dh
if ignoreSmallRhoDh and j == 8 and abs(data1[i,j]) < 2e-4: 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])
......
......@@ -10,7 +10,7 @@ do
if [ -e brute_force_27_perturbed.dat ]
then
python @srcdir@/difffloat.py brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat @srcdir@/tolerance_27_perturbed.dat 6
python @srcdir@/difffloat.py brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat @srcdir@/tolerance_27_perturbed.dat 6 1
else
exit 1
fi
......
# ID pos_x pos_y pos_z v_x v_y v_z rho rho_dh wcount wcount_dh div_v curl_vx curl_vy curl_vz
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1.2e-6 1e-4 5e-5 2e-3 3.1e-6 3e-6 3e-6 3e-6
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1.2e-2 1e-5 1e-4 2e-5 2e-3 2e-3 2e-3
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-3 1e-5 1e-4 2e-5 2e-3 2e-3 2e-3
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