simplifying

[] has a special meaning for glob, use () to indicate direction for IPF
color. It is anyways the sample direction, not a crystallographic
direction
This commit is contained in:
Martin Diehl 2021-04-04 19:05:58 +02:00
parent d78e0085fc
commit e1d57f176d
2 changed files with 9 additions and 11 deletions

View File

@ -720,11 +720,11 @@ class Result:
return { return {
'data': np.uint8(o.IPF_color(l)*255), 'data': np.uint8(o.IPF_color(l)*255),
'label': 'IPFcolor_[{} {} {}]'.format(*m), 'label': 'IPFcolor_({} {} {})'.format(*m),
'meta' : { 'meta' : {
'unit': '8-bit RGB', 'unit': '8-bit RGB',
'lattice': q['meta']['lattice'], 'lattice': q['meta']['lattice'],
'description': 'Inverse Pole Figure (IPF) colors along sample direction [{} {} {}]'.format(*m), 'description': 'Inverse Pole Figure (IPF) colors along sample direction ({} {} {})'.format(*m),
'creator': 'add_IPF_color' 'creator': 'add_IPF_color'
} }
} }

View File

@ -97,12 +97,12 @@ class TestResult:
def test_view_less(self,default,what): def test_view_less(self,default,what):
default.view(what,True) default.view(what,True)
default.view_less(what,'*') default.view_less(what,'*')
a = default.get_dataset_location('F') a = default.read('F')
default.view(what,False) default.view(what,False)
b = default.get_dataset_location('F') b = default.read('F')
assert a == b == [] assert a == b == {}
def test_view_invalid(self,default): def test_view_invalid(self,default):
with pytest.raises(AttributeError): with pytest.raises(AttributeError):
@ -168,13 +168,11 @@ class TestResult:
@pytest.mark.parametrize('d',[[1,0,0],[0,1,0],[0,0,1]]) @pytest.mark.parametrize('d',[[1,0,0],[0,1,0],[0,0,1]])
def test_add_IPF_color(self,default,d): def test_add_IPF_color(self,default,d):
default.add_IPF_color(d,'O') default.add_IPF_color(d,'O')
loc = {'O': default.get_dataset_location('O'), qu = default.place('O')
'color': default.get_dataset_location('IPFcolor_[{} {} {}]'.format(*d))} crystal_structure = qu.dtype.metadata['lattice']
qu = default.read_dataset(loc['O'])
crystal_structure = default._get_attribute(default.get_dataset_location('O')[0],'lattice')
c = Orientation(rotation=qu,lattice=crystal_structure) c = Orientation(rotation=qu,lattice=crystal_structure)
in_memory = np.uint8(c.IPF_color(np.array(d))*255) in_memory = np.uint8(c.IPF_color(np.array(d))*255)
in_file = default.read_dataset(loc['color']) in_file = default.place('IPFcolor_({} {} {})'.format(*d))
assert np.allclose(in_memory,in_file) assert np.allclose(in_memory,in_file)
def test_add_maximum_shear(self,default): def test_add_maximum_shear(self,default):
@ -205,7 +203,7 @@ class TestResult:
default.add_stress_Cauchy('P','F') default.add_stress_Cauchy('P','F')
default.add_calculation('sigma_y','#sigma#',unit='y') default.add_calculation('sigma_y','#sigma#',unit='y')
default.add_equivalent_Mises('sigma_y') default.add_equivalent_Mises('sigma_y')
assert default.get_dataset_location('sigma_y_vM') == [] assert default.read('sigma_y_vM') == {}
def test_add_Mises_stress_strain(self,default): def test_add_Mises_stress_strain(self,default):
default.add_stress_Cauchy('P','F') default.add_stress_Cauchy('P','F')