handle floating point errors

This commit is contained in:
Martin Diehl 2021-03-25 22:32:09 +01:00
parent 8b2281af98
commit 9e9eb391ba
2 changed files with 60 additions and 58 deletions

View File

@ -1320,7 +1320,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.3106678335065741, -0.21779766497005681, 0.09214584007574673, 0.9206295772538797]
- O: [0.31066783350657406, -0.21779766497005681, 0.09214584007574673, 0.9206295772538797]
phase: 1
v: 1.0
homogenization: direct
@ -6145,7 +6145,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7229346828273859, 0.6685599713651128, 0.08624285203524544, -0.151509668095384]
- O: [0.7229346828273859, 0.6685599713651128, 0.08624285203524544, -0.15150966809538396]
phase: 1
v: 1.0
homogenization: direct
@ -7905,7 +7905,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.931126859733525, -0.188840906559267, -0.028336139598628726, -0.3107071712807828]
- O: [0.931126859733525, -0.188840906559267, -0.02833613959862872, -0.3107071712807828]
phase: 1
v: 1.0
homogenization: direct
@ -9565,7 +9565,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.11865322052371209, -0.30655694491708946, 0.4154484877145501, -0.8481431523263895]
- O: [0.11865322052371209, -0.3065569449170895, 0.4154484877145501, -0.8481431523263895]
phase: 1
v: 1.0
homogenization: direct
@ -10020,7 +10020,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7710983914563474, -0.25797372805099167, 0.06002968724073645, -0.5790105896947706]
- O: [0.7710983914563474, -0.25797372805099167, 0.06002968724073646, -0.5790105896947706]
phase: 1
v: 1.0
homogenization: direct
@ -10030,7 +10030,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.35438790449292706, -0.7304914461669942, 0.4546738255560747, -0.3661463813561039]
- O: [0.35438790449292706, -0.7304914461669942, 0.45467382555607483, -0.3661463813561039]
phase: 1
v: 1.0
homogenization: direct
@ -11370,7 +11370,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7243608788790047, 0.6637631628425261, 0.10268145117209244, -0.15548729976469167]
- O: [0.7243608788790047, 0.6637631628425261, 0.10268145117209243, -0.15548729976469167]
phase: 1
v: 1.0
homogenization: direct
@ -11905,7 +11905,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.4441903200882, -0.5529905706737287, 0.6935425610206521, 0.12607578807527303]
- O: [0.44419032008820003, -0.5529905706737287, 0.6935425610206521, 0.12607578807527303]
phase: 1
v: 1.0
homogenization: direct
@ -13445,7 +13445,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.6697470295795691, 0.6829830719241006, 0.1831146806638964, -0.22680840716301023]
- O: [0.6697470295795691, 0.6829830719241006, 0.18311468066389644, -0.22680840716301023]
phase: 1
v: 1.0
homogenization: direct
@ -14395,7 +14395,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.9420844797399965, 0.25883464708013926, -0.15857648026162938, 0.14260069569168562]
- O: [0.9420844797399966, 0.25883464708013926, -0.15857648026162938, 0.14260069569168562]
phase: 1
v: 1.0
homogenization: direct
@ -14690,7 +14690,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.033965862583657844, 0.3898743005244644, -0.021104332173659597, -0.9199994332242882]
- O: [0.033965862583657844, 0.38987430052446437, -0.021104332173659594, -0.9199994332242882]
phase: 1
v: 1.0
homogenization: direct
@ -15495,7 +15495,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.44743306908118824, -0.8476542309437225, -0.07321245604536979, 0.27554652916630923]
- O: [0.4474330690811882, -0.8476542309437225, -0.07321245604536979, 0.27554652916630923]
phase: 1
v: 1.0
homogenization: direct
@ -18035,7 +18035,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.5678359403213665, 0.0787457043545185, 0.2615872285658415, 0.7764879785137065]
- O: [0.5678359403213665, 0.07874570435451851, 0.2615872285658415, 0.7764879785137065]
phase: 1
v: 1.0
homogenization: direct
@ -18380,7 +18380,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.45754782565553354, -0.8464334117650875, -0.078012752396648, 0.26098750381791624]
- O: [0.45754782565553354, -0.8464334117650875, -0.078012752396648, 0.2609875038179162]
phase: 1
v: 1.0
homogenization: direct
@ -21065,7 +21065,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.15856773796560275, -0.8551430307243139, -0.16291561140092078, 0.4658810717790231]
- O: [0.15856773796560278, -0.8551430307243139, -0.16291561140092078, 0.4658810717790231]
phase: 1
v: 1.0
homogenization: direct
@ -21105,7 +21105,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.07292595716243482, 0.6341236234582911, 0.6589981632125096, 0.39785733099518056]
- O: [0.0729259571624348, 0.6341236234582911, 0.6589981632125096, 0.39785733099518056]
phase: 1
v: 1.0
homogenization: direct
@ -21190,7 +21190,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.8101586668979511, 0.20957597947719434, 0.12829598334751466, -0.5322226826556751]
- O: [0.8101586668979511, 0.20957597947719434, 0.12829598334751469, -0.5322226826556751]
phase: 1
v: 1.0
homogenization: direct
@ -21415,7 +21415,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.05494306688207128, 0.5737114639476909, -0.7876822531704588, -0.21769952589957298]
- O: [0.054943066882071276, 0.5737114639476909, -0.7876822531704588, -0.21769952589957298]
phase: 1
v: 1.0
homogenization: direct
@ -21710,7 +21710,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.14915138908745934, -0.8562445741042877, -0.1601548081104835, 0.4679204311518599]
- O: [0.14915138908745934, -0.8562445741042877, -0.16015480811048352, 0.4679204311518599]
phase: 1
v: 1.0
homogenization: direct
@ -23870,7 +23870,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.523752232028536, 0.7737953530354785, -0.2063937125069779, -0.29038937050693264]
- O: [0.523752232028536, 0.7737953530354786, -0.20639371250697794, -0.29038937050693264]
phase: 1
v: 1.0
homogenization: direct
@ -25830,7 +25830,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7957667481488323, 0.4476552551183933, -0.1758152425875816, 0.3680340413323053]
- O: [0.7957667481488323, 0.4476552551183933, -0.1758152425875816, 0.36803404133230533]
phase: 1
v: 1.0
homogenization: direct
@ -26700,7 +26700,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.4408305262512665, -0.8243331876591884, 0.30124916847267375, 0.18812809822882767]
- O: [0.4408305262512665, -0.8243331876591884, 0.30124916847267375, 0.1881280982288277]
phase: 1
v: 1.0
homogenization: direct
@ -27520,7 +27520,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.4416212269855147, 0.5173707873219501, 0.7244227935501028, 0.11184711210728344]
- O: [0.4416212269855147, 0.51737078732195, 0.7244227935501028, 0.11184711210728344]
phase: 1
v: 1.0
homogenization: direct
@ -27530,7 +27530,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.6859450548749442, 0.06276476679179419, 0.4349571469213327, 0.5799588313701549]
- O: [0.6859450548749442, 0.0627647667917942, 0.43495714692133275, 0.5799588313701549]
phase: 1
v: 1.0
homogenization: direct
@ -27540,7 +27540,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7176823153423195, 0.09542057499927085, -0.4443698021852411, -0.5276006889850936]
- O: [0.7176823153423195, 0.09542057499927087, -0.4443698021852411, -0.5276006889850936]
phase: 1
v: 1.0
homogenization: direct
@ -29955,7 +29955,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.5959382011529282, -0.46777492923475683, -0.09801282849081705, -0.6453198907807352]
- O: [0.5959382011529282, -0.46777492923475683, -0.09801282849081705, -0.6453198907807353]
phase: 1
v: 1.0
homogenization: direct
@ -31070,7 +31070,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.4406006220873552, -0.31937401853421743, 0.1303472021126782, -0.8287828032741376]
- O: [0.4406006220873551, -0.31937401853421743, 0.1303472021126782, -0.8287828032741376]
phase: 1
v: 1.0
homogenization: direct
@ -31930,7 +31930,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7993341974700379, 0.3949133472602586, -0.3825888485301062, 0.24235111283226318]
- O: [0.7993341974700379, 0.3949133472602586, -0.3825888485301062, 0.24235111283226313]
phase: 1
v: 1.0
homogenization: direct
@ -37735,7 +37735,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7052795411761517, -0.302620499177384, 0.1015944660665787, -0.6329930226634689]
- O: [0.7052795411761517, -0.30262049917738404, 0.10159446606657871, -0.6329930226634689]
phase: 1
v: 1.0
homogenization: direct
@ -40475,7 +40475,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.8497500999920073, -0.3541522098950686, -0.38632291593135776, -0.05705772880430643]
- O: [0.8497500999920073, -0.3541522098950685, -0.3863229159313577, -0.05705772880430643]
phase: 1
v: 1.0
homogenization: direct
@ -42475,7 +42475,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.5383777729036413, -0.0006130402781197792, -0.5241013413815168, -0.6598990693939698]
- O: [0.5383777729036413, -0.0006130402781197792, -0.5241013413815168, -0.6598990693939697]
phase: 1
v: 1.0
homogenization: direct
@ -43140,7 +43140,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.09246710333146782, -0.8345101822571585, -0.37880620210322863, 0.3892922446681156]
- O: [0.09246710333146782, -0.8345101822571583, -0.37880620210322863, 0.3892922446681156]
phase: 1
v: 1.0
homogenization: direct
@ -44270,7 +44270,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.762924200138241, 0.03641508152920803, -0.5009075218239414, -0.40707770911810437]
- O: [0.762924200138241, 0.03641508152920803, -0.5009075218239414, -0.4070777091181044]
phase: 1
v: 1.0
homogenization: direct
@ -44435,7 +44435,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.47087677242309084, -0.34682986663062043, -0.21279566355408056, 0.7827529076138762]
- O: [0.47087677242309084, -0.3468298666306204, -0.21279566355408053, 0.7827529076138762]
phase: 1
v: 1.0
homogenization: direct
@ -44540,7 +44540,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7125379091798806, 0.23403740001006632, 0.2895514554256831, 0.5947068000611403]
- O: [0.7125379091798806, 0.2340374000100663, 0.28955145542568306, 0.5947068000611403]
phase: 1
v: 1.0
homogenization: direct
@ -44960,7 +44960,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.6958878424426996, -0.11658324301293699, 0.5489570390723334, 0.4481011352830605]
- O: [0.6958878424426996, -0.116583243012937, 0.5489570390723334, 0.4481011352830605]
phase: 1
v: 1.0
homogenization: direct
@ -45260,7 +45260,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.8054575830586059, 0.1804396057325204, 0.5643909987322313, -0.01193445124485333]
- O: [0.805457583058606, 0.1804396057325204, 0.5643909987322313, -0.011934451244853332]
phase: 1
v: 1.0
homogenization: direct
@ -45605,7 +45605,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.897939106580608, -0.15852644047994663, -0.0906003445066782, -0.40045762087547854]
- O: [0.897939106580608, -0.15852644047994666, -0.0906003445066782, -0.40045762087547854]
phase: 1
v: 1.0
homogenization: direct
@ -45855,7 +45855,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7102784157142707, 0.21927545769758944, 0.30454992880777176, 0.5955436060315983]
- O: [0.7102784157142707, 0.21927545769758944, 0.3045499288077718, 0.5955436060315983]
phase: 1
v: 1.0
homogenization: direct
@ -46785,7 +46785,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.8482899898135381, 0.01344303478080317, -0.5239164704064473, 0.07572918879058307]
- O: [0.8482899898135381, 0.013443034780803168, -0.5239164704064472, 0.07572918879058307]
phase: 1
v: 1.0
homogenization: direct
@ -47370,7 +47370,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.2131719944192954, -0.45816274673352775, 0.3755521192528605, -0.7769203331266176]
- O: [0.2131719944192954, -0.45816274673352775, 0.3755521192528604, -0.7769203331266176]
phase: 1
v: 1.0
homogenization: direct
@ -49465,7 +49465,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.5037539978875478, 0.798549991924166, 0.18656398735621565, 0.27155791027325404]
- O: [0.5037539978875478, 0.798549991924166, 0.18656398735621565, 0.2715579102732541]
phase: 1
v: 1.0
homogenization: direct
@ -50335,7 +50335,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.39921645983730997, -0.6013267272096833, 0.6365222106497649, -0.27179378338695087]
- O: [0.39921645983730997, -0.6013267272096834, 0.636522210649765, -0.27179378338695087]
phase: 1
v: 1.0
homogenization: direct
@ -50645,7 +50645,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.07083309409802356, -0.6366354041315766, -0.6538301805355591, -0.40272090833176605]
- O: [0.07083309409802357, -0.6366354041315766, -0.6538301805355591, -0.40272090833176605]
phase: 1
v: 1.0
homogenization: direct
@ -51020,7 +51020,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.3399140508362671, 0.5524833187439406, 0.645323253963486, 0.4034581991331183]
- O: [0.3399140508362671, 0.5524833187439406, 0.645323253963486, 0.40345819913311837]
phase: 1
v: 1.0
homogenization: direct
@ -53090,7 +53090,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.6178033410366037, 0.3428318561655839, -0.7064244293225029, 0.04183151752502306]
- O: [0.6178033410366038, 0.3428318561655839, -0.7064244293225029, 0.041831517525023065]
phase: 1
v: 1.0
homogenization: direct
@ -55470,7 +55470,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.4147250145072622, -0.6748414672821321, -0.31346007530912795, -0.5237699280845035]
- O: [0.4147250145072622, -0.674841467282132, -0.3134600753091279, -0.5237699280845035]
phase: 1
v: 1.0
homogenization: direct
@ -60645,7 +60645,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.772317193587748, -0.15756277648057695, -0.11054904749292863, -0.6053751168117856]
- O: [0.772317193587748, -0.15756277648057698, -0.11054904749292865, -0.6053751168117856]
phase: 1
v: 1.0
homogenization: direct
@ -60910,7 +60910,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7256517547455085, 0.39540025559174474, 0.46095445780716454, 0.3234333881040275]
- O: [0.7256517547455084, 0.39540025559174474, 0.46095445780716454, 0.3234333881040275]
phase: 1
v: 1.0
homogenization: direct
@ -61365,7 +61365,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.3756400691131763, 0.6005332316905264, 0.6536828427774417, 0.26637026329975905]
- O: [0.3756400691131763, 0.6005332316905265, 0.6536828427774418, 0.26637026329975905]
phase: 1
v: 1.0
homogenization: direct
@ -63490,7 +63490,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.251478214662433, -0.7746585879697298, 0.2936799549832292, 0.5004146917067765]
- O: [0.251478214662433, -0.7746585879697298, 0.2936799549832292, 0.5004146917067767]
phase: 1
v: 1.0
homogenization: direct
@ -63955,7 +63955,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.7761095621277665, 0.5658565514148699, 0.21082820014959885, 0.18169144398236772]
- O: [0.7761095621277665, 0.5658565514148699, 0.21082820014959885, 0.1816914439823677]
phase: 1
v: 1.0
homogenization: direct
@ -64355,7 +64355,7 @@ material:
v: 1.0
homogenization: direct
- constituents:
- O: [0.08994219560426489, -0.9524153356792486, -0.021344167817519546, 0.29044768257475523]
- O: [0.08994219560426488, -0.9524153356792486, -0.021344167817519546, 0.29044768257475523]
phase: 1
v: 1.0
homogenization: direct

View File

@ -1,5 +1,4 @@
import os
import filecmp
import pytest
import numpy as np
@ -133,8 +132,11 @@ class TestConfigMaterial:
def test_load_DREAM3D_reference(self,tmp_path,ref_path,update):
config = ConfigMaterial.load_DREAM3D(ref_path/'measured.dream3d')
config.save(tmp_path/'material.yaml')
cur = ConfigMaterial.load_DREAM3D(ref_path/'measured.dream3d')
ref = ConfigMaterial.load(ref_path/'measured.material_yaml')
if update:
config.save(ref_path/'measured.material_yaml')
assert config.is_valid and filecmp.cmp(tmp_path/'material.yaml',ref_path/'measured.material_yaml')
cur.save(ref_path/'measured.material_yaml')
for i,m in enumerate(ref['material']):
assert Rotation(m['constituents'][0]['O']) == \
Rotation(cur['material'][i]['constituents'][0]['O'])
assert cur.is_valid and cur['phase'] == ref['phase'] and cur['homogenization'] == ref['homogenization']