From 1cbbc68e8babb77e153ef6ec9f8dfbb526c09c61 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 20 Dec 2021 11:46:05 +0100 Subject: [PATCH 1/2] test criterion for correlated fit relaxed --- tests/fits_test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/fits_test.py b/tests/fits_test.py index 8a9e0843..8a1759cb 100644 --- a/tests/fits_test.py +++ b/tests/fits_test.py @@ -93,10 +93,9 @@ def test_correlated_fit(): r = np.zeros((N, N)) for i in range(N): for j in range(N): - r[i, j] = np.exp(-0.1 * np.fabs(i - j)) + r[i, j] = np.exp(-0.8 * np.fabs(i - j)) errl = np.sqrt([3.4, 2.5, 3.6, 2.8, 4.2, 4.7, 4.9, 5.1, 3.2, 4.2]) - errl *= 4 for i in range(N): for j in range(N): r[i, j] *= errl[i] * errl[j] @@ -127,7 +126,7 @@ def test_correlated_fit(): for i in range(2): diff = fitp[i] - fitpc[i] diff.gamma_method() - assert(diff.is_zero_within_error(sigma=1.5)) + assert(diff.is_zero_within_error(sigma=5)) def test_total_least_squares(): From b50346dcf3504f64befce95fbcd0b38b55bdb5d9 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Tue, 21 Dec 2021 20:28:08 +0100 Subject: [PATCH 2/2] feat: rank4 epsilon tensor added --- pyerrors/input/hadrons.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyerrors/input/hadrons.py b/pyerrors/input/hadrons.py index efe4feb1..e139f2b2 100644 --- a/pyerrors/input/hadrons.py +++ b/pyerrors/input/hadrons.py @@ -298,6 +298,18 @@ def read_Fourquark_hd5(path, filestem, ens_id, idl=None, vertices=["VA", "AV"]): return result_dict +def _epsilon_tensor(i, j, k, o): + """Rank-4 epsilon tensor + + Extension of https://codegolf.stackexchange.com/a/160375 + """ + test_set = set((i, j, k, o)) + if not (test_set <= set((1, 2, 3, 4)) or test_set <= set((0, 1, 2, 3))): + raise Exception("Unexpected input", i, j, k, o) + + return (i - j) * (j - k) * (k - i) * (i - o) * (j - o) * (o - k) / 12 + + def _get_lorentz_names(name): assert len(name) == 2