polishing
This commit is contained in:
parent
562e2ea932
commit
56a9dd843c
|
@ -2020,7 +2020,7 @@ class Result:
|
||||||
phase_ID_array[at_cell_ph[c][label]] = count + 1
|
phase_ID_array[at_cell_ph[c][label]] = count + 1
|
||||||
|
|
||||||
job_file_no_ext = self.fname.stem
|
job_file_no_ext = self.fname.stem
|
||||||
o = h5py.File(f'{dream_dir}/{job_file_no_ext}_{inc.split(prefix_inc)[-1].zfill(N_digits)}.dream3d','w')
|
o = h5py.File(f'{dream_dir}/{job_file_no_ext}_inc{inc.split(prefix_inc)[-1].zfill(N_digits)}.dream3d','w')
|
||||||
o.attrs['DADF5toDREAM3D'] = '1.0'
|
o.attrs['DADF5toDREAM3D'] = '1.0'
|
||||||
o.attrs['FileVersion'] = '7.0'
|
o.attrs['FileVersion'] = '7.0'
|
||||||
|
|
||||||
|
@ -2063,15 +2063,21 @@ class Result:
|
||||||
# Data CrystalStructures
|
# Data CrystalStructures
|
||||||
crystal_structure_list = [999]
|
crystal_structure_list = [999]
|
||||||
for label in self.visible['phases']:
|
for label in self.visible['phases']:
|
||||||
|
|
||||||
if lattice_dict[label] in ['hP']:
|
if lattice_dict[label] in ['hP']:
|
||||||
crystal_structure = 'Hexogonal'
|
crystal_structure = 'Hexagonal'
|
||||||
elif lattice_dict[label] in ['cP','cI','cF']:
|
elif lattice_dict[label] in ['cP','cI','cF']:
|
||||||
crystal_structure = 'Cubic'
|
crystal_structure = 'Cubic'
|
||||||
elif lattice_dict[label] in ['']:
|
elif lattice_dict[label] in ['aP']:
|
||||||
|
crystal_structure = 'triclinic'
|
||||||
|
elif lattice_dict[label] in ['mP','mS']:
|
||||||
|
crystal_structure = 'monoclinic'
|
||||||
elif lattice_dict[label] in ['oP','oS','oI','oF']:
|
elif lattice_dict[label] in ['oP','oS','oI','oF']:
|
||||||
crystal_structure = 'Orthorhombic'
|
crystal_structure = 'Orthorhombic'
|
||||||
|
elif lattice_dict[label] in ['tP','tI']:
|
||||||
|
crystal_structure = 'tetragonal'
|
||||||
crystal_structure_list.append(Crystal_structure_types[crystal_structure])
|
crystal_structure_list.append(Crystal_structure_types[crystal_structure])
|
||||||
o[ensemble_label + '/CrystalStructures'] = np.uint32(crystal_struture_list)
|
o[ensemble_label + '/CrystalStructures'] = np.uint32(crystal_structure_list)
|
||||||
# but need to look into dream3d which crystal structure corresponds to which number
|
# but need to look into dream3d which crystal structure corresponds to which number
|
||||||
o[ensemble_label + '/PhaseTypes'] = np.uint32(np.array([999] + [Phase_types['Primary']]*len(self.phases)))\
|
o[ensemble_label + '/PhaseTypes'] = np.uint32(np.array([999] + [Phase_types['Primary']]*len(self.phases)))\
|
||||||
.reshape((len(self.phases)+1,1))
|
.reshape((len(self.phases)+1,1))
|
||||||
|
|
|
@ -440,11 +440,16 @@ class TestResult:
|
||||||
@pytest.mark.parametrize('fname',['2phase_irregularGrid_tensionX.hdf5'],ids=range(1))
|
@pytest.mark.parametrize('fname',['2phase_irregularGrid_tensionX.hdf5'],ids=range(1))
|
||||||
def test_export_DREAM3D(self,tmp_path,res_path,fname):
|
def test_export_DREAM3D(self,tmp_path,res_path,fname):
|
||||||
result = Result(res_path/fname).view(increments=0) #comparing the initial data only
|
result = Result(res_path/fname).view(increments=0) #comparing the initial data only
|
||||||
|
|
||||||
|
prefix_inc = 'increment_'
|
||||||
|
N_digits = int(np.floor(np.log10(max(1,result.incs[-1]))))+1
|
||||||
|
inc = result.increments[0]
|
||||||
|
|
||||||
result.export_DREAM3D(target_dir=tmp_path)
|
result.export_DREAM3D(target_dir=tmp_path)
|
||||||
|
|
||||||
ref_file = h5py.File(res_path/'2phase_irregularGrid.dream3d','r')
|
ref_file = h5py.File(res_path/'2phase_irregularGrid.dream3d','r')
|
||||||
job_file_no_ext = result.fname.stem
|
job_file_no_ext = result.fname.stem
|
||||||
results_file = h5py.File(tmp_path/f'{job_file_no_ext}_increment_0.dream3d','r')
|
results_file = h5py.File(tmp_path/f'{job_file_no_ext}_inc{inc.split(prefix_inc)[-1].zfill(N_digits)}.dream3d','r')
|
||||||
|
|
||||||
error_messages = []
|
error_messages = []
|
||||||
|
|
||||||
|
@ -472,7 +477,7 @@ class TestResult:
|
||||||
if not np.array_equal(ref_val,actual_val):
|
if not np.array_equal(ref_val,actual_val):
|
||||||
error_messages.append("Cell Data attributes do not match")
|
error_messages.append("Cell Data attributes do not match")
|
||||||
|
|
||||||
# Common Attributes for groups in CellData
|
# Common Attributes for datasets in CellData
|
||||||
for dataset in ['/Phases','/EulerAngles']:
|
for dataset in ['/Phases','/EulerAngles']:
|
||||||
for attrs in ['DataArrayVersion','Tuple Axis Dimensions','ComponentDimensions','ObjectType','TupleDimensions']:
|
for attrs in ['DataArrayVersion','Tuple Axis Dimensions','ComponentDimensions','ObjectType','TupleDimensions']:
|
||||||
ref_val = ref_file[cell_data_label + '/' + dataset].attrs[attrs]
|
ref_val = ref_file[cell_data_label + '/' + dataset].attrs[attrs]
|
||||||
|
|
Loading…
Reference in New Issue