Connecting to the Instrument¶
Note
This tutorial is applicable to all SHFQA Instruments.
Goals and Requirements¶
The goal of tutorial is to demonstrate how to connect the SHFQA to a host computer and how to configure it in general, e.g. set center frequency and power ranges of input and output, using Zurich Instrument Toolkit API.
Preparation¶
The tutorial starts with the Instrument in the default configuration (e.g., after a power cycle). For an optimal tutorial experience, please follow these preparation steps:
- ensure that the version of the LabOne Python API, LabOne and the
Firmware of the SHFQA device, zhinst (
pip install zhinst
) and Python (3.7 or newer) are updated and compatible, - make sure that the Instrument is powered on and connected by Ethernet to a local area network (LAN) where the host computer resides,
- start LabOne and open the LabOne Graphical User Interface using the default web browser,
Note
You may also use a USB instead of Ethernet connection. If you do so, use the port labeled "Maintenance" on the back panel rather than the port labeled "USB". The latter is not supported until future notice.
Warning
When connecting cables to the Instrument’s SMA ports, use a torque wrench specified for brass core SMA (4 in-lbs, 0.5 Nm). Using a standard SMA torque wrench (8 in-lbs) or a wrench without torque limit can break the connectors.
Tutorial¶
First we connect to the SHFQA using Python. For this we first create a
session with the Zurich Instruments Toolkit and then connect to the
instrument using the following code and by replacing DEVXXXXX
with the
id of our SHFQA instrument, e.g. DEV12001
:
## Load the LabOne API and other necessary packages
from zhinst.toolkit import Session
DEVICE_ID = 'DEVXXXXX'
SERVER_HOST = 'localhost'
session = Session(SERVER_HOST) ## connect to data server
device = session.connect_device(DEVICE_ID) ## connect to device
Defining the data server allows users to connect to the instrument in
the local network when using localhost
or to specify a specific
address, for example when a remote connection needs to be established to
the instrument. Remember that for a remote
connection,
Connectivity needs to be set From Everywhere.
After successfully running the above code snippet, we check whether the Data Server, instrument firmware, and zhinst versions are compatible with each other:
device.check_compatibility()
If it does not throw an error, we are now in the position to access the device. If it returns an error, resolve the mismatched components identified in the error message.
-
Configure input and output of the Channel
All parameters can be configured by using the instrument nodes (see Node Documentation), and sent to the Instrument in a single transaction by device.set_transaction(). The instrument notes can also be found in tooltips when the mouse cursor stays on control icons and in API codes on the bottom of the LabOne User Interface after parameter updates.
The physical Channel 1 is configured as center frequency of 6 GHz, input power range of 0 dBm, output power range of -5 dBm and both input and output are enabled.
CHANNEL_INDEX = 0 # phyiscal Channel 1 with device.set_transaction(): device.qachannels[CHANNEL_INDEX].centerfreq(6e9) # in units of Hz device.qachannels[CHANNEL_INDEX].input.range(0) # in units of dBm device.qachannels[CHANNEL_INDEX].output.range(-5) # in units of dBm device.qachannels[CHANNEL_INDEX].input.on(1) # enable input device.qachannels[CHANNEL_INDEX].output.on(1) # enable output