From f56151ccdca3dbb96a6c84b1e0a2b8976b0983d2 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 1 Nov 2021 17:27:48 +0000 Subject: [PATCH] adjusted input routines for sfcf and openQCD --- pyerrors/input/openQCD.py | 10 +++++++++- pyerrors/input/sfcf.py | 22 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pyerrors/input/openQCD.py b/pyerrors/input/openQCD.py index 39135510..9aaf30be 100644 --- a/pyerrors/input/openQCD.py +++ b/pyerrors/input/openQCD.py @@ -65,6 +65,14 @@ def read_rwms(path, prefix, version='2.0', names=None, **kwargs): print('Read reweighting factors from', prefix[:-1], ',', replica, 'replica', end='') + # Adjust replica names to new bookmarking system + if names is None: + rep_names = [] + for entry in ls: + truncated_entry = entry.split('.')[0] + idx = truncated_entry.index('r') + rep_names.append(truncated_entry[:idx] + '|' + truncated_entry[idx:]) + print_err = 0 if 'print_err' in kwargs: print_err = 1 @@ -149,7 +157,7 @@ def read_rwms(path, prefix, version='2.0', names=None, **kwargs): result = [] for t in range(nrw): if names is None: - result.append(Obs(deltas[t], [w.split(".")[0] for w in ls])) + result.append(Obs(deltas[t], rep_names)) else: print(names) result.append(Obs(deltas[t], names)) diff --git a/pyerrors/input/sfcf.py b/pyerrors/input/sfcf.py index 7dd3544e..2513b7f7 100644 --- a/pyerrors/input/sfcf.py +++ b/pyerrors/input/sfcf.py @@ -56,7 +56,12 @@ def read_sfcf(path, prefix, name, **kwargs): if len(new_names) != replica: raise Exception('Names does not have the required length', replica) else: - new_names = ls + # Adjust replica names to new bookmarking system + new_names = [] + for entry in ls: + idx = entry.index('r') + new_names.append(entry[:idx] + '|' + entry[idx:]) + print(replica, 'replica') for i, item in enumerate(ls): print(item) @@ -153,7 +158,12 @@ def read_sfcf_c(path, prefix, name, quarks='.*', noffset=0, wf=0, wf2=0, **kwarg if len(new_names) != replica: raise Exception('Names does not have the required length', replica) else: - new_names = ls + # Adjust replica names to new bookmarking system + new_names = [] + for entry in ls: + idx = entry.index('r') + new_names.append(entry[:idx] + '|' + entry[idx:]) + print('Read', part, 'part of', name, 'from', prefix[:-1], ',', replica, 'replica') for i, item in enumerate(ls): sub_ls = [] @@ -271,6 +281,12 @@ def read_qtop(path, prefix, **kwargs): deltas.append(np.array(tmp)) - result = Obs(deltas, [(w.split('.'))[0] for w in ls]) + rep_names = [] + for entry in ls: + truncated_entry = entry.split('.')[0] + idx = truncated_entry.index('r') + rep_names.append(truncated_entry[:idx] + '|' + truncated_entry[idx:]) + + result = Obs(deltas, rep_names) return result