Skip to content

Commit

Permalink
🚇👌 Further refinement of test_result_consistency
Browse files Browse the repository at this point in the history
Refine calculation of epsilon for residual check

Should resolve issue signaled in glotaran#896
  • Loading branch information
jsnel committed Dec 12, 2021
1 parent 1f6e1cf commit a115606
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/test_result_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def data_var_test(
eps = np.finfo(np.float32).eps
rtol = 1e-5 # default value of allclose
if expected_var_name.endswith("residual"): # type:ignore[operator]
eps = expected_result["data"].values.max() * 1e-8
eps = np.max(eps, expected_result["data"].values.max() * eps)

if "singular_vectors" in expected_var_name: # type:ignore[operator]
# Sometimes the coords in the (right) singular vectors are swapped
Expand Down Expand Up @@ -235,6 +235,7 @@ def data_var_test(
f"{float(np.sum(abs_diff))} and shape: {expected_var_value.shape}\n"
"Mean difference: "
f"{float(np.sum(abs_diff))/np.prod(expected_var_value.shape)}\n"
f"Using: \n - {rtol=} \n - {eps=} \n - {float_resolution=}"
)

coord_test(
Expand Down

0 comments on commit a115606

Please sign in to comment.