Using PyVISA on an Ubuntu-operating computer (Ubuntu 20.04.5 LTS), I would like to interact with a VNA machine (E8361A, Agilent technologies) in the following way,
1- Connect to the VNA through a port.
2- Send a signal to VNA to start S-parameter measurements within a specified frequency range at specified number of points.
3- Send a signal to VNA to stop S-parameter measurement, fetch the S-parameter data, transfer the data to the PC and save the data.
Q1: Which VNA port do you recommend to use (GPIB, Ethernet or USB), and why? Q2: Depending on the VNA port, what hardware is required to connect the PC to the VNA? Q3: Is there a way to adjust the power level of the VNA stimulus signal? If yes, how to inquire the maximum and minimum power levels? Can the power level be adjusted continuously or only discrete power levels are avilable? (Basically, how to control VNA's internal amplifiers/attenuators? Q4: Can you please share a sample Python code which uses PyVISA to save S-paramater data in the fashion described in steps 1--3? Q5: Does trigger port have to do anything with sending signals to the VNA to start and stop measurements?
Since I am not working on ubuntu, nor I have the machine you have I can't say much. I am also rather new to pyVISA so my knowledge there is also limited, but since no one else answered:
Q1. I use a usb port since it is the only one I have, but the faster the better i would assume. There seems to me to be more GPIB examples found on the internet so maybe it is an easier starting point.
Q2. As with others (like mine) I would assume only a cable.
Q3. Yes, see the [write][1] function. It may look something like this:
# Connect PNA to computer using resource_manager etc., it is well documented
PNA.Write(f':SOUR{channel_num}:POW:LEV:IMM:AMPL {source_level},"{source_name}"')
For the maximum and minimum values see the documentation of your hardware.
Q4. Your 'Send a signal' I don't know how to do. But you could just while-loop and send-and-recieve in each instance until you want it to stop. Here is an example from keysight: https://edadocs.software.keysight.com/kkbopen/a-python-programming-example-for-the-pna-family-vnas-sweep-time-various-point-counts-no-error-correction-577935568.html
Q5. I don't know.
EDIT: On Q4: I found this [link][2] , which would what I believe result in
PNA.write('SENS:SWE:MODE CONT') for continous sweeping and
PNA.write('SENS:SWE:MODE SING') for single sweeping.
In this case change from CONT to SING when appropriate and it should stop sweeping. [1]: https://pyvisa.readthedocs.io/en/latest/_modules/pyvisa/resources/messagebased.html#MessageBasedResource.write [2]: https://rfmw.em.keysight.com/wireless/helpfiles/89600b/webhelp/Subsystems/gui/content/mnu_control_sweep.htm