diff --git a/examples/plot_gravity_checks.py b/examples/plot_gravity_checks.py index ca4e17c7c8a012c6e5aa33ecc585e7ad35a46e27..1a3d1b014ea38240899e7b0060c267aecadeb67e 100644 --- a/examples/plot_gravity_checks.py +++ b/examples/plot_gravity_checks.py @@ -200,12 +200,18 @@ for i in range(num_order): print "Comparing different positions ! max difference:" index = np.argmax(exact_pos[:,0]**2 + exact_pos[:,1]**2 + exact_pos[:,2]**2 - pos[:,0]**2 - pos[:,1]**2 - pos[:,2]**2) print "SWIFT (id=%d):"%ids[index], pos[index,:], "exact (id=%d):"%exact_ids[index], exact_pos[index,:], "\n" - # Compute the error norm diff = exact_a - a_grav diff_pot = exact_pot - pot + # Correct for different normalization of potential + print "Difference in normalization of potential:", np.mean(diff_pot), + print "std_dev=", np.std(diff_pot), "99-percentile:", np.percentile(diff_pot, 99)-np.median(diff_pot), "1-percentile:", np.median(diff_pot) - np.percentile(diff_pot, 1) + + exact_pot -= np.mean(diff_pot) + diff_pot = exact_pot - pot + norm_diff = np.sqrt(diff[:,0]**2 + diff[:,1]**2 + diff[:,2]**2) norm_error = norm_diff / exact_a_norm