C = 2 * g1 / Lc D = 2 * g1 * g2 - 1 print g1 * g2 #A1=1; B1=0; C1=-2/R1; D1=1; #concave mirror M1 #A2=1; B2=Lc; C2=0; D2=1; #propagation #A3=1; B3=0; C3=-2/R2; D3=1; #concave mirror M2 #A4=1; B4=Lc; C4=0; D4=1; #propagation # #M1=ms.np.array([[A1,B1 ],[C1, D1]]); M2=ms.np.array([[A2, B2],[C2, D2]]); #M3=ms.np.array([[A3, B3],[C3, D3]]); M4=ms.np.array([[A4, B4],[C4, D4]]); #M=M1.dot(M2).dot(M3).dot(M4) # calculating the global matrix # #A=M[0,0]; B=M[0,1]; C=M[1,0]; D=M[1,1] opsys = ms.CavEigenSys() opsys.build_1D_cav_ABCD(a, npts, A, B, C, D) opsys.solve_modes() opsys.show_mode(0) ms.plt.grid() opsys.show_mode(0, what='phase') ms.plt.show() l, tem00 = opsys.get_mode1D(0) M00 = ms.np.array([[0, 2 * Lc], [0, 1]]) propsys = FresnelProp() # create a propagator object propsys.set_start_beam(tem00, opsys.x1) propsys.set_ABCD(M00) propsys.propagate1D_ABCD(x2=1 * opsys.x1)
# -*- coding: utf-8 -*- ''' Created on 16 sept. 2014 @author: Mohamed ''' import opencavity.modesolver as oc sys = oc.CavEigenSys() #creating a oc object R1 = 1e13 R2 = 10 * 1e3 Lc = 8 * 1e3 npts = 80 a = 150 # cavity parameters R1 = 20e3 sys.build_1D_cav(a, npts, R1, R2, Lc) A1 = 1 B1 = Lc C1 = 0 D1 = 1 f2 = R2 / 2 f1 = R1 / 2 #g1=1-Lc/R1; g2=1-Lc/R2; #A1=2*g1*g2-1; B1=2*g2*Lc; C1=2*g1/Lc; D1=2*g1*g2-1; sys2 = oc.CavEigenSys() sys2.build_1D_cav_ABCD(a, npts, A1, B1, C1, D1) T_lens2 = oc.np.exp((1j * sys.k / (2 * f2)) * sys.x1**2)
M = M4.dot(M3).dot(M2).dot( M1) # calculating the global matrix (note the inversed order) M11 = M2.dot(M1) M22 = M4.dot(M3) # sub-system 2 A11 = M11[0, 0] B11 = M11[0, 1] C11 = M11[1, 0] D11 = M11[1, 1] # getting the members of subsystem 1 matrix A22 = M22[0, 0] B22 = M22[0, 1] C22 = M22[1, 0] D22 = M22[1, 1] # getting the members of subsystem 2 matrix sys1 = oc.CavEigenSys(wavelength=1.04) sys2 = oc.CavEigenSys(wavelength=1.04) sys1.build_1D_cav_ABCD(a, npts, A11, B11, C11, D11) # sys2.build_1D_cav_ABCD(a, npts, A22, B22, C22, D22) # to reinitialize the sub-system theta = -0.5 * 3.14 / 180 # reflector is quivalent to refractive axcicon with 2 x theta T_axicon = oc.np.exp( (+1j * sys1.k) * 2 * theta * (oc.np.sign(sys1.x1)) * sys1.x1) sys1.apply_mask1D(T_axicon) sys1.cascade_subsystem(sys2) sys1.solve_modes()
M11 = M2.dot(M1) M22 = M4.dot(M3) # sub-system 2 A11 = M11[0, 0] B11 = M11[0, 1] C11 = M11[1, 0] D11 = M11[1, 1] # getting the members of subsystem 1 matrix A22 = M22[0, 0] B22 = M22[0, 1] C22 = M22[1, 0] D22 = M22[1, 1] # getting the members of subsystem 2 matrix # enter transfer matrices to create a system sys1 = ms.CavEigenSys() sys2 = ms.CavEigenSys() sys1.build_1D_cav_ABCD(a, npts, A11, B11, C11, D11) # sys2.build_1D_cav_ABCD(a, npts, A22, B22, C22, D22) # to reinitialize the sub-system # just a small loop to create an aperture (amplitude =0 (no transmission) if radius >50 ) aperture = ms.np.ones(npts) for k in range(npts): if ms.np.abs(sys1.x1[k]) > 50: aperture[k] = 0 ms.plt.clf() # clear figure ms.plt.plot(sys1.x1, aperture)
import opencavity.modesolver as ms R1 = 1e13 R2 = 10 * 1e3 Lc = 8 * 1e3 npts = 64 a = 80 # cavity parameters g1 = 1 - Lc / R1 g2 = 1 - Lc / R2 A1 = 2 * g1 * g2 - 1 B1 = 2 * g2 * Lc C1 = 2 * g1 / Lc D1 = 2 * g1 * g2 - 1 sys = ms.CavEigenSys() #creating a ms object sys.build_2D_cav_ABCD(a, npts, A1, B1, C1, D1) x1 = sys.x1 y1 = sys.y1 apert = ms.AmpMask2D(x1, y1) # create a mask object apert.add_circle(80) #create an aperture in x1,y1 coordinates with radius=80 apert.show_msk3D() sys.apply_mask2D(apert) sys.solve_modes() sys.show_mode(0) sys.show_mode(1) sys.show_mode(2)
C4 = 0 D4 = 1 #propagation M1 = oc.np.array([[A1, B1], [C1, D1]]) M2 = oc.np.array([[A2, B2], [C2, D2]]) M3 = oc.np.array([[A3, B3], [C3, D3]]) M4 = oc.np.array([[A4, B4], [C4, D4]]) M = M1.dot(M2).dot(M3).dot(M4) # calculating the global matrix A = M[0, 0] B = M[0, 1] C = M[1, 0] D = M[1, 1] opsys = oc.CavEigenSys() opsys.build_1D_cav_ABCD(a, npts, A, B, C, D) opsys.solve_modes() opsys.show_mode(0) #opsys.show_mode(2,what='intensity') opsys.show_mode(0, what='phase') oc.plt.show() M00 = oc.np.array([[1, Lc], [0, 1]]) M01 = oc.np.array([[1, 0], [(1 - 1.5) / (-R2 * 1.5), 1 / 1.5]]) M02 = oc.np.array([[1, 5e3], [0, 1]]) M03 = oc.np.array([[1, 1], [0, 1.5 / 1]]) M04 = oc.np.array([[1, 50e3], [0, 1]]) M_out = M04.dot(M03.dot(M02.dot(M01.dot(M00)))) M_out2 = oc.np.array([[1, Lc + 5e3 + 50e3], [0, 1]])
M1 = np.array([[1, 0], [-2 / R1, 1]]) #concave mirror M1 M2 = np.array([[1, Lc], [0, 1]]) #propagation distance Lc M3 = np.array([[1, 0], [-2 / R2, 1]]) #concave mirror M2 M4 = np.array([[1, Lc], [0, 1]]) #propagation distance Lc M = M4.dot(M3).dot(M2).dot( M1) # calculating the global matrix (note the inversed order) A = M[0, 0] B = M[0, 1] C = M[1, 0] D = M[1, 1] opsys = ms.CavEigenSys() #creating a Cavity eigensolver object opsys.build_2D_cav_ABCD(a, npts, A, B, C, D) opsys.solve_modes() # show some modes opsys.show_mode(0) opsys.show_mode(0, what='phase') opsys.show_mode(1, what='intensity') opsys.show_mode(1, what='phase') opsys.show_mode(2, what='intensity') opsys.show_mode(2, what='phase') l, v = opsys.get_mode2D(0) # l: eigenvalue, v: eigenvector (the mode) print(1 - np.abs(l)**2) * 100 # in percent l, v = opsys.get_mode2D(2)
M = M4.dot(M3).dot(M2).dot( M1) # calculating the global matrix (note the inversed order) M11 = M2.dot(M1) M22 = M4.dot(M3) # sub-system 2 A11 = M11[0, 0] B11 = M11[0, 1] C11 = M11[1, 0] D11 = M11[1, 1] # getting the members of subsystem 1 matrix A22 = M22[0, 0] B22 = M22[0, 1] C22 = M22[1, 0] D22 = M22[1, 1] # getting the members of subsystem 2 matrix sys1 = ms.CavEigenSys(wavelength=1.04) sys2 = ms.CavEigenSys(wavelength=1.04) sys1.build_1D_cav_ABCD(a, npts, A11, B11, C11, D11) # sys2.build_1D_cav_ABCD(a, npts, A22, B22, C22, D22) # theta = 0.5 * 3.14 / 180 # reflector is quivalent to refractive axcicon with 2 x theta T_axicon = ms.np.exp( (+1j * sys1.k) * 2 * theta * (ms.np.sign(sys1.x1)) * sys1.x1) sys1.apply_mask1D(T_axicon) sys1.cascade_subsystem(sys2) sys1.solve_modes()