def plot_three_load(): # dummy 2-port network from Frequency and s-parameters freq = Frequency(1, 10, 1, 'ghz') # Frequency([start, stop, npoints, unit, …]) print(freq) s = [0 + 1j, 0 - 1j, 0.23 - 0.43j] # random complex numbers print(s) # if not passed, will assume z0=50. name is optional but it's a good practice. ntwk = Network(frequency=freq, z0=50, s=s, name='random values 1-port') print(ntwk) plt.figure() ntwk.plot_s_smith(marker='o', linestyle='dotted') plt.legend(loc=7) plt.text(0, 0.85, "0+1j", fontsize=12, bbox=dict(facecolor='red', alpha=0.5)) plt.text(0, -0.85, "0-1j", fontsize=12, bbox=dict(facecolor='red', alpha=0.5)) plt.text(0.28, -0.43, "0.23-0.43j", fontsize=12, bbox=dict(facecolor='red', alpha=0.5)) plt.title("S-Parameters") data_log("plot some predefined loads in the smith char using skrf") plt.show()
def plot_smith(freq, s11, s11_phase, location): plt.figure() f = Frequency(np.min(freq), np.max(freq), len(freq), 'mhz') n = Network(freq=f, s=10**(s11 / 20) * np.exp(1j * s11_phase * np.pi / 180), z0=50) n.plot_s_smith(draw_labels=True) plt.savefig(location)
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()
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()
print("start: " + start) stop = argv[2] print("stop: " + stop) step = argv[3] print("step: " + step) try: device = sark_open() if not device: print("device not connected") else: print("device connected") prot, ver = sark_version(device) print(prot, ver) sark_buzzer(device, 1000, 800) y = [] x = [] for freq in range(int(start), int(stop), int(step)): # setup loop over number of points rs, xs = sark_measure(device, freq) x.append(freq) y.append(z2gamma(rs[0], xs[0])) ring_slot = Network(frequency=x, s=y, z0=50) ring_slot.plot_s_smith() print("done") finally: sark_close(device) exit(1)
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, n=3 - 1, label=Legend_2, linewidth='3', draw_labels=True) SP.plot_s_smith(m=5 - 1, n=5 - 1, label=Legend_3, linewidth='3', draw_labels=True) plt.figure() plt.title(Title)
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()
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 , дБ') plt.grid() plt.figure() plt.title("FR4") SP_FR4.plot_s_smith(5-1,5-1, label='S55', linewidth ='3',draw_labels=True) SP_FR4.plot_s_smith(3-1,3-1, label='S33', linewidth ='3',draw_labels=True)
# -*- coding: utf-8 -*- """ Created on Fri Dec 7 14:55:26 2018 @author: justRandom """ import time import numpy as np from skrf import Network import visa a = [] for i in range(0, 4): real = i / 10 imag = i / 100 a.append(complex(real, imag)) #SKRF smith chart plotting myNet = Network(f=[0, 1, 2, 3], s=a, z0=[50]) myNet.plot_s_smith()