diff --git a/python/tests/reference/Rotation/bcc_Bain.txt b/python/tests/reference/Rotation/bcc_Bain.txt new file mode 100644 index 000000000..e1675cd32 --- /dev/null +++ b/python/tests/reference/Rotation/bcc_Bain.txt @@ -0,0 +1,5 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +0.0 45.00000000000001 0.0 +90.0 45.00000000000001 270.0 +45.00000000000001 0.0 0.0 diff --git a/python/tests/reference/Rotation/bcc_GT.txt b/python/tests/reference/Rotation/bcc_GT.txt new file mode 100644 index 000000000..b4bfd5d8f --- /dev/null +++ b/python/tests/reference/Rotation/bcc_GT.txt @@ -0,0 +1,26 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +283.60440567265294 9.976439066337804 33.24637065555936 +167.8261034151001 43.397849654402556 183.40022280897963 +262.1156357053931 43.82007387041961 104.07478363123654 +103.604405672653 9.976439066337804 213.24637065555936 +347.8261034151001 43.39784965440255 3.400222808979685 +82.11563570539313 43.82007387041961 284.0747836312365 +76.39559432734703 9.976439066337806 326.75362934444064 +192.17389658489986 43.397849654402556 176.59977719102034 +97.88436429460687 43.82007387041961 255.92521636876344 +256.395594327347 9.976439066337804 146.75362934444064 +12.173896584899929 43.39784965440254 356.59977719102034 +277.8843642946069 43.82007387041961 75.92521636876346 +102.17389658489992 43.39784965440254 266.59977719102034 +346.395594327347 9.976439066337804 56.75362934444064 +7.884364294606862 43.82007387041961 345.9252163687635 +282.17389658489986 43.39784965440254 86.59977719102032 +166.39559432734703 9.976439066337804 236.75362934444058 +187.88436429460683 43.82007387041961 165.92521636876344 +257.8261034151001 43.39784965440255 93.40022280897969 +13.604405672652977 9.976439066337804 303.24637065555936 +352.1156357053931 43.82007387041961 14.074783631236542 +77.82610341510008 43.397849654402556 273.4002228089796 +193.60440567265297 9.976439066337806 123.24637065555939 +153.65751914298576 65.6559553854118 185.90444335627936 diff --git a/python/tests/reference/Rotation/bcc_GT_prime.txt b/python/tests/reference/Rotation/bcc_GT_prime.txt new file mode 100644 index 000000000..73c3bb6b3 --- /dev/null +++ b/python/tests/reference/Rotation/bcc_GT_prime.txt @@ -0,0 +1,26 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +303.24637065555936 9.976439066337804 13.604405672652977 +165.92521636876344 43.82007387041961 187.88436429460683 +266.59977719102034 43.39784965440254 102.17389658489992 +123.24637065555939 9.976439066337804 193.604405672653 +345.9252163687635 43.82007387041961 7.884364294606862 +86.59977719102032 43.39784965440254 282.17389658489986 +56.75362934444064 9.976439066337804 346.395594327347 +194.07478363123653 43.82007387041961 172.11563570539317 +93.40022280897969 43.39784965440255 257.8261034151001 +236.75362934444058 9.976439066337804 166.39559432734697 +14.074783631236542 43.82007387041961 352.1156357053931 +273.4002228089796 43.397849654402556 77.82610341510008 +104.07478363123654 43.82007387041961 262.1156357053931 +326.75362934444064 9.976439066337806 76.39559432734703 +3.400222808979685 43.39784965440255 347.8261034151001 +284.0747836312365 43.82007387041961 82.11563570539313 +146.75362934444064 9.976439066337804 256.395594327347 +183.40022280897963 43.397849654402556 167.8261034151001 +255.92521636876344 43.82007387041961 97.88436429460687 +33.24637065555936 9.976439066337804 283.60440567265294 +26.291675350407385 65.60048732963618 354.34378938496315 +75.92521636876346 43.82007387041961 277.8843642946069 +213.24637065555936 9.976439066337804 103.604405672653 +176.59977719102034 43.397849654402556 192.17389658489986 diff --git a/python/tests/reference/Rotation/bcc_KS.txt b/python/tests/reference/Rotation/bcc_KS.txt new file mode 100644 index 000000000..0add535bb --- /dev/null +++ b/python/tests/reference/Rotation/bcc_KS.txt @@ -0,0 +1,26 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +335.7965716606702 10.528779365509317 65.79657166067024 +228.77270547567446 80.40593177313953 85.64260312151849 +131.22729452432552 80.40593177313954 4.357396878481506 +24.20342833932977 10.52877936550932 24.20342833932976 +221.95489158457983 85.70366403943002 80.37863910890589 +138.04510841542015 85.70366403943004 9.621360891094124 +131.22729452432552 80.40593177313953 94.35739687848151 +24.203428339329765 10.52877936550932 114.20342833932976 +221.95489158457983 85.70366403943004 170.37863910890587 +138.04510841542015 85.70366403943004 99.62136089109411 +335.7965716606702 10.52877936550932 155.79657166067025 +228.77270547567448 80.40593177313954 175.6426031215185 +335.7965716606702 10.52877936550932 335.7965716606702 +228.77270547567448 80.40593177313954 355.6426031215185 +131.2272945243255 80.40593177313954 274.35739687848144 +24.203428339329747 10.52877936550932 294.2034283393298 +221.95489158457985 85.70366403943004 350.3786391089059 +138.04510841542015 85.70366403943004 279.6213608910941 +41.95489158457986 94.29633596056998 9.621360891094133 +318.04510841542015 94.29633596056996 80.37863910890589 +155.79657166067025 169.4712206344907 24.203428339329754 +48.77270547567448 99.59406822686046 4.357396878481504 +311.2272945243255 99.59406822686046 85.64260312151852 +204.20342833932975 169.4712206344907 65.79657166067024 diff --git a/python/tests/reference/Rotation/bcc_NW.txt b/python/tests/reference/Rotation/bcc_NW.txt new file mode 100644 index 000000000..8d3dfbe84 --- /dev/null +++ b/python/tests/reference/Rotation/bcc_NW.txt @@ -0,0 +1,14 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +225.41555594321144 83.13253115922213 83.08266205989301 +134.58444405678856 83.13253115922211 6.917337940107012 +4.702125169424418e-15 9.735610317245317 45.0 +134.58444405678856 83.13253115922213 276.91733794010696 +225.4155559432114 83.13253115922213 353.082662059893 +0.0 9.735610317245317 315.0 +134.58444405678858 83.13253115922213 96.91733794010702 +225.41555594321142 83.13253115922213 173.082662059893 +0.0 9.735610317245317 135.0 +260.40196970123213 45.81931182053556 283.6387072794765 +260.40196970123213 45.81931182053556 283.6387072794765 +180.0 99.73561031724535 225.0 diff --git a/python/tests/reference/Rotation/bcc_Pitsch.txt b/python/tests/reference/Rotation/bcc_Pitsch.txt new file mode 100644 index 000000000..dc9926ca1 --- /dev/null +++ b/python/tests/reference/Rotation/bcc_Pitsch.txt @@ -0,0 +1,14 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +6.9173379401070045 83.13253115922213 44.58444405678856 +45.0 89.99999999999999 279.7356103172453 +166.36129272052352 45.819311820535574 279.59803029876787 +83.08266205989301 83.13253115922213 225.41555594321144 +256.3612927205235 45.819311820535574 189.59803029876787 +315.0 90.0 9.735610317245369 +186.917337940107 83.13253115922213 224.58444405678856 +315.0 90.0 80.26438968275463 +13.638707279476478 45.81931182053557 260.40196970123213 +263.082662059893 83.13253115922213 45.415555943211444 +103.63870727947646 45.819311820535574 170.40196970123213 +224.99999999999997 90.0 170.26438968275465 diff --git a/python/tests/reference/Rotation/fcc_Bain.txt b/python/tests/reference/Rotation/fcc_Bain.txt new file mode 100644 index 000000000..2c12eecc9 --- /dev/null +++ b/python/tests/reference/Rotation/fcc_Bain.txt @@ -0,0 +1,5 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +180.0 45.00000000000001 180.0 +270.0 45.00000000000001 90.0 +315.0 0.0 0.0 diff --git a/python/tests/reference/Rotation/fcc_GT.txt b/python/tests/reference/Rotation/fcc_GT.txt new file mode 100644 index 000000000..e695d0d6f --- /dev/null +++ b/python/tests/reference/Rotation/fcc_GT.txt @@ -0,0 +1,26 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +146.75362934444064 9.976439066337804 256.395594327347 +356.59977719102034 43.39784965440254 12.173896584899929 +75.92521636876346 43.82007387041961 277.8843642946069 +326.75362934444064 9.976439066337806 76.39559432734703 +176.59977719102034 43.397849654402556 192.17389658489986 +255.92521636876344 43.82007387041961 97.88436429460687 +213.24637065555936 9.976439066337804 103.604405672653 +3.400222808979685 43.39784965440255 347.8261034151001 +284.0747836312365 43.82007387041961 82.11563570539313 +33.24637065555936 9.976439066337804 283.60440567265294 +183.40022280897963 43.397849654402556 167.8261034151001 +104.07478363123654 43.82007387041961 262.1156357053931 +273.4002228089796 43.397849654402556 77.82610341510008 +123.24637065555939 9.976439066337806 193.60440567265297 +194.07478363123653 43.82007387041961 172.11563570539317 +93.40022280897969 43.39784965440255 257.8261034151001 +303.24637065555936 9.976439066337804 13.604405672652977 +14.074783631236542 43.82007387041961 352.1156357053931 +86.59977719102032 43.39784965440254 282.17389658489986 +236.75362934444058 9.976439066337804 166.39559432734703 +165.92521636876344 43.82007387041961 187.88436429460683 +266.59977719102034 43.39784965440254 102.17389658489992 +56.75362934444064 9.976439066337804 346.395594327347 +354.0955566437206 65.6559553854118 26.342480857014277 diff --git a/python/tests/reference/Rotation/fcc_GT_prime.txt b/python/tests/reference/Rotation/fcc_GT_prime.txt new file mode 100644 index 000000000..7df7cb6c1 --- /dev/null +++ b/python/tests/reference/Rotation/fcc_GT_prime.txt @@ -0,0 +1,26 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +166.39559432734697 9.976439066337804 236.75362934444058 +352.1156357053931 43.82007387041961 14.074783631236542 +77.82610341510008 43.397849654402556 273.4002228089796 +346.395594327347 9.976439066337804 56.75362934444064 +172.11563570539317 43.82007387041961 194.07478363123653 +257.8261034151001 43.39784965440255 93.40022280897969 +193.604405672653 9.976439066337804 123.24637065555939 +7.884364294606862 43.82007387041961 345.9252163687635 +282.17389658489986 43.39784965440254 86.59977719102032 +13.604405672652977 9.976439066337804 303.24637065555936 +187.88436429460683 43.82007387041961 165.92521636876344 +102.17389658489992 43.39784965440254 266.59977719102034 +277.8843642946069 43.82007387041961 75.92521636876346 +103.604405672653 9.976439066337804 213.24637065555936 +192.17389658489986 43.397849654402556 176.59977719102034 +97.88436429460687 43.82007387041961 255.92521636876344 +283.60440567265294 9.976439066337804 33.24637065555936 +12.173896584899929 43.39784965440254 356.59977719102034 +82.11563570539313 43.82007387041961 284.0747836312365 +256.395594327347 9.976439066337804 146.75362934444064 +185.65621061503683 65.60048732963617 153.70832464959264 +262.1156357053931 43.82007387041961 104.07478363123654 +76.39559432734703 9.976439066337806 326.75362934444064 +347.8261034151001 43.39784965440255 3.400222808979685 diff --git a/python/tests/reference/Rotation/fcc_KS.txt b/python/tests/reference/Rotation/fcc_KS.txt new file mode 100644 index 000000000..3a6e30358 --- /dev/null +++ b/python/tests/reference/Rotation/fcc_KS.txt @@ -0,0 +1,26 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +114.20342833932975 10.52877936550932 204.20342833932972 +94.3573968784815 80.40593177313954 311.22729452432543 +175.6426031215185 80.40593177313954 48.77270547567447 +155.79657166067025 10.52877936550932 155.79657166067025 +99.62136089109411 85.70366403943004 318.04510841542015 +170.37863910890587 85.70366403943002 41.954891584579855 +85.64260312151852 80.40593177313954 48.77270547567448 +65.79657166067024 10.52877936550932 155.79657166067025 +9.621360891094124 85.70366403943004 318.04510841542015 +80.37863910890587 85.70366403943004 41.95489158457987 +24.203428339329758 10.52877936550932 204.20342833932975 +4.357396878481486 80.40593177313954 311.2272945243255 +204.20342833932972 10.52877936550932 204.20342833932972 +184.35739687848147 80.40593177313954 311.2272945243255 +265.64260312151845 80.40593177313953 48.77270547567449 +245.79657166067025 10.528779365509317 155.79657166067025 +189.62136089109413 85.70366403943004 318.04510841542015 +260.3786391089059 85.70366403943002 41.954891584579855 +170.37863910890587 94.29633596056996 138.04510841542015 +99.62136089109411 94.29633596056998 221.95489158457983 +155.79657166067025 169.4712206344907 24.203428339329754 +175.64260312151848 99.59406822686046 131.22729452432552 +94.35739687848151 99.59406822686046 228.77270547567446 +114.20342833932975 169.4712206344907 335.7965716606702 diff --git a/python/tests/reference/Rotation/fcc_NW.txt b/python/tests/reference/Rotation/fcc_NW.txt new file mode 100644 index 000000000..bf3631db0 --- /dev/null +++ b/python/tests/reference/Rotation/fcc_NW.txt @@ -0,0 +1,14 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +96.91733794010702 83.13253115922213 314.5844440567886 +173.082662059893 83.13253115922211 45.41555594321143 +135.0 9.735610317245317 180.0 +263.082662059893 83.13253115922213 45.415555943211444 +186.91733794010702 83.13253115922211 314.5844440567886 +224.99999999999997 9.735610317245317 180.0 +83.082662059893 83.13253115922213 45.415555943211444 +6.917337940106983 83.13253115922211 314.5844440567886 +45.0 9.73561031724532 180.0 +256.36129272052347 45.81931182053556 279.59803029876775 +256.36129272052347 45.81931182053556 279.59803029876775 +315.0 99.73561031724536 0.0 diff --git a/python/tests/reference/Rotation/fcc_Pitsch.txt b/python/tests/reference/Rotation/fcc_Pitsch.txt new file mode 100644 index 000000000..a2369f0a4 --- /dev/null +++ b/python/tests/reference/Rotation/fcc_Pitsch.txt @@ -0,0 +1,14 @@ +1 header +1_Eulers 2_Eulers 3_Eulers +135.41555594321144 83.13253115922213 173.082662059893 +260.26438968275465 90.0 135.0 +260.40196970123213 45.81931182053557 13.638707279476478 +314.5844440567886 83.13253115922213 96.91733794010702 +350.40196970123213 45.81931182053557 283.6387072794765 +170.26438968275465 90.0 224.99999999999997 +315.4155559432114 83.13253115922213 353.08266205989304 +99.73561031724536 90.0 225.0 +279.59803029876787 45.819311820535574 166.36129272052352 +134.58444405678856 83.13253115922213 276.91733794010696 +9.598030298767851 45.819311820535574 76.36129272052355 +9.735610317245369 90.0 315.0 diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 79d674bcd..a4dc7c61d 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1,6 +1,9 @@ +import os + import pytest import numpy as np +import damask from damask import Rotation from damask import Orientation @@ -11,6 +14,11 @@ def default(): """A set of n random rotations.""" return [Rotation.fromRandom() for r in range(n)] +@pytest.fixture +def reference_dir(reference_dir_base): + """Directory containing reference results.""" + return os.path.join(reference_dir_base,'Rotation') + class TestRotation: @@ -59,3 +67,13 @@ class TestRotation: misorientation = ori.rotation.misorientation(ori2.rotation) assert misorientation.asAxisAngle(degrees=True)[3]<1.0e-5 + @pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch']) + @pytest.mark.parametrize('lattice',['fcc','bcc']) + def test_relationship_reference(self,update,reference_dir,model,lattice): + reference = os.path.join(reference_dir,'{}_{}.txt'.format(lattice,model)) + ori = Orientation(Rotation(),lattice) + eu = np.array([o.rotation.asEulers(degrees=True) for o in ori.relatedOrientations(model)]) + if update: + table = damask.Table(eu,{'Eulers':(3,)}) + table.to_ASCII(reference) + assert np.allclose(eu,damask.Table.from_ASCII(reference).get('Eulers'))