better split
This commit is contained in:
parent
3d6afff27a
commit
6e27a140f6
|
@ -1,7 +1,10 @@
|
|||
import os
|
||||
import numpy as np
|
||||
|
||||
import pytest
|
||||
|
||||
from damask import Rotation
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--update",
|
||||
action="store_true",
|
||||
|
@ -16,3 +19,79 @@ def update(request):
|
|||
def reference_dir_base():
|
||||
"""Directory containing reference results."""
|
||||
return os.path.join(os.path.dirname(__file__),'reference')
|
||||
|
||||
@pytest.fixture
|
||||
def set_of_rotations():
|
||||
"""A set of n random rotations."""
|
||||
n = 1100
|
||||
scatter=1.e-2
|
||||
specials = np.array([
|
||||
[1.0, 0.0, 0.0, 0.0],
|
||||
#----------------------
|
||||
[0.0, 1.0, 0.0, 0.0],
|
||||
[0.0, 0.0, 1.0, 0.0],
|
||||
[0.0, 0.0, 0.0, 1.0],
|
||||
[0.0,-1.0, 0.0, 0.0],
|
||||
[0.0, 0.0,-1.0, 0.0],
|
||||
[0.0, 0.0, 0.0,-1.0],
|
||||
#----------------------
|
||||
[1.0, 1.0, 0.0, 0.0],
|
||||
[1.0, 0.0, 1.0, 0.0],
|
||||
[1.0, 0.0, 0.0, 1.0],
|
||||
[0.0, 1.0, 1.0, 0.0],
|
||||
[0.0, 1.0, 0.0, 1.0],
|
||||
[0.0, 0.0, 1.0, 1.0],
|
||||
#----------------------
|
||||
[1.0,-1.0, 0.0, 0.0],
|
||||
[1.0, 0.0,-1.0, 0.0],
|
||||
[1.0, 0.0, 0.0,-1.0],
|
||||
[0.0, 1.0,-1.0, 0.0],
|
||||
[0.0, 1.0, 0.0,-1.0],
|
||||
[0.0, 0.0, 1.0,-1.0],
|
||||
#----------------------
|
||||
[0.0, 1.0,-1.0, 0.0],
|
||||
[0.0, 1.0, 0.0,-1.0],
|
||||
[0.0, 0.0, 1.0,-1.0],
|
||||
#----------------------
|
||||
[0.0,-1.0,-1.0, 0.0],
|
||||
[0.0,-1.0, 0.0,-1.0],
|
||||
[0.0, 0.0,-1.0,-1.0],
|
||||
#----------------------
|
||||
[1.0, 1.0, 1.0, 0.0],
|
||||
[1.0, 1.0, 0.0, 1.0],
|
||||
[1.0, 0.0, 1.0, 1.0],
|
||||
[1.0,-1.0, 1.0, 0.0],
|
||||
[1.0,-1.0, 0.0, 1.0],
|
||||
[1.0, 0.0,-1.0, 1.0],
|
||||
[1.0, 1.0,-1.0, 0.0],
|
||||
[1.0, 1.0, 0.0,-1.0],
|
||||
[1.0, 0.0, 1.0,-1.0],
|
||||
[1.0,-1.0,-1.0, 0.0],
|
||||
[1.0,-1.0, 0.0,-1.0],
|
||||
[1.0, 0.0,-1.0,-1.0],
|
||||
#----------------------
|
||||
[0.0, 1.0, 1.0, 1.0],
|
||||
[0.0, 1.0,-1.0, 1.0],
|
||||
[0.0, 1.0, 1.0,-1.0],
|
||||
[0.0,-1.0, 1.0, 1.0],
|
||||
[0.0,-1.0,-1.0, 1.0],
|
||||
[0.0,-1.0, 1.0,-1.0],
|
||||
[0.0,-1.0,-1.0,-1.0],
|
||||
#----------------------
|
||||
[1.0, 1.0, 1.0, 1.0],
|
||||
[1.0,-1.0, 1.0, 1.0],
|
||||
[1.0, 1.0,-1.0, 1.0],
|
||||
[1.0, 1.0, 1.0,-1.0],
|
||||
[1.0,-1.0,-1.0, 1.0],
|
||||
[1.0,-1.0, 1.0,-1.0],
|
||||
[1.0, 1.0,-1.0,-1.0],
|
||||
[1.0,-1.0,-1.0,-1.0],
|
||||
])
|
||||
specials /= np.linalg.norm(specials,axis=1).reshape(-1,1)
|
||||
specials_scatter = specials + np.broadcast_to(np.random.rand(4)*scatter,specials.shape)
|
||||
specials_scatter /= np.linalg.norm(specials_scatter,axis=1).reshape(-1,1)
|
||||
specials_scatter[specials_scatter[:,0]<0]*=-1
|
||||
|
||||
return [Rotation.from_quaternion(s) for s in specials] + \
|
||||
[Rotation.from_quaternion(s) for s in specials_scatter] + \
|
||||
[Rotation.from_random() for _ in range(n-len(specials)-len(specials_scatter))]
|
||||
|
|
|
@ -9,83 +9,6 @@ from damask import _rotation
|
|||
n = 1000
|
||||
atol=1.e-4
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def set_of_rotations():
|
||||
"""A set of n random rotations."""
|
||||
n = 1100
|
||||
scatter=1.e-2
|
||||
specials = np.array([
|
||||
[1.0, 0.0, 0.0, 0.0],
|
||||
#----------------------
|
||||
[0.0, 1.0, 0.0, 0.0],
|
||||
[0.0, 0.0, 1.0, 0.0],
|
||||
[0.0, 0.0, 0.0, 1.0],
|
||||
[0.0,-1.0, 0.0, 0.0],
|
||||
[0.0, 0.0,-1.0, 0.0],
|
||||
[0.0, 0.0, 0.0,-1.0],
|
||||
#----------------------
|
||||
[1.0, 1.0, 0.0, 0.0],
|
||||
[1.0, 0.0, 1.0, 0.0],
|
||||
[1.0, 0.0, 0.0, 1.0],
|
||||
[0.0, 1.0, 1.0, 0.0],
|
||||
[0.0, 1.0, 0.0, 1.0],
|
||||
[0.0, 0.0, 1.0, 1.0],
|
||||
#----------------------
|
||||
[1.0,-1.0, 0.0, 0.0],
|
||||
[1.0, 0.0,-1.0, 0.0],
|
||||
[1.0, 0.0, 0.0,-1.0],
|
||||
[0.0, 1.0,-1.0, 0.0],
|
||||
[0.0, 1.0, 0.0,-1.0],
|
||||
[0.0, 0.0, 1.0,-1.0],
|
||||
#----------------------
|
||||
[0.0, 1.0,-1.0, 0.0],
|
||||
[0.0, 1.0, 0.0,-1.0],
|
||||
[0.0, 0.0, 1.0,-1.0],
|
||||
#----------------------
|
||||
[0.0,-1.0,-1.0, 0.0],
|
||||
[0.0,-1.0, 0.0,-1.0],
|
||||
[0.0, 0.0,-1.0,-1.0],
|
||||
#----------------------
|
||||
[1.0, 1.0, 1.0, 0.0],
|
||||
[1.0, 1.0, 0.0, 1.0],
|
||||
[1.0, 0.0, 1.0, 1.0],
|
||||
[1.0,-1.0, 1.0, 0.0],
|
||||
[1.0,-1.0, 0.0, 1.0],
|
||||
[1.0, 0.0,-1.0, 1.0],
|
||||
[1.0, 1.0,-1.0, 0.0],
|
||||
[1.0, 1.0, 0.0,-1.0],
|
||||
[1.0, 0.0, 1.0,-1.0],
|
||||
[1.0,-1.0,-1.0, 0.0],
|
||||
[1.0,-1.0, 0.0,-1.0],
|
||||
[1.0, 0.0,-1.0,-1.0],
|
||||
#----------------------
|
||||
[0.0, 1.0, 1.0, 1.0],
|
||||
[0.0, 1.0,-1.0, 1.0],
|
||||
[0.0, 1.0, 1.0,-1.0],
|
||||
[0.0,-1.0, 1.0, 1.0],
|
||||
[0.0,-1.0,-1.0, 1.0],
|
||||
[0.0,-1.0, 1.0,-1.0],
|
||||
[0.0,-1.0,-1.0,-1.0],
|
||||
#----------------------
|
||||
[1.0, 1.0, 1.0, 1.0],
|
||||
[1.0,-1.0, 1.0, 1.0],
|
||||
[1.0, 1.0,-1.0, 1.0],
|
||||
[1.0, 1.0, 1.0,-1.0],
|
||||
[1.0,-1.0,-1.0, 1.0],
|
||||
[1.0,-1.0, 1.0,-1.0],
|
||||
[1.0, 1.0,-1.0,-1.0],
|
||||
[1.0,-1.0,-1.0,-1.0],
|
||||
])
|
||||
specials /= np.linalg.norm(specials,axis=1).reshape(-1,1)
|
||||
specials_scatter = specials + np.broadcast_to(np.random.rand(4)*scatter,specials.shape)
|
||||
specials_scatter /= np.linalg.norm(specials_scatter,axis=1).reshape(-1,1)
|
||||
specials_scatter[specials_scatter[:,0]<0]*=-1
|
||||
|
||||
return [Rotation.from_quaternion(s) for s in specials] + \
|
||||
[Rotation.from_quaternion(s) for s in specials_scatter] + \
|
||||
[Rotation.from_random() for _ in range(n-len(specials)-len(specials_scatter))]
|
||||
|
||||
@pytest.fixture
|
||||
def reference_dir(reference_dir_base):
|
||||
"""Directory containing reference results."""
|
||||
|
|
Loading…
Reference in New Issue