parent
0d3ef29554
commit
b393da4955
|
@ -4,7 +4,6 @@ from itertools import permutations
|
|||
import pytest
|
||||
import numpy as np
|
||||
|
||||
import damask
|
||||
from damask import Rotation
|
||||
from damask import Orientation
|
||||
from damask import Lattice
|
||||
|
@ -68,7 +67,7 @@ class TestOrientation:
|
|||
{'label':'blue', 'RGB':[0,0,1],'direction':[1,1,1]}])
|
||||
@pytest.mark.parametrize('lattice',['fcc','bcc'])
|
||||
def test_IPF_cubic(self,color,lattice):
|
||||
cube = damask.Orientation(damask.Rotation(),lattice)
|
||||
cube = Orientation(Rotation(),lattice)
|
||||
for direction in set(permutations(np.array(color['direction']))):
|
||||
assert np.allclose(cube.IPF_color(np.array(direction)),np.array(color['RGB']))
|
||||
|
||||
|
@ -112,7 +111,7 @@ class TestOrientation:
|
|||
@pytest.mark.parametrize('lattice',Lattice.lattices)
|
||||
def test_disorientation360(self,lattice):
|
||||
R_1 = Orientation(Rotation(),lattice)
|
||||
R_2 = Orientation(damask.Rotation.from_Eulers([360,0,0],degrees=True),lattice)
|
||||
R_2 = Orientation(Rotation.from_Eulers([360,0,0],degrees=True),lattice)
|
||||
assert np.allclose(R_1.disorientation(R_2).as_matrix(),np.eye(3))
|
||||
|
||||
@pytest.mark.parametrize('lattice',Lattice.lattices)
|
||||
|
@ -127,6 +126,6 @@ class TestOrientation:
|
|||
def test_from_average(self,lattice):
|
||||
R_1 = Orientation(Rotation.from_random(),lattice)
|
||||
eqs = [r for r in R_1.equivalent]
|
||||
R_2 = damask.Orientation.from_average(eqs)
|
||||
R_2 = Orientation.from_average(eqs)
|
||||
assert np.allclose(R_1.rotation.quaternion,R_2.rotation.quaternion)
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@ import pytest
|
|||
import numpy as np
|
||||
import h5py
|
||||
|
||||
import damask
|
||||
from damask import Result
|
||||
from damask import Rotation
|
||||
from damask import Orientation
|
||||
from damask import mechanics
|
||||
from damask import grid_filters
|
||||
|
||||
|
@ -174,7 +175,7 @@ class TestResult:
|
|||
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
|
||||
o = Orientation(q,crystal_structure).reduced
|
||||
in_memory[i] = np.uint8(o.IPF_color(np.array(d))*255)
|
||||
in_file = default.read_dataset(loc['color'])
|
||||
assert np.allclose(in_memory,in_file)
|
||||
|
@ -233,7 +234,7 @@ class TestResult:
|
|||
default.add_pole('orientation',pole,polar)
|
||||
loc = {'orientation': default.get_dataset_location('orientation'),
|
||||
'pole': default.get_dataset_location('p^{}_[1 0 0)'.format(u'rφ' if polar else 'xy'))}
|
||||
rot = damask.Rotation(default.read_dataset(loc['orientation']).view(np.double))
|
||||
rot = Rotation(default.read_dataset(loc['orientation']).view(np.double))
|
||||
rotated_pole = rot * np.broadcast_to(pole,rot.shape+(3,))
|
||||
xy = rotated_pole[:,0:2]/(1.+abs(pole[2]))
|
||||
in_memory = xy if not polar else \
|
||||
|
|
Loading…
Reference in New Issue