def test_gaussian_beam(self): print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> test_gaussian_beam") beam=Beam(5000) beam.set_point(1.,1.,1.) beam.set_gaussian_divergence(0.05,0.0005) print(np.mean(beam.vx)) print(np.mean(beam.vz)) assert_almost_equal(np.mean(beam.vx),0.0,1) assert_almost_equal(np.mean(beam.vz),0.0,1)
def test_montel_elliptical(): print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> test_montel_elliptical") beam = Beam(25000) beam.set_flat_divergence(25 * 1e-6, 25 * 1e-6) beam.set_rectangular_spot(xmax=25 * 1e-6, xmin=-25 * 1e-6, zmax=5 * 1e-6, zmin=-5 * 1e-6) beam.set_gaussian_divergence(25 * 1e-4, 25 * 1e-4) beam.flag *= 0 p = 5. q = 15. #theta = np.pi/2 - 0.15 theta = 85. * np.pi / 180 xmax = 0. xmin = -0.3 ymax = 0.1 ymin = -0.1 zmax = 0.3 zmin = 0. bound1 = BoundaryRectangle(xmax, xmin, ymax, ymin, zmax, zmin) bound2 = BoundaryRectangle(xmax, xmin, ymax, ymin, zmax, zmin) montel = CompoundOpticalElement.initialize_as_montel_ellipsoid( p=p, q=q, theta=theta, bound1=bound1, bound2=bound2) beam03 = montel.trace_montel(beam) print(beam03[2].N / 25000) plt.figure() plt.plot(beam03[0].x, beam03[0].z, 'ro') plt.plot(beam03[1].x, beam03[1].z, 'bo') plt.plot(beam03[2].x, beam03[2].z, 'go') plt.xlabel('x axis') plt.ylabel('z axis') plt.axis('equal') beam03[2].plot_xz(0) print("No reflection = %d\nOne reflection = %d\nTwo reflection = %d" % (beam03[0].N, beam03[1].N, beam03[2].N)) plt.show()
beam = Beam() beam.initialize_from_arrays(shadow_beam.getshonecol(1), shadow_beam.getshonecol(2), shadow_beam.getshonecol(3), shadow_beam.getshonecol(4), shadow_beam.getshonecol(5), shadow_beam.getshonecol(6), shadow_beam.getshonecol(10), 0) beam = Beam(25000) beam.set_flat_divergence(25 * 1e-6, 25 * 1e-6) beam.set_rectangular_spot(xmax=25 * 1e-6, xmin=-25 * 1e-6, zmax=5 * 1e-6, zmin=-5 * 1e-6) beam.set_gaussian_divergence(25 * 1e-6, 25 * 1e-6) beam.set_divergences_collimated() beam.flag *= 0 p = 5. q = 15. theta = 88. * np.pi / 180. xmax = 0. xmin = -0.3 ymax = 0.3 ymin = -0.3 zmax = 0.3 zmin = 0.
q = 0.300 d = 0.1082882 q1 = 0.67041707 theta1 = 88.8 * np.pi / 180 theta2 = 89. * np.pi / 180 wolter_jap = CompoundOpticalElement.wolter_for_japanese(p=p, q=q, d=d, q1=q1, theta1=theta1, theta2=theta2) shadow_beam = shadow_source() beam = Beam() beam.set_gaussian_divergence(5 * 1e-5, 0.00025) beam.set_rectangular_spot(xmax=200 * 1e-6, xmin=-200 * 1e-6, zmax=10 * 1e-6, zmin=-10 * 1e-6) beam = Beam(25000) beam.initialize_from_arrays(shadow_beam.getshonecol(1), shadow_beam.getshonecol(3), shadow_beam.getshonecol(2), shadow_beam.getshonecol(4), shadow_beam.getshonecol(5), shadow_beam.getshonecol(6), shadow_beam.getshonecol(10), 0) beam.z = -beam.z + np.sqrt(7.035209**2 - 0.062770**2) beam.x *= 1e-2