better readable

This commit is contained in:
Martin Diehl 2022-04-22 18:26:52 +02:00
parent fb6160e7af
commit 1b1eb824c4
1 changed files with 2 additions and 3 deletions

View File

@ -114,10 +114,9 @@ class Result:
self.add_curl = self.add_divergence = self.add_gradient = None self.add_curl = self.add_divergence = self.add_gradient = None
r = re.compile(rf'{prefix_inc}([0-9]+)') r = re.compile(rf'{prefix_inc}([0-9]+)')
self.increments = [f'{prefix_inc}{i}' self.increments = sorted([i for i in f.keys() if r.match(i)],key=util.natural_sort)
for i in sorted([int(m.group(1)) for i in f.keys() for m in (r.match(i),) if m])]
self.times = [round(f[i].attrs['t/s'],12) for i in self.increments] self.times = [round(f[i].attrs['t/s'],12) for i in self.increments]
if len(self.incs) == 0: if len(self.increments) == 0:
raise ValueError('incomplete DADF5 file') raise ValueError('incomplete DADF5 file')
self.N_materialpoints, self.N_constituents = np.shape(f['cell_to/phase']) self.N_materialpoints, self.N_constituents = np.shape(f['cell_to/phase'])