Skip to content
Snippets Groups Projects
Commit cb599390 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

transform_CoreShellBox.py: mv material initialization to top

parent 63cc5700
No related branches found
No related tags found
1 merge request!1214Further reorganize tests; revise some Py functional tests
Pipeline #84129 passed
...@@ -10,15 +10,18 @@ import unittest ...@@ -10,15 +10,18 @@ import unittest
import utils import utils
from bornagain import * 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 layer_thickness = 100.0
class TransformCoreShellBoxTest(unittest.TestCase): class TransformCoreShellBoxTest(unittest.TestCase):
def get_sample(self, particle): 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 = ParticleLayout()
layout.addParticle(particle) layout.addParticle(particle)
...@@ -44,7 +47,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): ...@@ -44,7 +47,6 @@ class TransformCoreShellBoxTest(unittest.TestCase):
Box particle placed in the center of the middle layer is compared against 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. 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_length = 50.0
shell_width = 20.0 shell_width = 20.0
...@@ -79,8 +81,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): ...@@ -79,8 +81,6 @@ class TransformCoreShellBoxTest(unittest.TestCase):
Second CoreShell particle has dimensions (50,20,10) with one rotationZ to be Second CoreShell particle has dimensions (50,20,10) with one rotationZ to be
like the reference one. 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 # building reference CoreShell particle
shell_length = 20.0 shell_length = 20.0
...@@ -131,9 +131,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): ...@@ -131,9 +131,6 @@ class TransformCoreShellBoxTest(unittest.TestCase):
Second CoreShell particle has dimensions (50,20,10) with one rotationZ to be Second CoreShell particle has dimensions (50,20,10) with one rotationZ to be
like the reference one. 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 # building reference CoreShell particle
shell_length = 10.0 shell_length = 10.0
shell_width = 20.0 shell_width = 20.0
...@@ -183,8 +180,6 @@ class TransformCoreShellBoxTest(unittest.TestCase): ...@@ -183,8 +180,6 @@ class TransformCoreShellBoxTest(unittest.TestCase):
Second CoreShell particle has dimensions (50,20,10) with two rotations to be Second CoreShell particle has dimensions (50,20,10) with two rotations to be
like the reference one. 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 # building reference CoreShell particle
shell_length = 10.0 shell_length = 10.0
......
...@@ -66,8 +66,7 @@ class BoxTransformationsTest(unittest.TestCase): ...@@ -66,8 +66,7 @@ class BoxTransformationsTest(unittest.TestCase):
data = self.get_result(box) data = self.get_result(box)
diff = ba.meanRelativeDifference(data, reference_data) diff = ba.meanRelativeDifference(data, reference_data)
print(diff) self.assertLess(diff, 1e-13)
self.assertLess(diff, 1e-10)
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment