Python Toolkit API Device Drivers¶
One of the main differences to the lower level core API is that toolkit creates a device object for every connected device. This allows a more object oriented and intuitive handling when working with multiple devices.
Some devices have dedicated classes exposing useful helper functions. But all devices expose the object oriented node tree handling.
Important
Not all devices have dedicated classes. This does not mean that these devices cannot be used with the toolkit API. All devices are supported but not all of them have additional helper functions on top of the their core functionality.
zhinst.toolkit.driver.devices.DeviceType = t.Union[BaseInstrument, HDAWG, PQSC, QHub, SHFQA, SHFSG, UHFLI, UHFQA, SHFQC]
module-attribute
¶
zhinst.toolkit.driver.devices.base.BaseInstrument(serial, device_type, session)
¶
Bases: Node
Generic toolkit driver for a Zurich Instrument device.
All device specific class are derived from this class. It exposes the nodetree and also implements common functions valid for all devices. It also can be used directly, e.g. for instrument types that have no special class in toolkit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
serial |
str
|
Serial number of the device, e.g. 'dev12000'. The serial number can be found on the back panel of the instrument. |
required |
device_type |
str
|
Type of the device. |
required |
session |
Session
|
Session to the Data Server |
required |
device_options: str
cached
property
¶
device_type: str
property
¶
serial: str
property
¶
session: Session
property
¶
check_compatibility()
¶
Check if the software stack is compatible.
Only if all versions and revisions of the software stack match stability can be ensured. The following criteria are checked:
* minimum required zhinst-utils package is installed
* minimum required zhinst-core package is installed
* zhinst package matches the LabOne Data Server version
* firmware revision matches the LabOne Data Server version
Raises:
Type | Description |
---|---|
ConnectionError
|
If the device is currently updating |
ToolkitError
|
If one of the above mentioned criterion is not fulfilled |
factory_reset(*, deep=True, timeout=30)
¶
Load the factory default settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deep |
bool
|
A flag that specifies if a synchronization should be performed between the device and the data server after loading the factory preset (default: True). |
True
|
timeout |
int
|
Timeout in seconds to wait for the factory reset to complete. |
30
|
Raises:
Type | Description |
---|---|
ToolkitError
|
If the factory preset could not be loaded. |
TimeoutError
|
If the factory reset did not complete within the given timeout. |
get_streamingnodes()
¶
set_transaction()
¶
Context manager for a transactional set.
Can be used as a context in a with statement and bundles all node set commands into a single transaction. This reduces the network overhead and often increases the speed.
Within the with block a set commands to a node will be buffered and bundled into a single command at the end automatically. (All other operations, e.g. getting the value of a node, will not be affected)
Warning
The set is always performed as deep set if called on device nodes.
Example
with device.set_transaction(): device.test[0].a(1) device.test[1].a(2)