From cb599390afa9c144dd6ac51d87a2436d47ea85fc Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 21 Dec 2022 23:21:39 +0100 Subject: [PATCH] transform_CoreShellBox.py: mv material initialization to top --- Tests/Py/Functional/transform_CoreShellBox.py | 17 ++++++----------- Tests/Py/Functional/transform_box.py | 3 +-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Tests/Py/Functional/transform_CoreShellBox.py b/Tests/Py/Functional/transform_CoreShellBox.py index 7f9d879a952..50b110585a6 100644 --- a/Tests/Py/Functional/transform_CoreShellBox.py +++ b/Tests/Py/Functional/transform_CoreShellBox.py @@ -10,15 +10,18 @@ import unittest import utils from bornagain import * +mAmbience = RefractiveMaterial("Vacuum", 0, 0) +mSubstrate = RefractiveMaterial("Substrate", 3e-6, 3e-8) +mMiddle = RefractiveMaterial("Teflon", 2.9e-6, 6e-9) +mCore = RefractiveMaterial("Ag", 1.2e-5, 5e-7) +mShell = RefractiveMaterial("AgO2", 8.6e-6, 3.4e-7) + layer_thickness = 100.0 class TransformCoreShellBoxTest(unittest.TestCase): def get_sample(self, particle): - mAmbience = RefractiveMaterial("Vacuum", 0, 0) - mMiddle = RefractiveMaterial("Teflon", 2.900e-6, 6.019e-9) - mSubstrate = RefractiveMaterial("Substrate", 3.212e-6, 3.244e-8) layout = ParticleLayout() layout.addParticle(particle) @@ -44,7 +47,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): Box particle placed in the center of the middle layer is compared against CoreShell particle, where core and shell are made of the same material. """ - mCore = RefractiveMaterial("Ag", 1.245e-5, 5.419e-7) shell_length = 50.0 shell_width = 20.0 @@ -79,8 +81,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): Second CoreShell particle has dimensions (50,20,10) with one rotationZ to be like the reference one. """ - mCore = RefractiveMaterial("Ag", 1.245e-5, 5.419e-7) - mShell = RefractiveMaterial("AgO2", 8.600e-6, 3.442e-7) # building reference CoreShell particle shell_length = 20.0 @@ -131,9 +131,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): Second CoreShell particle has dimensions (50,20,10) with one rotationZ to be like the reference one. """ - mCore = RefractiveMaterial("Ag", 1.245e-5, 5.419e-7) - mShell = RefractiveMaterial("AgO2", 8.600e-6, 3.442e-7) - # building reference CoreShell particle shell_length = 10.0 shell_width = 20.0 @@ -183,8 +180,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): Second CoreShell particle has dimensions (50,20,10) with two rotations to be like the reference one. """ - mCore = RefractiveMaterial("Ag", 1.245e-5, 5.419e-7) - mShell = RefractiveMaterial("AgO2", 8.600e-6, 3.442e-7) # building reference CoreShell particle shell_length = 10.0 diff --git a/Tests/Py/Functional/transform_box.py b/Tests/Py/Functional/transform_box.py index 17c2a0e911f..5f7bcac8645 100644 --- a/Tests/Py/Functional/transform_box.py +++ b/Tests/Py/Functional/transform_box.py @@ -66,8 +66,7 @@ class BoxTransformationsTest(unittest.TestCase): data = self.get_result(box) diff = ba.meanRelativeDifference(data, reference_data) - print(diff) - self.assertLess(diff, 1e-10) + self.assertLess(diff, 1e-13) if __name__ == '__main__': -- GitLab