additional, self-explanatory tests

This commit is contained in:
Martin Diehl 2023-11-07 00:10:13 +01:00
parent f687e0a433
commit 1855bafd6a
22 changed files with 24 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,8 @@
import pytest import pytest
import numpy as np import numpy as np
from itertools import permutations from itertools import permutations
from matplotlib import pyplot as plt
from PIL import Image
from damask import Rotation from damask import Rotation
from damask import Orientation from damask import Orientation
@ -520,3 +522,25 @@ class TestOrientation:
def test_mul_invalid(self): def test_mul_invalid(self):
with pytest.raises(TypeError): with pytest.raises(TypeError):
Orientation.from_random(lattice='cF')*np.ones(3) Orientation.from_random(lattice='cF')*np.ones(3)
@pytest.mark.parametrize('OR',['KS','NW','GT','GT_prime','Bain','Pitsch'])
@pytest.mark.parametrize('pole',[[0,0,1],[0,1,1],[1,1,1]])
def test_OR_plot(self,update,res_path,tmp_path,OR,pole):
# https://doi.org/10.3390/cryst13040663 for comparison
O = Orientation(lattice='cF')
poles = O.related(OR).to_pole(uvw=pole,with_symmetry=True).reshape(-1,3)
points = util.project_equal_area(poles,'z')
fig, ax = plt.subplots()
c = plt.Circle((0,0),1, color='k',fill=False)
ax.add_patch(c)
ax.scatter(points[:,0],points[:,1])
ax.set_aspect('equal', 'box')
fname=f'{OR}-{"".join(map(str,pole))}.png'
plt.axis('off')
plt.savefig(tmp_path/fname)
if update: plt.savefig(res_path/fname)
current = np.array(Image.open(tmp_path/fname))
reference = np.array(Image.open(res_path/fname))
assert np.allclose(current,reference)