def plot_demo_rf(): ring_slot = Network('ring slot.s2p') plt.figure() ring_slot.plot_s_smith() plt.figure() ring_slot.plot_s_db() plt.title("S-Parameters") data_log("plot demo data") plt.show()
plt.figure() plt.title("PEX") plt.plot(F, -Error_SS, label='SS', linewidth ='3') plt.plot(F, Error_TT, label='TT', linewidth ='3') plt.plot(F, -Error_FF, label='FF', linewidth ='3') plt.legend() plt.xlabel('F, Гц') plt.ylabel('Error, дБ') plt.grid() plt.figure() plt.title("PEX") SP_SS.plot_s_db(m=1-1, n=1-1, label='SS', linewidth ='3') SP_TT.plot_s_db(m=1-1, n=1-1, label='TT', linewidth ='3') SP_FF.plot_s_db(m=1-1, n=1-1, label='FF', linewidth ='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.grid() plt.figure() plt.title("PEX") SP_SS.plot_s_db(m=2-1, n=1-1, label='SS', linewidth ='3') SP_TT.plot_s_db(m=2-1, n=1-1, label='TT', linewidth ='3') SP_FF.plot_s_db(m=2-1, n=1-1, label='FF', linewidth ='3') plt.xlabel('F, Гц') plt.ylabel('S21, дБ') plt.grid()
import matplotlib.pyplot as plt import skrf as rf from skrf import Network plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" SP = Network('SP/FR4_1UM.s2p') plt.figure() SP.plot_s_db(m=2-1, n=1-1, label='S21', linewidth ='3') plt.xlabel('F, Гц') plt.ylabel('S21, дБ') plt.grid() plt.figure() SP.plot_s_db(m=1-1, n=1-1, label='S11', linewidth ='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.grid() plt.figure() SP.plot_s_smith(0,0, label='S11', linewidth ='3',draw_labels=True) plt.show()
plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" Title = "1.5 мкм" Folder_1 = f"SP/Chip_Line/Chip_Line_Accuracy/Three_lines_15um.s12p" Legend_1 = "50 мкм" Legend_2 = "100 мкм" Legend_3 = "200 мкм" SP = Network(Folder_1) SP.se2gmm(6) plt.figure() plt.title(Title) SP.plot_s_db(m=1 - 1, n=1 - 1, label=Legend_1, linewidth='3') SP.plot_s_db(m=3 - 1, n=3 - 1, label=Legend_2, linewidth='3') SP.plot_s_db(m=5 - 1, n=5 - 1, label=Legend_3, linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.legend() plt.grid() plt.figure() plt.title(Title) SP.plot_s_smith(m=1 - 1, n=1 - 1, label=Legend_1, linewidth='3', draw_labels=True) SP.plot_s_smith(m=3 - 1,
import matplotlib.pyplot as plt import skrf as rf from skrf import Network plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" SP = Network( 'C:/Users/SH/Desktop/homework_V2/Рабочий стол/Утюг/Микрополосковая линия/S2P/Four_line_Solaris.s8p' ) plt.figure() SP.plot_s_db(m=2 - 1, n=1 - 1, label='S21', linewidth='3') SP.plot_s_db(m=4 - 1, n=3 - 1, label='S43', linewidth='3') SP.plot_s_db(m=6 - 1, n=5 - 1, label='S65', linewidth='3') SP.plot_s_db(m=8 - 1, n=7 - 1, label='S87', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('SP, дБ') plt.grid() plt.figure() SP.plot_s_db(m=1 - 1, n=1 - 1, label='S11', linewidth='3') SP.plot_s_db(m=3 - 1, n=3 - 1, label='S33', linewidth='3') SP.plot_s_db(m=5 - 1, n=5 - 1, label='S55', linewidth='3') SP.plot_s_db(m=7 - 1, n=7 - 1, label='S77', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('SP, дБ') plt.grid()
import matplotlib.pyplot as plt import skrf as rf from skrf import Network plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" SP_ADS = Network('SP/Spiral/Spiral_std_ads.s2p') SP_CAD = Network('SP/Spiral/Spiral_std_cadence.s2p') plt.figure() SP_CAD.plot_s_db(m=1 - 1, n=1 - 1, label='S11 Cadence', linewidth='3') SP_ADS.plot_s_db(m=1 - 1, n=1 - 1, label='S11 ADS', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.grid() plt.figure() SP_CAD.plot_s_smith(0, 0, label='S11 Cadence', linewidth='3', draw_labels=True) SP_ADS.plot_s_smith(0, 0, label='S11 ADS', linewidth='3', draw_labels=True) plt.figure() SP_CAD.plot_s_db(m=2 - 1, n=1 - 1, label='S21 Cadence', linewidth='3') SP_ADS.plot_s_db(m=2 - 1, n=1 - 1, label='S21 ADS', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S21, дБ') plt.grid() plt.show()
import numpy as np plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" Folder_1 = f"SP/Calibration/Calibration_10mm.s2p" Legend_1 = "L=10мм" Folder_2 = f"SP/Calibration/Calibration_50mm.s2p" Legend_2 = "L=50мм" SP_10 = Network(Folder_1) SP_50 = Network(Folder_2) plt.figure() SP_10.plot_s_db(m=1 - 1, n=1 - 1, label = Legend_1, linewidth='3') SP_50.plot_s_db(m=1 - 1, n=1 - 1, label = Legend_2, linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.grid() plt.figure() SP_10.plot_s_db(m=2 - 1, n=1 - 1, label = Legend_1, linewidth='3') SP_50.plot_s_db(m=2 - 1, n=1 - 1, label = Legend_2, linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S21, дБ') plt.grid()
if abs(SP.s[i, 0, 0]) >= 1: SP.s[i, 0, 0] = SP.s[i - 1, 0, 0] if abs(SP.s[i, 1, 1]) >= 1: SP.s[i, 1, 1] = SP.s[i - 1, 1, 1] if abs(SP.s[i, 0, 1]) >= 1: SP.s[i, 0, 1] = SP.s[i - 1, 0, 1] SP_W = Network('SP/De_embedding/W_DUT.s2p') SP_WO = Network('SP/De_embedding/WO_DUT.s2p') VNA_Error(SP_W) VNA_Error(SP_WO) plt.figure() SP_WO.plot_s_db(m=0, n=0, label='With', linewidth='3') SP_WO.plot_s_db(m=1, n=0, label='With', linewidth='3') SP_WO.plot_s_db(m=1, n=1, label='With', linewidth='3') SP_WO.plot_s_db(m=0, n=1, label='With', linewidth='3') plt.grid() DUT = rf.de_embed(SP_WO, SP_W) plt.figure() DUT.plot_s_db(m=2 - 1, n=1 - 1, label='Legend', linewidth='3') plt.grid() plt.show()
import matplotlib.pyplot as plt import skrf as rf from skrf import Network plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" SP_Ideal = Network('SP/SP_Bad_Load.s2p') SP_FF = Network('SP/Load_RF12_FF.s2p') SP_SS = Network('SP/Load_RF12_SS.s2p') SP_TT = Network('SP/Load_RF12_TT.s2p') plt.figure() SP_TT.plot_s_db(m=0, n=0, label='S11(TT)', linewidth='3') SP_FF.plot_s_db(m=0, n=0, label='S11(FF)', linewidth='3') SP_SS.plot_s_db(m=0, n=0, label='S11(SS)', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.grid() plt.figure() SP_TT.plot_s_db(m=1, n=0, label='S21(TT)', linewidth='3') SP_FF.plot_s_db(m=1, n=0, label='S21(FF)', linewidth='3') SP_SS.plot_s_db(m=1, n=0, label='S21(SS)', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S21, дБ') plt.grid() plt.show()
import matplotlib.pyplot as plt import skrf as rf from skrf import Network import numpy as np plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" Folder_1 = f"SP/Chip_Via_Line/Via_Line_Chip.s4p" Title = "L= 100 мкм" SP = Network(Folder_1) SP.se2gmm(2) plt.figure() plt.title(Title) SP.plot_s_db(m=1 - 1, n=1 - 1, label='VIA+Line', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S11, дБ') plt.grid() plt.figure() plt.title(Title) SP.plot_s_db(m=2 - 1, n=1 - 1, label='VIA+Line', linewidth='3') plt.xlabel('F, Гц') plt.ylabel('S21, дБ') plt.grid() plt.show()
import matplotlib.pyplot as plt import skrf as rf from skrf import Network plt.rcParams["font.family"] = "Century Gothic" plt.rcParams["font.size"] = "14" SP_GL102 = Network('SP/Three_via_GL102.s6p') SP_FR4 = Network('SP/Three_via_FR4.s6p') plt.figure() plt.title("GL102") SP_GL102.plot_s_db(m=6-1, n=5-1, label='S65', linewidth ='3') SP_GL102.plot_s_db(m=4-1, n=3-1, label='S43', linewidth ='3') SP_GL102.plot_s_db(m=2-1, n=1-1, label='S21', linewidth ='3') plt.xlabel('F, Гц') plt.ylabel('S , дБ') plt.grid() plt.figure() plt.title("GL102") SP_GL102.plot_s_smith(5-1,5-1, label='S55', linewidth ='3',draw_labels=True) SP_GL102.plot_s_smith(3-1,3-1, label='S33', linewidth ='3',draw_labels=True) SP_GL102.plot_s_smith(1-1,1-1, label='S11', linewidth ='3',draw_labels=True) plt.figure() plt.title("FR4") SP_FR4.plot_s_db(m=6-1, n=5-1, label='S65', linewidth ='3') SP_FR4.plot_s_db(m=4-1, n=3-1, label='S43', linewidth ='3') SP_FR4.plot_s_db(m=2-1, n=1-1, label='S21', linewidth ='3') plt.xlabel('F, Гц') plt.ylabel('S , дБ')
files = [ 'thru_0201_10pf_accup.s2p', 'thru_0402_10pf_accup.s2p', 'thru_barrel.s2p', 'thru_tee_BLM15GG471_10pf_220nf.s2p', 'thru_thru.s2p' ] from pylab import * from skrf import Network for f in files: net = Network(f) net.plot_s_db() plt.show()
def AnalyzeTouchstoneFile(): root = tk.Tk() root.withdraw() root.filename = askopenfilename(initialdir="./Touchstone_Files", title="Select Touchstone file", filetypes=(("Touchstone files", "*.s1p *.s2p *.s*p"), ("all files", "*.*"))) TSFilePath = root.filename Sm = 1 Sn = 1 def setSParam(mm, nn): global Sm, Sn Sm = mm Sn = nn Close_start_menu.config(state=tk.NORMAL) Close_start_menu.config(bg='lime') def getSParam(): global Sm, Sn return Sm, Sn def close_start_window(): start_window.quit() start_window.destroy() start_window = tk.Tk() start_window.title('Select S-Parameter') start_window.config(bg='white') S11_button = tk.Button(start_window, text="S11", bg='white', command=lambda: setSParam(1, 1), height=1, width=20) S21_button = tk.Button(start_window, text="S21", bg='white', command=lambda: setSParam(2, 1), height=1, width=20) S12_button = tk.Button(start_window, text="S12", bg='white', command=lambda: setSParam(1, 2), height=1, width=20) S22_button = tk.Button(start_window, text="S22", bg='white', command=lambda: setSParam(2, 2), height=1, width=20) blank_space = tk.Label(start_window, text=" ", bg='white') Close_start_menu = tk.Button(start_window, text="GO!", bg='white', command=close_start_window) Close_start_menu.config(state=tk.DISABLED) S11_button.grid(sticky='we', row=0, column=0) S21_button.grid(sticky='we', row=1, column=0) S12_button.grid(sticky='we', row=0, column=1) S22_button.grid(sticky='we', row=1, column=1) blank_space.grid(sticky='we', row=2, column=0) Close_start_menu.grid(sticky='we', row=3, column=0, columnspan=2) start_window.mainloop() Sm, Sn = getSParam() #fig, axarr = plt.subplots(1,2, sharex=True) #plot1 = axarr[0] #plot2 = axarr[1] plt.figure() #plt.title('Scattering Parameter Results') s_plot = Network(TSFilePath) s_plot.frequency.unit = 'mhz' s_plot.plot_s_db(m=Sm - 1, n=Sn - 1) #, label = "Tuned and Matched") #s_plot.plot_s_smith(m=Sm-1,n=Sn-1, ax=plot2, draw_labels=True) #plot1.set_title('Magnetude') plt.legend(loc='best') plt.grid(color='lightgray', linestyle='-', linewidth=1) #plot2.set_title('Smith Chart') #plot2.legend(loc='lower center', ncol=2) #plot2.grid(color='lightgray', linestyle='-', linewidth=2) plt.tight_layout() plt.show()