def test_csg_dda(): s = Sphere(n = 1.6, r=.1, center=(5, 5, 5)) st = s.translated(.03, 0, 0) pacman = Difference(s, st) sch = ImageSchema(10, .1, Optics(.66, 1.33, (0, 1))) h = DDA.calc_holo(pacman, sch) verify(h, 'dda_csg') hr = DDA.calc_holo(pacman.rotated(np.pi/2, 0, 0), sch) rotated_pac = pacman.rotated(np.pi/2, 0, 0) verify(h/hr, 'dda_csg_rotated_div')
def test_csg_dda(): s = Sphere(n = 1.6, r=.1, center=(5, 5, 5)) st = s.translated(.03, 0, 0) pacman = Difference(s, st) sch = detector_grid(10, .1) h = calc_holo(sch, pacman, 1.33, .66, illum_polarization=(0, 1)) verify(h, 'dda_csg') rotated_pac = pacman.rotated(np.pi/2, 0, 0) hr = calc_holo(sch, rotated_pac, 1.33, .66, illum_polarization=(0, 1)) verify(h/hr, 'dda_csg_rotated_div')
def test_csg_construction(): s = Sphere(n=1.6, r=.5, center=(0, 0, 0)) st = s.translated(.4, 0, 0) pacman = Difference(s, st) assert_allclose(pacman.bounds, [(-.5, .5), (-.5, .5), (-.5, .5)])
def test_csg_construction(): s = Sphere(n = 1.6, r=.5, center=(0, 0, 0)) st = s.translated(.4, 0, 0) pacman = Difference(s, st) assert_allclose(pacman.bounds, [(-.5, .5), (-.5, .5), (-.5, .5)])
def test_DDA_sphere(): sc = Sphere(n=1.59, r=3e-1, center=(0, 0, 0)) sc = sc.translated(1, -1, 30) mie_holo = calc_holo(schema, sc, index, wavelen) dda_holo = calc_holo(schema, sc, index, wavelen, theory=DDA) assert_allclose(mie_holo, dda_holo, rtol=.0015)