This notebook demonstrates how to acquire two port sparameters and wave parameters using pyMez
from pyMez import *
whos_there()
If there is an instrument description in pyMez/instruments then static metadata about this instrument will be loaded into the class, otherwise it will function as intended without the static metadata
vna=VNA("GPIB::20")
The returned data will be in a touchstone style class
vna.initialize()
s2p=vna.measure_sparameters()
The touchstone style class has a show method that will display the two-port parameters in real-imaginary (RI), magnitude-angle (MA) or decibel-angle (DB)
s2p.show(format="RI");
Taking two port wave parameters works the same way, but uses the methods .initialize_w2p and .measure_w2p
vna.initialize_w2p()
w2p=vna.measure_w2p()
The W2P class also has a show method. It is a child of the AsciiDataTable class
w2p.show();
set_frequency must have a start and stop defined, either number_points or step has to be specified, and the type is optional (defaults to LIN, LOG is the other possibility). The ability to use segmented sweeps relies on add_segment. The start, stop and number of points is added to the segment table. The attribute vna.frequency_table holds the table that is written to the vna.
# this form works
vna.set_frequency(start=10**9,stop=10*10**9,number_points=101,type="LOG")
# This also works
vna.set_frequency(start=10**9,stop=10*10**9,step=10**8)
vna.initialize(reset="False")
vna.set_frequency(10**9,10**10,101)
s2p=vna.measure_sparameters()
# Note these sparameters are messed up on port 1
# This was due to a bad jumper on the front panel
s2p.show();