diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 229e1324e..b72cec402 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -611,8 +611,7 @@ class Rotation: Cube orientation as Bunge Euler angles. >>> import damask - >>> import numpy as np - >>> damask.Rotation(np.array([1,0,0,0])).as_Euler_angles() + >>> damask.Rotation([1,0,0,0]).as_Euler_angles() array([0., 0., 0.]) """ @@ -643,8 +642,7 @@ class Rotation: Cube orientation as axis–angle pair. >>> import damask - >>> import numpy as np - >>> damask.Rotation(np.array([1,0,0,0])).as_axis_angle(pair=True) + >>> damask.Rotation([1,0,0,0]).as_axis_angle(pair=True) (array([0., 0., 1.]), array(0.)) """ @@ -666,8 +664,7 @@ class Rotation: Cube orientation as rotation matrix. >>> import damask - >>> import numpy as np - >>> damask.Rotation(np.array([1,0,0,0])).as_matrix() + >>> damask.Rotation([1,0,0,0]).as_matrix() array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]) @@ -697,8 +694,7 @@ class Rotation: Cube orientation as three-component Rodrigues–Frank vector. >>> import damask - >>> import numpy as np - >>> damask.Rotation(np.array([1,0,0,0])).as_Rodrigues_vector(compact=True) + >>> damask.Rotation([1,0,0,0]).as_Rodrigues_vector(compact=True) array([ 0., 0., 0.]) """ @@ -723,8 +719,7 @@ class Rotation: Cube orientation as homochoric vector. >>> import damask - >>> import numpy as np - >>> damask.Rotation(np.array([1,0,0,0])).as_homochoric() + >>> damask.Rotation([1,0,0,0]).as_homochoric() array([0., 0., 0.]) """ @@ -744,8 +739,7 @@ class Rotation: Cube orientation as cubochoric vector. >>> import damask - >>> import numpy as np - >>> damask.Rotation(np.array([1,0,0,0])).as_cubochoric() + >>> damask.Rotation([1,0,0,0]).as_cubochoric() array([0., 0., 0.]) """ @@ -1120,11 +1114,27 @@ class Rotation: shape : int or sequence of ints, optional Shape of the returned array. Defaults to None, which gives a scalar. 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 A seed to initialize the BitGenerator. 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) sigma = np.radians(sigma) if degrees else sigma @@ -1162,7 +1172,7 @@ class Rotation: shape : int or sequence of ints, optional Shape of the returned array. Defaults to None, which gives a scalar. 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 A seed to initialize the BitGenerator. Defaults to None, i.e. unpredictable entropy will be pulled from the OS.