Esempio n. 1
0
    def test_source_power_cal(self, data):
        reads     = data['reads']
        ch        = data['channel']
        port      = data['port']
        sweeps    = data['sweeps']
        tolerance = data['tolerance']

        vna = Vna()
        vna.bus = FifoBus(reads)
        vna.channel(ch).source_power_cal(port, sweeps, tolerance)
        for write in data['writes']:
            if 'position' in write:
                pos = write['position']
                self.assertEqual(write['command'], vna.bus.writes[pos])
            else:
                self.assertIn   (write['command'], vna.bus.writes)
Esempio n. 2
0
 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)
Esempio n. 3
0
from pathlib import Path
from power_deembed import read_s21
from rohdeschwarz.instruments.vna import Vna

# patch rohdeschwarz vna
import power_deembed.patch.vna.channel.power_cal

root_path = Path(__file__).parent
filename = str(root_path / 'test' / 'fixtures' / '3 dB attenuator.s2p')

channel = 1
wave = 'b1'
vna = Vna()
vna.open_tcp()

# offsets
ch = vna.channel(channel)
freq_Hz, offsets_dB = read_s21(filename)
assert not False in freq_Hz == ch.cal_freq_Hz

# interpolate
# offsets_dB = np.interp(ch.cal_freq_Hz, freq_Hz, offsets_dB)

# deembed, apply
power_cal_dB = ch.get_power_cal(wave) - offsets_dB
ch.set_power_cal(power_cal_dB)
Esempio n. 4
0
from rohdeschwarz.instruments.vna import Vna

# Connect
vna = Vna()
vna.open_tcp('127.0.0.1')

# Calibrate channel 1 ports 1, 2
# using automatic cal unit
index = 1
ports = [1, 2]
vna.channel(index).auto_calibrate(ports)
Esempio n. 5
0
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()
trc2 = vna.trace(name)
trc2.parameter = 'S21'
trc2.diagram   = index

# save
Esempio n. 6
0
# 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')
s21_trace.parameter = 'S21'

# Setup Trc2: a1(P1)
vna.create_trace(channel=1, name='Trc2', parameter="a1(P1)")
a1_trace         = vna.trace('Trc2')