standard names
This commit is contained in:
parent
6f3dc80079
commit
6fef46539e
|
@ -366,49 +366,27 @@ class Result:
|
||||||
Return groups that contain all requested datasets.
|
Return groups that contain all requested datasets.
|
||||||
|
|
||||||
Only groups within
|
Only groups within
|
||||||
- inc*/phase/*/*
|
- inc*/phase/*/
|
||||||
- inc*/homogenization/*/*
|
- inc*/homogenization/*/
|
||||||
- inc*/geometry/*
|
- inc*/geometry/
|
||||||
|
|
||||||
are considered as they contain user-relevant data.
|
are considered as they contain user-relevant data.
|
||||||
Single strings will be treated as list with one entry.
|
Single strings will be treated as list with one entry.
|
||||||
|
|
||||||
Wild card matching is allowed, but the number of arguments needs to fit.
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
datasets : iterable or str or bool
|
datasets : iterable or str or bool
|
||||||
|
|
||||||
Examples
|
|
||||||
--------
|
|
||||||
datasets = False matches no group
|
|
||||||
datasets = True matches all groups
|
|
||||||
datasets = ['F','P'] matches a group with ['F','P','sigma']
|
|
||||||
datasets = ['*','P'] matches a group with ['F','P']
|
|
||||||
datasets = ['*'] does not match a group with ['F','P','sigma']
|
|
||||||
datasets = ['*','*'] does not match a group with ['F','P','sigma']
|
|
||||||
datasets = ['*','*','*'] matches a group with ['F','P','sigma']
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if datasets is False: return []
|
|
||||||
|
|
||||||
sets = datasets if isinstance(datasets,bool) or (hasattr(datasets,'__iter__') and not isinstance(datasets,str)) else \
|
|
||||||
[datasets]
|
|
||||||
|
|
||||||
groups = []
|
groups = []
|
||||||
|
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
for i in self.iterate('increments'):
|
for inc in self.visible['increments']:
|
||||||
for o,p in zip(['phases','homogenizations'],['fields','fields']):
|
for ty in ['phases','homogenizations']:
|
||||||
for oo in self.iterate(o):
|
for label in self.visible[ty]:
|
||||||
for pp in self.iterate(p):
|
for field in self.visible['fields']:
|
||||||
group = '/'.join([i,o[:-1],oo,pp]) # o[:-1]: plural/singular issue
|
group = '/'.join([inc,ty[:-1],label,field])
|
||||||
if sets is True:
|
if set(group) == set(datasets): groups.append(group)
|
||||||
groups.append(group)
|
|
||||||
else:
|
|
||||||
if group in f.keys():
|
|
||||||
match = [e for e_ in [glob.fnmatch.filter(f[group].keys(),s) for s in sets] for e in e_]
|
|
||||||
if len(set(match)) == len(sets): groups.append(group)
|
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,16 +397,16 @@ class Result:
|
||||||
un = 'Unit' if self.version_minor < 12 else 'unit'
|
un = 'Unit' if self.version_minor < 12 else 'unit'
|
||||||
message = ''
|
message = ''
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
for i in self.visible['increments']:
|
for inc in self.visible['increments']:
|
||||||
message += f'\n{i} ({self.times[self.increments.index(i)]}s)\n'
|
message += f'\n{inc} ({self.times[self.increments.index(inc)]}s)\n'
|
||||||
for o,p in zip(['phases','homogenizations'],['fields','fields']):
|
for ty in ['phases','homogenizations']:
|
||||||
message += f' {o[:-1]}\n'
|
message += f' {ty[:-1]}\n'
|
||||||
for oo in self.visible[o]:
|
for label in self.visible[ty]:
|
||||||
message += f' {oo}\n'
|
message += f' {label}\n'
|
||||||
for pp in self.visible[p]:
|
for field in self.visible['fields']:
|
||||||
message += f' {pp}\n'
|
message += f' {field}\n'
|
||||||
for d in f['/'.join([i,o[:-1],oo,pp])].keys():
|
for d in f['/'.join([inc,ty[:-1],label,field])].keys():
|
||||||
dataset = f['/'.join([i,o[:-1],oo,pp,d])]
|
dataset = f['/'.join([inc,ty[:-1],label,field,d])]
|
||||||
unit = f' / {dataset.attrs[un]}' if h5py3 else \
|
unit = f' / {dataset.attrs[un]}' if h5py3 else \
|
||||||
f' / {dataset.attrs[un].decode()}'
|
f' / {dataset.attrs[un].decode()}'
|
||||||
description = dataset.attrs[de] if h5py3 else \
|
description = dataset.attrs[de] if h5py3 else \
|
||||||
|
|
Loading…
Reference in New Issue