Merge remote-tracking branch 'origin/development' into typehints_results

This commit is contained in:
Martin Diehl 2022-04-30 00:25:58 +02:00
commit 412884ea82
4 changed files with 15 additions and 13 deletions

View File

@ -233,7 +233,7 @@ update_revision:
- cd $(mktemp -d) - cd $(mktemp -d)
- git clone -q git@git.damask.mpie.de:damask/DAMASK.git . - git clone -q git@git.damask.mpie.de:damask/DAMASK.git .
- git pull - git pull
- exportVERSION=$(git describe ${CI_COMMIT_SHA}) - export VERSION=$(git describe ${CI_COMMIT_SHA})
- echo ${VERSION:1} > VERSION - echo ${VERSION:1} > VERSION
- > - >
git diff-index --quiet HEAD || git diff-index --quiet HEAD ||

View File

@ -1 +1 @@
3.0.0-alpha6-266-g5776891b7

View File

@ -551,7 +551,7 @@ class Rotation:
Parameters Parameters
---------- ----------
degrees : bool, optional degrees : bool, optional
Return angles in degrees. Return angles in degrees. Defaults to False.
Returns Returns
------- -------
@ -1096,8 +1096,8 @@ class Rotation:
@staticmethod @staticmethod
def from_fiber_component(alpha: IntSequence, def from_fiber_component(crystal: IntSequence,
beta: IntSequence, sample: IntSequence,
sigma: float = 0.0, sigma: float = 0.0,
shape: Union[int, IntSequence] = None, shape: Union[int, IntSequence] = None,
degrees: bool = True, degrees: bool = True,
@ -1107,9 +1107,9 @@ class Rotation:
Parameters Parameters
---------- ----------
alpha : numpy.ndarray, shape (2) crystal : numpy.ndarray, shape (2)
Polar coordinates (phi from x, theta from z) of fiber direction in crystal frame. Polar coordinates (phi from x, theta from z) of fiber direction in crystal frame.
beta : numpy.ndarray, shape (2) sample : numpy.ndarray, shape (2)
Polar coordinates (phi from x, theta from z) of fiber direction in sample frame. Polar coordinates (phi from x, theta from z) of fiber direction in sample frame.
sigma : float, optional sigma : float, optional
Standard deviation of (Gaussian) misorientation distribution. Standard deviation of (Gaussian) misorientation distribution.
@ -1117,15 +1117,15 @@ 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, alpha, and beta are given in degrees. sigma and polar coordinates are given in degrees.
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.
""" """
rng = np.random.default_rng(rng_seed) rng = np.random.default_rng(rng_seed)
sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,alpha,beta)) if degrees else \ sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \
map(np.array, (sigma,alpha,beta)) map(np.array, (sigma,crystal,sample))
d_cr = np.array([np.sin(alpha_[0])*np.cos(alpha_[1]), np.sin(alpha_[0])*np.sin(alpha_[1]), np.cos(alpha_[0])]) d_cr = np.array([np.sin(alpha_[0])*np.cos(alpha_[1]), np.sin(alpha_[0])*np.sin(alpha_[1]), np.cos(alpha_[0])])
d_lab = np.array([np.sin( beta_[0])*np.cos( beta_[1]), np.sin( beta_[0])*np.sin( beta_[1]), np.cos( beta_[0])]) d_lab = np.array([np.sin( beta_[0])*np.cos( beta_[1]), np.sin( beta_[0])*np.sin( beta_[1]), np.cos( beta_[0])])

View File

@ -150,10 +150,12 @@ class TestOrientation:
== np.eye(3)) == np.eye(3))
def test_from_fiber_component(self): def test_from_fiber_component(self):
r = Rotation.from_fiber_component(alpha=np.zeros(2),beta=np.zeros(2), crystal = np.random.rand(2) * [180,360]
sample = np.random.rand(2) * [180,360]
r = Rotation.from_fiber_component(crystal=crystal,sample=sample,
sigma=0.0,shape=1,rng_seed=0) sigma=0.0,shape=1,rng_seed=0)
assert np.all(Orientation.from_fiber_component(alpha=np.zeros(2),beta=np.zeros(2), assert np.all(Orientation.from_fiber_component(crystal=crystal,sample=sample,
sigma=0.0,shape=None,rng_seed=0,family='triclinic').quaternion sigma=0.0,shape=None,rng_seed=0,lattice='cI').quaternion
== r.quaternion) == r.quaternion)
@pytest.mark.parametrize('kwargs',[ @pytest.mark.parametrize('kwargs',[