Anritsu VNA Python Script

Categories physics, python, Stickied

I spent a lot of time in the lab last month, taking measurements with an Anritsu 37xxxC series VNA. It would’ve taken me even longer if I hadn’t made this little python script to control the VNA over GPIB. All it does it open a connection, grab the data off and then write it to a CSV file. The magic lines you need to know:

## Open a connection to the VNA
VNA = visa.instrument("GPIB::06")

## Select a channel
VNA.write("CH1")

## Get frequency data
freq = VNA.ask_for_values("OFV")

## Get channel data
S11 = VNA.ask_for_values("OFD")

If you’re lazy just run the grabData script and voila. If you’re not, try editing the grabData() function to your needs and script away.

To get this to work, you’ll need Python 2.5, pyVisa and the relevant NI drivers (488.2 and for me the ones for the UBS-GPIB thing). There’s some useful documentation on the Anritsu site here. Kudos to Oliver King for his help .