Merge branch 'rotation-example' into 'development'

Rotation-example

See merge request damask/DAMASK!645
This commit is contained in:
Philip Eisenlohr 2022-11-08 14:25:35 +00:00
commit 507e1a2f05
1 changed files with 24 additions and 14 deletions

View File

@ -611,8 +611,7 @@ class Rotation:
Cube orientation as Bunge Euler angles. Cube orientation as Bunge Euler angles.
>>> import damask >>> import damask
>>> import numpy as np >>> damask.Rotation([1,0,0,0]).as_Euler_angles()
>>> damask.Rotation(np.array([1,0,0,0])).as_Euler_angles()
array([0., 0., 0.]) array([0., 0., 0.])
""" """
@ -643,8 +642,7 @@ class Rotation:
Cube orientation as axisangle pair. Cube orientation as axisangle pair.
>>> import damask >>> import damask
>>> import numpy as np >>> damask.Rotation([1,0,0,0]).as_axis_angle(pair=True)
>>> damask.Rotation(np.array([1,0,0,0])).as_axis_angle(pair=True)
(array([0., 0., 1.]), array(0.)) (array([0., 0., 1.]), array(0.))
""" """
@ -666,8 +664,7 @@ class Rotation:
Cube orientation as rotation matrix. Cube orientation as rotation matrix.
>>> import damask >>> import damask
>>> import numpy as np >>> damask.Rotation([1,0,0,0]).as_matrix()
>>> damask.Rotation(np.array([1,0,0,0])).as_matrix()
array([[1., 0., 0.], array([[1., 0., 0.],
[0., 1., 0.], [0., 1., 0.],
[0., 0., 1.]]) [0., 0., 1.]])
@ -697,8 +694,7 @@ class Rotation:
Cube orientation as three-component RodriguesFrank vector. Cube orientation as three-component RodriguesFrank vector.
>>> import damask >>> import damask
>>> import numpy as np >>> damask.Rotation([1,0,0,0]).as_Rodrigues_vector(compact=True)
>>> damask.Rotation(np.array([1,0,0,0])).as_Rodrigues_vector(compact=True)
array([ 0., 0., 0.]) array([ 0., 0., 0.])
""" """
@ -723,8 +719,7 @@ class Rotation:
Cube orientation as homochoric vector. Cube orientation as homochoric vector.
>>> import damask >>> import damask
>>> import numpy as np >>> damask.Rotation([1,0,0,0]).as_homochoric()
>>> damask.Rotation(np.array([1,0,0,0])).as_homochoric()
array([0., 0., 0.]) array([0., 0., 0.])
""" """
@ -744,8 +739,7 @@ class Rotation:
Cube orientation as cubochoric vector. Cube orientation as cubochoric vector.
>>> import damask >>> import damask
>>> import numpy as np >>> damask.Rotation([1,0,0,0]).as_cubochoric()
>>> damask.Rotation(np.array([1,0,0,0])).as_cubochoric()
array([0., 0., 0.]) array([0., 0., 0.])
""" """
@ -1120,11 +1114,27 @@ class Rotation:
shape : int or sequence of ints, optional shape : int or sequence of ints, optional
Shape of the returned array. Defaults to None, which gives a scalar. Shape of the returned array. Defaults to None, which gives a scalar.
degrees : bool, optional degrees : bool, optional
sigma is given in degrees. Defaults to True. sigma is given in degrees. Defaults to False.
rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional
A seed to initialize the BitGenerator. A seed to initialize the BitGenerator.
Defaults to None, i.e. unpredictable entropy will be pulled from the OS. Defaults to None, i.e. unpredictable entropy will be pulled from the OS.
Examples
--------
Create a brass texture consisting of
200 orientations:
>>> import damask
>>> center = damask.Rotation.from_Euler_angles([35.0,45.0,0.0],degrees=True)
>>> brass = damask.Rotation.from_spherical_component(center=center,sigma=3.0,shape=200,degrees=True)
Create a Goss texture consisting of
100 orientations:
>>> import damask
>>> center = damask.Rotation.from_Euler_angles([0.0,45.0,0.0],degrees=True)
>>> goss = damask.Rotation.from_spherical_component(center=center,sigma=3.0,shape=100,degrees=True)
""" """
rng = np.random.default_rng(rng_seed) rng = np.random.default_rng(rng_seed)
sigma = np.radians(sigma) if degrees else sigma sigma = np.radians(sigma) if degrees else sigma
@ -1162,7 +1172,7 @@ class Rotation:
shape : int or sequence of ints, optional shape : int or sequence of ints, optional
Shape of the returned array. Defaults to None, which gives a scalar. Shape of the returned array. Defaults to None, which gives a scalar.
degrees : bool, optional degrees : bool, optional
sigma and polar coordinates are given in degrees. sigma and polar coordinates are given in degrees. Defaults to False.
rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional
A seed to initialize the BitGenerator. A seed to initialize the BitGenerator.
Defaults to None, i.e. unpredictable entropy will be pulled from the OS. Defaults to None, i.e. unpredictable entropy will be pulled from the OS.