mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 03:53:41 +02:00
hotfix, missing kwarg files in read_rwms method
This commit is contained in:
parent
307738c4fd
commit
5e5a9df404
2 changed files with 24 additions and 7 deletions
|
@ -39,13 +39,15 @@ def read_rwms(path, prefix, version='2.0', names=None, **kwargs):
|
||||||
|
|
||||||
if not ls:
|
if not ls:
|
||||||
raise Exception('Error, directory not found')
|
raise Exception('Error, directory not found')
|
||||||
|
if 'files' in kwargs:
|
||||||
# Exclude files with different names
|
ls = kwargs.get('files')
|
||||||
for exc in ls:
|
else:
|
||||||
if not fnmatch.fnmatch(exc, prefix + '*' + postfix + '.dat'):
|
# Exclude files with different names
|
||||||
ls = list(set(ls) - set([exc]))
|
for exc in ls:
|
||||||
if len(ls) > 1:
|
if not fnmatch.fnmatch(exc, prefix + '*' + postfix + '.dat'):
|
||||||
ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0]))
|
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)
|
replica = len(ls)
|
||||||
|
|
||||||
if 'r_start' in kwargs:
|
if 'r_start' in kwargs:
|
||||||
|
|
15
pyerrors/input/utils.py
Normal file
15
pyerrors/input/utils.py
Normal file
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue