From f365ca9a2f2e2131679a0756b6bcdcb48c57891f Mon Sep 17 00:00:00 2001 From: Johanna <johanna@zijderveld.de> Date: Tue, 16 Apr 2024 15:35:52 +0200 Subject: [PATCH] add tolerance option to compare_dicts --- codes/tb/tb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codes/tb/tb.py b/codes/tb/tb.py index c943d40..3a17852 100644 --- a/codes/tb/tb.py +++ b/codes/tb/tb.py @@ -20,6 +20,6 @@ def add_tb(tb1, tb2): return {k: tb1.get(k, 0) + tb2.get(k, 0) for k in frozenset(tb1) | frozenset(tb2)} -def compare_dicts(dict1, dict2): +def compare_dicts(dict1, dict2, atol=1e-10): for key in dict1.keys(): - assert np.allclose(dict1[key], dict2[key]) + assert np.allclose(dict1[key], dict2[key], atol=atol) -- GitLab