Qcodes example for Vaunix LDA step attenuator

[1]:
from qcodes_contrib_drivers.drivers.Vaunix.LDA import Vaunix_LDA
import qcodes as qc

Initialize the instrument

The DLL that comes with the instrument, VNX_atten64.dll and/or VNX_atten.dll, for 64-bit Windows and 32-bit Windows, respectively, should be found in dll_path.

[19]:
dll_path = r"C:\Vaunix"
serial_num = 55102  # Serial number that works with the test_mode=True, does not require device connection.

qc.Instrument.close_all()
attenuator = Vaunix_LDA("LDA", serial_num, dll_path=dll_path, test_mode=True)
attenuator.print_readable_snapshot(update=True)
Connected to: Vaunix LDA-102 (serial:55102, firmware:529) in 0.00s
LDA:
        parameter        value
--------------------------------------------------------------------------------
IDN               :     {'vendor': 'Vaunix', 'model': 'LDA-102', 'serial': 55102,...
attenuation       :     25 (dB)
working_frequency :     6300000000 (Hz)

Set parameters

The parameters are accessible as attenuator.attenuation (and attenuator.working_frequncy, if supported by model)

[11]:
attenuator.attenuation(50)
print("Set to", attenuator.attenuation(), "dB")
#attenuator.working_frequency()
Set to 50.0 dB

Save settings

Optionally, save current settings. They will be loaded when the devices is powered on.

[4]:
attenuator.save_settings()

Close instrument

[5]:
attenuator.close()

Model with many channels

If the device model has many channels, the parameters are accessible as attenuator.ch1.attenuation etc. The name ch# can be overridden by supplying a dict of names at initialization.

[9]:
serial_num = 23160

qc.Instrument.close_all()
attenuator = Vaunix_LDA("LDA", serial_num,
                        channel_names={1: "main_port", 3: "test_port"}, # name channels 1 and 3
                        test_mode=False)
Connected to: Vaunix LDA-802Q (serial:23160, firmware:529) in 0.21s
[12]:
attenuator.main_port.attenuation(25)
attenuator.main_port.working_frequency(6.3e9)

attenuator.ch2.attenuation(2.2)

print("Channel", attenuator.main_port.channel_number, "attenuation set to", attenuator.main_port.attenuation(), "dB")
print("Channel", attenuator.main_port.channel_number, "wf set to", attenuator.main_port.working_frequency(), "Hz")
print("Channel", attenuator.ch2.channel_number, "attenuation set to", attenuator.main_port.attenuation(), "dB")
Channel 1 attenuation set to 25.0 dB
Channel 1 wf set to 6300000000 Hz
Channel 2 attenuation set to 25.0 dB
[13]:
attenuator.print_readable_snapshot(update=True)
LDA:
        parameter value
--------------------------------------------------------------------------------
IDN :   {'vendor': 'Vaunix', 'model': 'LDA-802Q', 'serial': 23160, 'firmware': ...
LDA_main_port:
        parameter        value
--------------------------------------------------------------------------------
attenuation       :     25 (dB)
working_frequency :     6300000000 (Hz)
LDA_ch2:
        parameter        value
--------------------------------------------------------------------------------
attenuation       :     2.2 (dB)
working_frequency :     200000000 (Hz)
LDA_test_port:
        parameter        value
--------------------------------------------------------------------------------
attenuation       :     0 (dB)
working_frequency :     200000000 (Hz)
LDA_ch4:
        parameter        value
--------------------------------------------------------------------------------
attenuation       :     30 (dB)
working_frequency :     6000000000 (Hz)
[17]:
attenuator.close()
[ ]: