documenting and testing

This commit is contained in:
Martin Diehl 2022-05-08 23:22:03 +02:00
parent d7e7750400
commit f27969caf9
2 changed files with 21 additions and 3 deletions

View File

@ -1126,8 +1126,8 @@ class Rotation:
Notes Notes
----- -----
The default crystal direction (θ=0,φ=0) direction is [0 0 1], The crystal direction for (θ=0,φ=0) is [0 0 1],
the default sample direction (θ=0,φ=0) is z. the sample direction for (θ=0,φ=0) is z.
Polar coordinates follow the ISO 80000-2:2019 convention Polar coordinates follow the ISO 80000-2:2019 convention
typically used in physics. typically used in physics.
@ -1137,7 +1137,18 @@ class Rotation:
Examples Examples
-------- --------
tbd Create an ideal α-fiber texture (<1 1 0> ǀǀ RD=x) consisting of
200 orientations:
>>> import damask
>>> import numpy as np
>>> alpha = damask.Rotation.from_fiber_component([np.pi/4.,0.],[np.pi/2.,0.],shape=200)
Create an ideal γ-fiber texture (<1 1 1> ǀǀ ND=z) consisting of
100 orientations:
>>> import damask
>>> gamma = damask.Rotation.from_fiber_component([54.7,45.0],[0.,0.],shape=100,degrees=True)
""" """
rng = np.random.default_rng(rng_seed) rng = np.random.default_rng(rng_seed)

View File

@ -158,6 +158,13 @@ class TestOrientation:
sigma=0.0,shape=None,rng_seed=0,lattice='cI').quaternion sigma=0.0,shape=None,rng_seed=0,lattice='cI').quaternion
== r.quaternion) == r.quaternion)
@pytest.mark.parametrize('crystal,sample,direction,color',[([np.pi/4,0],[np.pi/2,0],[1,0,0],[0,1,0]),
([np.arccos(3**(-.5)),np.pi/4,0],[0,0],[0,0,1],[0,0,1])])
def test_fiber_IPF(self,crystal,sample,direction,color):
fiber = Orientation.from_fiber_component(crystal=crystal,sample=sample,family='cubic',shape=200)
print(np.allclose(fiber.IPF_color(direction),color))
@pytest.mark.parametrize('kwargs',[ @pytest.mark.parametrize('kwargs',[
dict(lattice='aP',a=1.0,b=1.1,c=1.2,alpha=np.pi/4.5,beta=np.pi/3.5,gamma=np.pi/2.5), dict(lattice='aP',a=1.0,b=1.1,c=1.2,alpha=np.pi/4.5,beta=np.pi/3.5,gamma=np.pi/2.5),
dict(lattice='mP',a=1.0,b=1.1,c=1.2, beta=np.pi/3.5), dict(lattice='mP',a=1.0,b=1.1,c=1.2, beta=np.pi/3.5),