EBSD dataset for testing

use only non-segmented data. Automatically fall back to numeric phase
names if cell_ensemble_data is not found
This commit is contained in:
Martin Diehl 2021-03-23 13:42:04 +01:00
parent 549b849730
commit e0e088eaa8
9 changed files with 66972 additions and 11 deletions

View File

@ -122,9 +122,9 @@ class ConfigMaterial(Config):
cell_data : str cell_data : str
Name of the group (folder) containing cell-wise data. Defaults to 'CellData'. Name of the group (folder) containing cell-wise data. Defaults to 'CellData'.
cell_ensemble_data : str cell_ensemble_data : str
Name of the group (folder) containing data of cell ensembles. Name of the group (folder) containing data of cell ensembles. This
This group is used to inquire the name of the phases. If set to group is used to inquire the name of the phases. Phases will get
'None', phases get numeric IDs. Defaults to 'CellEnsembleData'. numeric IDs if this group is not found. Defaults to 'CellEnsembleData'.
phases : str phases : str
Name of the dataset containing the phase ID (cell-wise or grain-wise). Name of the dataset containing the phase ID (cell-wise or grain-wise).
Defaults to 'Phases'. Defaults to 'Phases'.
@ -132,8 +132,8 @@ class ConfigMaterial(Config):
Name of the dataset containing the crystallographic orientation as Name of the dataset containing the crystallographic orientation as
Euler angles in radians (cell-wise or grain-wise). Defaults to 'EulerAngles'. Euler angles in radians (cell-wise or grain-wise). Defaults to 'EulerAngles'.
phase_names : str phase_names : str
Name of the dataset containing the phase names. It is not used if Name of the dataset containing the phase names. Phases will get
cell_ensemble_data is set to 'None. Defaults to 'PhaseName'. numeric IDs if this dataset is not found. Defaults to 'PhaseName'.
base_group : str base_group : str
Path to the group (folder) that contains geometry (_SIMPL_GEOMETRY), Path to the group (folder) that contains geometry (_SIMPL_GEOMETRY),
and grain- or cell-wise data. Defaults to None, in which case and grain- or cell-wise data. Defaults to None, in which case
@ -153,9 +153,13 @@ class ConfigMaterial(Config):
O = Rotation.from_Euler_angles(f[os.path.join(b,grain_data,Euler_angles)]).as_quaternion() # noqa O = Rotation.from_Euler_angles(f[os.path.join(b,grain_data,Euler_angles)]).as_quaternion() # noqa
idx = np.arange(phase.size) idx = np.arange(phase.size)
if cell_ensemble_data is not None: if cell_ensemble_data is not None and phase_names is not None:
names = np.array([s.decode() for s in f[os.path.join(b,cell_ensemble_data,phase_names)]]) try:
phase = names[phase] names = np.array([s.decode() for s in f[os.path.join(b,cell_ensemble_data,phase_names)]])
phase = names[phase]
except KeyError:
pass
base_config = ConfigMaterial({'phase':{k if isinstance(k,int) else str(k):'t.b.d.' for k in np.unique(phase)}, base_config = ConfigMaterial({'phase':{k if isinstance(k,int) else str(k):'t.b.d.' for k in np.unique(phase)},
'homogenization':{'direct':{'N_constituents':1}}}) 'homogenization':{'direct':{'N_constituents':1}}})

View File

@ -0,0 +1 @@
../Grid/measured.dream3d

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
../Grid/measured.xdmf

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd"[]>
<Xdmf xmlns:xi="http://www.w3.org/2003/XInclude" Version="2.2">
<Domain>
<!-- *************** START OF Small IN100 *************** -->
<Grid Name="Small IN100" GridType="Uniform">
<Topology TopologyType="3DCoRectMesh" Dimensions="2 102 202 "></Topology>
<Geometry Type="ORIGIN_DXDYDZ">
<!-- Origin Z, Y, X -->
<DataItem Format="XML" Dimensions="3">0 35 -294.7</DataItem>
<!-- DxDyDz (Spacing/Resolution) Z, Y, X -->
<DataItem Format="XML" Dimensions="3">0.35 0.35 0.35</DataItem>
</Geometry>
<Attribute Name="Confidence Index" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Confidence Index
</DataItem>
</Attribute>
<Attribute Name="EulerAngles" AttributeType="Vector" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 3" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/EulerAngles
</DataItem>
</Attribute>
<Attribute Name="FeatureIds" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Int" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/FeatureIds
</DataItem>
</Attribute>
<Attribute Name="Fit" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Fit
</DataItem>
</Attribute>
<Attribute Name="IPFColor" AttributeType="Vector" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 3" NumberType="UChar" Precision="1" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/IPFColor
</DataItem>
</Attribute>
<Attribute Name="Image Quality" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Image Quality
</DataItem>
</Attribute>
<Attribute Name="Mask" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="uchar" Precision="1" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Mask
</DataItem>
</Attribute>
<Attribute Name="ParentIds" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Int" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/ParentIds
</DataItem>
</Attribute>
<Attribute Name="Phases" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Int" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Phases
</DataItem>
</Attribute>
<Attribute Name="SEM Signal" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/SEM Signal
</DataItem>
</Attribute>
<Attribute Name="X Position" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/X Position
</DataItem>
</Attribute>
<Attribute Name="Y Position" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Y Position
</DataItem>
</Attribute>
</Grid>
<!-- *************** END OF Small IN100 *************** -->
</Domain>
</Xdmf>

View File

@ -1,5 +1,5 @@
import os import os
import filecmp
import pytest import pytest
import numpy as np import numpy as np
@ -118,8 +118,8 @@ class TestConfigMaterial:
point_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d', point_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d',
cell_ensemble_data = cell_ensemble_data) cell_ensemble_data = cell_ensemble_data)
assert point_c.is_valid and grain_c.is_valid assert point_c.is_valid and grain_c.is_valid and \
assert len(point_c['material'])+1 == len(grain_c['material']) len(point_c['material'])+1 == len(grain_c['material'])
grain_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','FeatureIds').material.flatten() grain_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','FeatureIds').material.flatten()
point_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d').material.flatten() point_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d').material.flatten()
@ -130,3 +130,11 @@ class TestConfigMaterial:
grain_c['material'][j]['constituents'][0]['O']) grain_c['material'][j]['constituents'][0]['O'])
assert point_c['material'][i]['constituents'][0]['phase'] == \ assert point_c['material'][i]['constituents'][0]['phase'] == \
grain_c['material'][j]['constituents'][0]['phase'] grain_c['material'][j]['constituents'][0]['phase']
def test_load_DREAM3D_reference(self,tmp_path,ref_path,update):
config = ConfigMaterial.load_DREAM3D(ref_path/'measured.dream3d',cell_data='EBSD Scan Data')
config.save(tmp_path/'material.yaml')
if update:
config.save(ref_path/'measured.material_yaml')
assert config.is_valid and filecmp.cmp(tmp_path/'material.yaml',ref_path/'measured.material_yaml')

View File

@ -439,3 +439,12 @@ class TestGrid:
assert np.allclose(grain.origin,point.origin) and \ assert np.allclose(grain.origin,point.origin) and \
np.allclose(grain.size,point.size) and \ np.allclose(grain.size,point.size) and \
(grain.sort().material == point.material+1).all() (grain.sort().material == point.material+1).all()
def test_load_DREAM3D_reference(self,ref_path,update):
current = Grid.load_DREAM3D(ref_path/'measured.dream3d',cell_data='EBSD Scan Data')
reference = Grid.load(ref_path/'measured')
if update:
current.save(ref_path/'measured.vtr')
assert grid_equal(current,reference)