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()
#print(np.mean(beam.z)) #beam.plot_xy() #beam.plot_xz() #plt.show() beam1=Beam() beam1.set_divergences_collimated() beam1.set_point(0.+100,0.,20.+100) beam1.set_circular_spot(5.) beam2=Beam() beam2.set_divergences_collimated() beam2.set_point(0.+100,0.,0.+100) beam2.set_rectangular_spot(20.,-20.,15.,10.) beam=beam1.merge(beam2) beam3=Beam() beam3.set_divergences_collimated() beam3.set_point(0.+100,0.,0.+100) beam3.set_rectangular_spot(5.,-5.,10.,-40.) beam=beam.merge(beam3) beamd=beam.duplicate() p = 10. q = 25.
if main == "__main2__": shadow_beam = shadow_source() 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
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 beam.y *= 1e-2 beam.plot_yx(0)