diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index f431e693f..312fa205b 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -96,6 +96,20 @@ class TestResult: in_file = default.read_dataset(loc['v(sigma)'],0) assert np.allclose(in_memory,in_file) + @pytest.mark.parametrize('d',[[1,0,0],[0,1,0],[0,0,1]]) + def test_add_IPFcolor(self,default,d): + default.add_IPFcolor('orientation',d) + loc = {'orientation': default.get_dataset_location('orientation'), + 'color': default.get_dataset_location('IPFcolor_[{} {} {}]'.format(*d))} + qu = default.read_dataset(loc['orientation']).view(np.double).reshape(-1,4) + crystal_structure = default.get_crystal_structure() + in_memory = np.empty((qu.shape[0],3),np.uint8) + for i,q in enumerate(qu): + o = damask.Orientation(q,crystal_structure).reduced() + in_memory[i] = np.uint8(o.IPFcolor(np.array(d))*255) + in_file = default.read_dataset(loc['color']) + assert np.allclose(in_memory,in_file) + def test_add_maximum_shear(self,default): default.add_Cauchy('P','F') default.add_maximum_shear('sigma')