handling of derived datatypes/structs

currently required for orientation
This commit is contained in:
Martin Diehl 2019-11-24 08:50:27 +01:00
parent f30cbde99e
commit c9b1944493
2 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ for filename in options.filenames:
x = results.get_dataset_location(label)
if len(x) == 0:
continue
array = results.read_dataset(x,0)
array = results.read_dataset(x,0,plain=True)
d = int(np.product(np.shape(array)[1:]))
data = np.concatenate((data,np.reshape(array,[np.product(results.grid),d])),1)
@ -80,7 +80,7 @@ for filename in options.filenames:
x = results.get_dataset_location(label)
if len(x) == 0:
continue
array = results.read_dataset(x,0)
array = results.read_dataset(x,0,plain=True)
d = int(np.product(np.shape(array)[1:]))
data = np.concatenate((data,np.reshape(array,[np.product(results.grid),d])),1)

View File

@ -369,7 +369,7 @@ class DADF5():
return f[self.get_dataset_location('orientation')[0]].attrs['Lattice'].astype('str') # np.bytes_ to string
def read_dataset(self,path,c=0):
def read_dataset(self,path,c=0,plain=False):
"""
Dataset for all points/cells.
@ -402,7 +402,7 @@ class DADF5():
a=a.reshape([a.shape[0],1])
dataset[p,:] = a[u,:]
return dataset
return dataset if not plain else dataset.view(('float64',len(dataset.dtype.names)))
def cell_coordinates(self):