def setUp(self): self.n_ports = 2 self.wg = WG wg = self.wg #Port 0: VNA port 0 #Port 1: DUT port 0 #Port 2: DUT port 1 #Port 3: VNA port 1 self.Z = wg.random(n_ports=4, name='Z') self.gamma_f = wg.random(n_ports=1, name='gamma_f') self.gamma_r = wg.random(n_ports=1, name='gamma_r') o = wg.open(nports=1, name='open') s = wg.short(nports=1, name='short') m = wg.match(nports=1, name='load') om = rf.two_port_reflect(o, m) mo = rf.two_port_reflect(m, o) oo = rf.two_port_reflect(o, o) ss = rf.two_port_reflect(s, s) thru = wg.thru(name='thru') ideals = [thru, om, mo, oo, ss] measured = [self.measure(k) for k in ideals] self.cal = rf.SixteenTerm(measured=measured, ideals=ideals, switch_terms=(self.gamma_f, self.gamma_r))
def setUp(self): self.n_ports = 2 self.wg = WG wg = self.wg #Port 0: VNA port 0 #Port 1: DUT port 0 #Port 2: DUT port 1 #Port 3: VNA port 1 self.Z = wg.random(n_ports=4, name='Z') self.gamma_f = wg.random(n_ports=1, name='gamma_f') self.gamma_r = wg.random(n_ports=1, name='gamma_r') o = wg.open(nports=1, name='open') s = wg.short(nports=1, name='short') m = wg.match(nports=1, name='load') om = rf.two_port_reflect(o, m) mo = rf.two_port_reflect(m, o) oo = rf.two_port_reflect(o, o) ss = rf.two_port_reflect(s, s) thru = wg.thru(name='thru') ideals = [thru, om, mo, oo, ss] measured = [self.measure(k) for k in ideals] self.cal16 = rf.SixteenTerm(measured=measured, ideals=ideals, switch_terms=(self.gamma_f, self.gamma_r)) r = wg.load(.95 + .1j, nports=1) m = wg.match(nports=1) mm = rf.two_port_reflect(m, m) rm = rf.two_port_reflect(r, m) mr = rf.two_port_reflect(m, r) rr = rf.two_port_reflect(r, r) ideals = [thru, mm, rr, rm, mr] measured = [self.measure(k) for k in ideals] self.cal_lmr16 = rf.LMR16( measured=measured, ideals=[thru], ideal_is_reflect=False, #Automatic sign detection doesn't work if the #error terms aren't symmetric enough sign=1, switch_terms=(self.gamma_f, self.gamma_r)) #Same error network, but without leakage terms #Primary leakage self.Z.s[:, 3, 0] = 0 # forward isolation self.Z.s[:, 0, 3] = 0 # reverse isolation self.Z.s[:, 2, 1] = 0 # forward port isolation self.Z.s[:, 1, 2] = 0 # reverse port isolation #Cross leakage self.Z.s[:, 3, 1] = 0 # forward port 2 isolation self.Z.s[:, 1, 3] = 0 # reverse port 2 isolation self.Z.s[:, 2, 0] = 0 # forward port 1 isolation self.Z.s[:, 0, 2] = 0 # reverse port 1 isolation measured = [self.measure(k) for k in ideals] self.cal8 = rf.EightTerm( measured=measured, ideals=ideals, switch_terms=(self.gamma_f, self.gamma_r), )
#cal.solved_through.plot_s_deg(m=1, n=0) #cal.solved_reflect.plot_s_smith() if 1: if cal != None: dut = cal.apply_cal(dut) cal = skrf.TwelveTerm(\ measured = [os, so, ll, through], ideals =[os_i, so_i, ll_i, through_i], n_thrus = 1, ) cal.run() if 0: cal = skrf.SixteenTerm(\ measured = [ss, os, so, ll, through], ideals = [ss_i, os_i, so_i, ll_i, through_i], ) cal.run() coefs = cal.coefs if 0: cal = skrf.EightTerm(\ measured = [os, so, ll, through], ideals = [os_i, so_i, ll_i, through_i] ) cal.run() plt.figure() dut = cal.apply_cal(dut)