seems to read the data correctly

This commit is contained in:
Vitesh Shah 2023-04-06 21:42:34 +02:00
parent f619cf4ff2
commit 2ae1a20443
1 changed files with 13 additions and 13 deletions

View File

@ -20,6 +20,7 @@ import numpy.ma as ma
import damask import damask
from . import VTK from . import VTK
from . import Orientation from . import Orientation
from . import Rotation
from . import grid_filters from . import grid_filters
from . import mechanics from . import mechanics
from . import tensor from . import tensor
@ -1967,23 +1968,22 @@ class Result:
dx = self.size/self.cells dx = self.size/self.cells
at_cell_ph,in_data_ph,at_cell_ho,in_data_ho = self._mappings()
for inc in util.show_progress(self.visible['increments']): for inc in util.show_progress(self.visible['increments']):
for label in self.visible['phases']: cell_orientation_array = np.zeros((np.prod(self.cells),3))
phase_ID_array = np.zeros((np.prod(self.cells)),dtype=np.int32) #need to reshape it later
for c in range(self.N_constituents):
for count,label in enumerate(self.visible['phases']):
try: try:
data = ma.array(_read(f['/'.join([inc,'phase',label,'mechanical/O'])])) data = ma.array(_read(f['/'.join([inc,'phase',label,'mechanical/O'])]))
cell_orientation_array[at_cell_ph[c][label],:] = Rotation(data[in_data_ph[c][label],:]).as_Euler_angles() # TODO: convert DAMASK quats to Dream3D quats?
except ValueError: #check if the exception is correct except ValueError: #check if the exception is correct
print("Orientation data is not present") print("Orientation data is not present")
exit() # need to check if such a statement would really work. exit() # need to check if such a statement would really work.
cell_orientation_array = np.zeros((np.prod(self.cells),3))
phase_ID_array = np.zeros((np.prod(self.cells)),dtype=np.int32) #need to reshape it later
at_cell_ph,in_data_ph,at_cell_ho,in_data_ho = self._mappings() phase_ID_array[at_cell_ph[c][label]] = count + 1 #need to figure out these mappings a bit
for c in range(self.N_constituents):
for ph in self.phases:
cell_orientation_array[at_cell_ph[c][ph],:] = data[,:]# need to figure out these mappings a bit
cell_orientation_array[in_data_ph[ph],:] = # need to figure out these mappings a bit
phase_ID_array[phase_index] = count + 1 #need to figure out these mappings a bit
job_file_no_ext = os.path.splitext(self.fname)[0] job_file_no_ext = os.path.splitext(self.fname)[0]
o = h5py.File(f'{job_file_no_ext}_increment{inc}.dream3D','w') o = h5py.File(f'{job_file_no_ext}_increment{inc}.dream3D','w')