From 5e5a9df4045b88a88d288a963260993173a08e77 Mon Sep 17 00:00:00 2001 From: jkuhl-uni Date: Fri, 17 Dec 2021 12:08:08 +0100 Subject: [PATCH] hotfix, missing kwarg files in read_rwms method --- pyerrors/input/openQCD.py | 16 +++++++++------- pyerrors/input/utils.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 pyerrors/input/utils.py diff --git a/pyerrors/input/openQCD.py b/pyerrors/input/openQCD.py index f11fb4e6..08bb0223 100644 --- a/pyerrors/input/openQCD.py +++ b/pyerrors/input/openQCD.py @@ -39,13 +39,15 @@ def read_rwms(path, prefix, version='2.0', names=None, **kwargs): if not ls: raise Exception('Error, directory not found') - - # Exclude files with different names - for exc in ls: - if not fnmatch.fnmatch(exc, prefix + '*' + postfix + '.dat'): - ls = list(set(ls) - set([exc])) - if len(ls) > 1: - ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0])) + if 'files' in kwargs: + ls = kwargs.get('files') + else: + # Exclude files with different names + for exc in ls: + if not fnmatch.fnmatch(exc, prefix + '*' + postfix + '.dat'): + ls = list(set(ls) - set([exc])) + if len(ls) > 1: + ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0])) replica = len(ls) if 'r_start' in kwargs: diff --git a/pyerrors/input/utils.py b/pyerrors/input/utils.py new file mode 100644 index 00000000..f4264587 --- /dev/null +++ b/pyerrors/input/utils.py @@ -0,0 +1,15 @@ +import fnmatch + +def check_missing(idl,che): + missing = [] + for ind in che: + if not ind in idl: + missing.append(ind) + if(len(missing) == 0): + print("There are no measurements missing.") + else: + print(len(missing),"measurements missing") + miss_str = str(missing[0]) + for i in missing[1:]: + miss_str += ","+str(i) + print(miss_str)