This little example demonstrates how to use scikit-rf for a basic TRL calibration.
First we import
TRL class, and setup matplotlib
import skrf as rf from skrf.calibration import TRL %matplotlib inline from skrf.plotting import stylely stylely()
Load the data¶
Load the calibration standard’s measurements and the switch terms from touchstone files. ( If you dont know what switch terms are, see this section below. )
T = rf.Network('trl_data/thru.s2p') R = rf.Network('trl_data/reflect.s2p') L = rf.Network('trl_data/line.s2p') switch_terms = (rf.Network('trl_data/forward switch term.s1p'), rf.Network('trl_data/reverse switch term.s1p')) measured = [T,R,L]
Create a TRL calibration Object¶
trl = TRL(measured = measured, switch_terms = switch_terms)
Correct a DUT with it.¶
dut_raw = rf.Network('trl_data/mismatched line.s2p') dut_corrected = trl.apply_cal(dut_raw) dut_corrected.plot_s_db()
/home/docs/checkouts/readthedocs.org/user_builds/scikit-rf/conda/v0.14.8/lib/python3.5/site-packages/scikit_rf-0.14.8-py3.5.egg/skrf/calibration/calibration.py:2114: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions. To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`. error_vector_at_f, residuals_at_f = npy.linalg.lstsq(Q,M)[0:2]
What are they?¶
Described in  by Roger Marks, switch-terms account for the fact that the 8-term (aka error-box ) model is overly simplified. The two error networks change slightly depending on which port is being excited. This is due to the internal switch within the VNA. The change in reflection coefficient at the VNA’s internal switch is known as a switch term, it can be directed measured and removed.
-  R.B. Marks, “Formulations of the Basic Vector Network Analyzer Error Model including Switch-Terms,” in ARFTG Conference Digest-Fall, 50th, 1997, vol. 32, pp. 115-126
How do I get them ?¶
To measure the switch terms manually, you can define custom traces as ratio’s of receivers and save the data to touchstone files. Assume ports are labeled 1 and 2, and incident waves are a’s and reflected waves are b’s. Then, the
- forward switch term ==
source port 1
- reverse switch term ==
source port 2
Can I get them with skrf?¶
Yes. There is a PNA driver in the
skrf.vi.vna module. It has code to
pull the switch terms.
Can get them Onboard a PNA?¶
Yes. See the image below for an example of setting this up on a PNA.
from IPython.display import Image Image('switch_term_dialog.png',width=800)