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:
parent
549b849730
commit
e0e088eaa8
|
@ -122,9 +122,9 @@ class ConfigMaterial(Config):
|
|||
cell_data : str
|
||||
Name of the group (folder) containing cell-wise data. Defaults to 'CellData'.
|
||||
cell_ensemble_data : str
|
||||
Name of the group (folder) containing data of cell ensembles.
|
||||
This group is used to inquire the name of the phases. If set to
|
||||
'None', phases get numeric IDs. Defaults to 'CellEnsembleData'.
|
||||
Name of the group (folder) containing data of cell ensembles. This
|
||||
group is used to inquire the name of the phases. Phases will get
|
||||
numeric IDs if this group is not found. Defaults to 'CellEnsembleData'.
|
||||
phases : str
|
||||
Name of the dataset containing the phase ID (cell-wise or grain-wise).
|
||||
Defaults to 'Phases'.
|
||||
|
@ -132,8 +132,8 @@ class ConfigMaterial(Config):
|
|||
Name of the dataset containing the crystallographic orientation as
|
||||
Euler angles in radians (cell-wise or grain-wise). Defaults to 'EulerAngles'.
|
||||
phase_names : str
|
||||
Name of the dataset containing the phase names. It is not used if
|
||||
cell_ensemble_data is set to 'None. Defaults to 'PhaseName'.
|
||||
Name of the dataset containing the phase names. Phases will get
|
||||
numeric IDs if this dataset is not found. Defaults to 'PhaseName'.
|
||||
base_group : str
|
||||
Path to the group (folder) that contains geometry (_SIMPL_GEOMETRY),
|
||||
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
|
||||
idx = np.arange(phase.size)
|
||||
|
||||
if cell_ensemble_data is not None:
|
||||
names = np.array([s.decode() for s in f[os.path.join(b,cell_ensemble_data,phase_names)]])
|
||||
phase = names[phase]
|
||||
if cell_ensemble_data is not None and phase_names is not None:
|
||||
try:
|
||||
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)},
|
||||
'homogenization':{'direct':{'N_constituents':1}}})
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../Grid/measured.dream3d
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
../Grid/measured.xdmf
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
|
||||
import filecmp
|
||||
import pytest
|
||||
import numpy as np
|
||||
|
||||
|
@ -118,8 +118,8 @@ class TestConfigMaterial:
|
|||
point_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d',
|
||||
cell_ensemble_data = cell_ensemble_data)
|
||||
|
||||
assert point_c.is_valid and grain_c.is_valid
|
||||
assert len(point_c['material'])+1 == len(grain_c['material'])
|
||||
assert point_c.is_valid and grain_c.is_valid and \
|
||||
len(point_c['material'])+1 == len(grain_c['material'])
|
||||
|
||||
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()
|
||||
|
@ -130,3 +130,11 @@ class TestConfigMaterial:
|
|||
grain_c['material'][j]['constituents'][0]['O'])
|
||||
assert point_c['material'][i]['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')
|
||||
|
|
|
@ -439,3 +439,12 @@ class TestGrid:
|
|||
assert np.allclose(grain.origin,point.origin) and \
|
||||
np.allclose(grain.size,point.size) and \
|
||||
(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)
|
||||
|
|
Loading…
Reference in New Issue