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') r = wg.short(nports=1, name='short') m = wg.match(nports=1, name='load') 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) thru_length = uniform(0, 10) thru = wg.line(thru_length, 'deg', name='line') self.thru = thru ideals = [thru, mm, rr, rm, mr] measured = [self.measure(k) for k in ideals] self.cal = rf.LMR16( measured=measured, ideals=[r], ideal_is_reflect=True, #Automatic sign detection doesn't work if the #error terms aren't symmetric enough sign=-1)
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), )
so_i = skrf.two_port_reflect(s_i, o_i) ss_i = skrf.two_port_reflect(s_i, s_i) sl_i = skrf.two_port_reflect(s_i, l_i) ls_i = skrf.two_port_reflect(l_i, s_i) through_delay = 41.1e-12 d = 2*np.pi*through_delay through_s = [[[0,np.exp(-1j*d*f)],[np.exp(-1j*d*f),0]] for f in freqs] through_i = skrf.Network(s=through_s, f=freqs, f_unit='Hz') cal = None if 1: cal = skrf.LMR16(\ measured = [through, ll, ss, sl, ls], ideal_is_reflect=True, ideals = s_i, ) cal.run() os = cal.apply_cal(os) so = cal.apply_cal(so) ll = cal.apply_cal(ll) ss = cal.apply_cal(ss) ls = cal.apply_cal(ls) sl = cal.apply_cal(sl) through = cal.apply_cal(through) #plt.figure() #cal.solved_through.plot_s_deg(m=1, n=0)