def plot(fig, data): x, re, im = data z = re + 1j * im ax = fig.add_subplot(121) ax.plot(x / 1e9, rf.mag_2_db(np.abs(z))) ax.set_xlabel('Frequency [GHz]') ax.set_ylabel('Amplitude [dB]') ax.set_title('S21') ax2 = fig.add_subplot(122) ax2.plot(x / 1e9, np.rad2deg(np.angle(z))) ax2.set_xlabel('Frequency [GHz]') ax2.set_ylabel('Angle [Deg]') ax2.set_title('S21')
def plot(fig, data): x, re, im = data z = re + 1j * im ax = fig.add_subplot(121) ax.plot(x / 1e9, rf.mag_2_db(np.abs(z))) ax.set_xlabel('Frequency / GHz') ax.set_ylabel('S21 / dB') ax.set_title('NA.JPA_S21') ax2 = fig.add_subplot(122) ax2.plot(x / 1e9, np.rad2deg(np.angle(z))) ax2.set_xlabel('Frequency/ GHz') ax2.set_ylabel('Angle / Deg') ax2.set_title('NA.JPA_S21')
kappa_2 = kappa_1 kappa = kappa_int + kappa_1 + kappa_2 + kappa_add f_start = 8e9 * pipi f_stop = 8.6e9 * pipi number = 601 omega_m = np.linspace(f_start, f_stop, number) omega = np.linspace(8.1e9, 8.5e9, 401) * pipi S21 = np.zeros([len(omega), len(omega_m)]) t_start = time.time() # for k in range(len(kappa_add)): # kappa = kappa_int + kappa_1 + kappa_2 + kappa_add[k] for i in range(len(omega)): for j in range(len(omega_m)): s = rf.mag_2_db( abs( np.sqrt(kappa_1 * kappa_2) / (-1j * (omega[i] - omega_c) + kappa / 2 + (g)**2 * cm.exp(1j * 120 * degree) / (-1j * (omega[i] - omega_m[j]) + gamma / 2)))) S21[i][j] = s extent = (min(omega_m) / (1e9 * pipi), max(omega_m) / (1e9 * pipi), min(omega) / (1e9 * pipi), max(omega) / (1e9 * pipi)) plt.figure(figsize=(6, 6)) ax1 = plt.subplot(111) gci = ax1.imshow(S21, extent=extent, origin='lower', aspect='auto') cbar = plt.colorbar(gci) cbar.set_label('S21[dB]', size=20) cbar.ax.tick_params(labelsize=20) ax1.set_xlabel('magnon frequency[GHz]', size=20) ax1.set_ylabel('probe frequency [GHz]', size=20)
# fig, axes = plt.subplots(1, 1, figsize=(10, 6)) # axes.plot((frequencys-omega_c)/(1e9*pipi), S21,label='S21') # axes.plot((frequencys-omega_c)/(1e9*pipi), S12,label='S12') # axes.legend(loc=0) # axes.set_xlabel('frequency') # axes.set_ylabel('S') # axes.set_title('S') # plt.show() for j in range(l): for i in range(lf): S = 1 + kappa / (1j * (frequencys[i] - omega_c) - kappa - beta + (J - 1j * Gamma)**2 / (1j * (frequencys[i] - 4.615e9 * pipi) - alpha - gamma[j])) S21[i] = rf.mag_2_db(np.abs(S)) for i in range(lf): S = 1 + kappa / (1j * (frequencys[i] - omega_c) - kappa - beta + (J + 1j * Gamma)**2 / (1j * (frequencys[i] - 4.615e9 * pipi) - alpha - gamma[j])) S12[i] = rf.mag_2_db(np.abs(S)) fig, axes = plt.subplots(1, 1, figsize=(10, 6)) axes.plot((frequencys - omega_c) / (1e9 * pipi), S21, label='S21') axes.plot((frequencys - omega_c) / (1e9 * pipi), S12, label='S12') axes.legend(loc=0) axes.set_xlabel('frequency') axes.set_ylabel('S') axes.set_title(gamma[j] / (1e6 * pipi)) plt.savefig( r'C:\Users\Administrator\Desktop\python\simulation_wxh\application\Ninth_Nonreciprocity\gamma\kappa=%s.png'
# for j in range(lm): # S_22s[i][j]=(-1-2*kappa_2/(1j*(omegas[i]-omega_c)-(kappa_1+kappa_2+kappa_int)+g_m**2/(1j*(omegas[i]-omega_ms[j])-gamma_m))).real**2 # extent=(min(omega_ms)/(2e9*pi), max(omega_ms)/(2e9*pi), min(omegas)/(2e9*pi), max(omegas)/(2e9*pi)) # plt.figure(figsize=(9, 9)) # ax1 = plt.subplot(111) # gci = ax1.imshow(S_22s, extent=extent, origin='lower', aspect='auto', cmap='hsv') # cbar = plt.colorbar(gci) # cbar.set_label('S_22') # ax1.set_xlabel('omega_m[GHz]') # ax1.set_ylabel('probe frequency [GHz]') # plt.show() # # #S12=S21 for i in range(l): for j in range(lm): a = (-2 * np.sqrt(kappa_1 * kappa_2) / (1j * (omegas[i] - omega_c) - (kappa_1 + kappa_2 + kappa_int) + g_m**2 / (1j * (omegas[i] - omega_ms[j]) - gamma_m))) S_12s[i][j] = rf.mag_2_db(np.abs(a)) extent = (min(omega_ms) / (2e9 * pi), max(omega_ms) / (2e9 * pi), min(omegas) / (2e9 * pi), max(omegas) / (2e9 * pi)) plt.figure(figsize=(9, 9)) ax1 = plt.subplot(111) gci = ax1.imshow(S_12s, extent=extent, origin='lower', aspect='auto') cbar = plt.colorbar(gci) cbar.set_label('S_12=S_21') ax1.set_xlabel('omega_m[GHz]') ax1.set_ylabel('probe frequency [GHz]') plt.show()
def func(x, gamma_in, gamma_int): return rf.mag_2_db( np.abs(-1 + (gamma_in * pipi) / (-1j * (x - omega_c) + (gamma_in * pipi + gamma_int * pipi) / 2)))
kappa_in = 1.30554595e6 * pipi kappa_int = 1.08869e6 * pipi fre_start = 8.25e9 * pipi fre_stop = 8.32e9 * pipi number = 10001 omega_c = 8.2855556e9 * pipi frequencys1 = np.linspace(fre_start, fre_stop, number) frequencys2 = np.linspace(8.25e9 * pipi, 8.32e9 * pipi, 10000) lf = len(frequencys1) Ss = np.zeros(lf) # Se=[] for i in range(lf): S = -1 + kappa_in / (-1j * (frequencys1[i] - omega_c) + (kappa_in + kappa_int) / 2) Ss[i] = rf.mag_2_db(np.abs(S)) def func(x, gamma_in, gamma_int): return rf.mag_2_db( np.abs(-1 + (gamma_in * pipi) / (-1j * (x - omega_c) + (gamma_in * pipi + gamma_int * pipi) / 2))) popt, pcov = curve_fit(func, frequencys2, Se, bounds=(-1, [20000000., 20000000.])) print(popt / pipi)
g = 1 current = np.linspace(5.5, 5.7, 401) degree = m.pi / 180 lm = len(omegam) Ss2 = np.zeros([lf, lm]) # start=time.time() # for g in np.arange(1.5,2.1,0.1): # for k in range(0,181): for i in range(lm): for j in range(lf): S = np.sqrt(ktime) / ( -1j * (frequencys1[j] - omega_c + 1j * kappa_in) + kappa / 2 + (g * MHz)**2 * cm.exp(1j * 120 * degree) / (-1j * (frequencys1[j] - omegam[i] + 1j * gamma) + gamma / 2)) # S=(np.sqrt(ktime)/(-1j*(frequencys1[j]-omega_c)+kappa/2+(g+1j*Gamma)**2/(-1j*(frequencys1[j]-omegam[i])+gamma/2))) Ss2[j][i] = rf.mag_2_db(np.abs(S)) extent = (min(omegam) / GHz, max(omegam) / GHz, min(frequencys1) / GHz, max(frequencys1) / GHz) plt.figure(figsize=(6, 6)) ax1 = plt.subplot(111) gci = ax1.imshow(Ss2, extent=extent, origin='lower', aspect='auto') cbar = plt.colorbar(gci) cbar.set_label('S_21') ax1.set_xlabel('omega_m[GHz]') ax1.set_ylabel('probe frequency [GHz]') # ax1.set_title() # plt.savefig(r'C:\Users\Administrator\Desktop\python\simulation_wxh\application\12_fing_dissipative_coupling_phase\g=%s\degree=%d.png' %(g ,k)) plt.show() # C:\Users\Administrator\Desktop\python\simulation_wxh\application\12_fing_dissipative_coupling_phase # print(Sf)
omega_c = 8.2856e9 * pipi # omega_c=8.29e9*pipi omega_m = 8.28574e9 * pipi g = 9.6e6 * pipi gamma = 3.25e6 * pipi # g=5.5e6*pipi # gamma=5e6*pipi frequencys = np.linspace(8.2e9 * pipi, 8.35e9 * pipi, 10000) lf = len(frequencys) Ss = np.zeros(lf) for i in range(lf): s = -1 + kappa_in / (-1j * (frequencys[i] - omega_c) + (kappa_in + kappa_int) / 2 + g**2 / (-1j * (frequencys[i] - omega_m) + gamma / 2)) Ss[i] = rf.mag_2_db(np.abs(s)) # def func(x,gg,gammam): # return rf.mag_2_db(np.abs(-1+kappa_in/(-1j*(x-omega_c)+(kappa_in+kappa_int)/2+(gg*1e6*pipi)**2/(-1j*(x-omega_m*1e9)+gammam*pipi*1e6/2)))) # popt, pcov = curve_fit(func, frequencys, Se, bounds=([1.,0.],[10.,10. ])) # print(popt) # print(pcov) fig, axes = plt.subplots(1, 1, figsize=(10, 6)) axes.plot(frequencys / (1e9 * pipi), Ss - 0.04, label='simulation') # axes.plot(frequencys/(1e9*pipi),Se,label='experiment') # axes.plot(frequencys2/(1e9*pipi),) axes.legend(loc=0) axes.set_xlabel('frequency') axes.set_ylabel('S11') axes.set_title('S11')