def test_save_measurement_locally(self): vna = Vna() vna.open_tcp('rsa22471.local') vna.preset() ports = [1, 2] ch = vna.channel() try: success = ch.save_measurement_locally('test', ports) except: print(sys.exc_info()[0]) print(vna.errors) raise if not success: print(vna.errors) vna.clear_status() self.assertTrue(success)
# create Vna instance vna = Vna() # log vna.open_log(log_file) vna.print_info() # connect to instrument (no visa) vna.open_tcp(address) # alternatively, using pyvisa: # vna.open('gpib', 20) # preset and clear errors vna.clear_status() vna.preset() vna.pause() # create an interesting setup # to save ch1 = vna.channel(1) ch1.start_frequency_Hz = 1.0e9 ch1.stop_frequency_Hz = 2.0e9 ch1.points = 401 trc1 = vna.trace('Trc1') trc1.parameter = 'S11' index = vna.create_diagram() name = vna.create_trace()
from rohdeschwarz.instruments.vna import Vna from rohdeschwarz.instruments.vna import SweepType import matplotlib.pyplot as plt import numpy as np # Open instrument connection vna = Vna() vna.open('TCPIP', '127.0.0.1') # SCPI command log vna.open_log("SCPI Command Log.txt") print_header(vna.log, "Measure with a1", "0.0.1") vna.print_info() # Preset vna.preset() vna.pause() vna.clear_status() # Setup channel 1 ch1 = vna.channel(1) ch1.sweep_type = SweepType.power ch1.start_power_dBm = -20.0 ch1.stop_power_dBm = 0 ch1.points = 201 ch1.if_bw_Hz = 1, 'kilo' ch1.cal_group = 'example' ch1.manual_sweep = True # Setup Trc1: S21 s21_trace = vna.trace('Trc1')