def test_estimate_focus_spherical_mirror_2(self): sphere = Sphere(1) mirror = Mirror(geometry=sphere, position=(0, 0, 2), rotation=(30, 0, 0)) source = GridSource(divergence=(0.1, 0.1, 0)) rays = {0: [source.generate()]} refl = mirror.trace(rays) a = refl[0][0].estimate_focus(100) self.assertAllClose(a, (-0.0, 0.57, 1.67), atol=0.05)
def test_estimate_focus_spherical_mirror(self): sphere = Sphere(1) mirror = Mirror(geometry=sphere, position=(0, 0, 1)) source = GridSource(divergence=(0.1, 0.1, 0)) rays = {0: [source.generate()]} refl = mirror.trace(rays) a = refl[0][0].estimate_focus() self.assertAllClose(a, (0, 0, 0))