Which Python API should I use?¶
The LabOne API itself offers two different python packages. The first one (zhinst.core
)
directly binds to the underlying C++ implementation of the LabOne client
library, making it the fastest way to interact with LabOne from python. The functions
and feature set mostly match the ones from the other APIs since they are all based
on the same C++ library.
However, this low level implementation has a big influence on its look and feel. Comparing it to other python packages, it is often not very intuitive to work with. For example, the differentiation between the node types normally is not necessary in a dynamically typed language such as python.
The second package (zhinst.toolkit
) therefore wraps around the Core API offering a
more python-friendly interface and behavior.
Note
The Toolkit API is only a thin wrapper around the Core API. It does not reimplement the communication with the LabOne Data Server, but maps all calls to the Core API.
Quantum Applications
Additionally, Zurich Instruments offers a quantum computing software framework called LabOne Q.
LabOne Q is designed to accelerate the progress in your laboratory, by providing you with a way of processing many devices at once and by simplifying sequence programming and timing,
If you use our instruments for quantum applications we invite you to take a look and see how if can set you up quickly.
Toolkit features¶
The Toolkit API provides the following features:
-
Object based approach. Instead of referencing nodes through their path they can be accessed through objects.
Core APIdaq.getNodeInfo("/DEV2345/DIOS/0/MODE")
Toolkit APIdevice.dios[0].mode.node_info
-
Single call operator to get and set the value of a node.
Core APIdaq.getInt("/DEV2345/DIOS/0/MODE") daq.setInt("/DEV2345/DIOS/0/MODE", 2)
Toolkit APIdevice.dios[0].mode() device.dios[0].mode(2)
-
Direct access to all utils function on a device level
Core APIfrom zhinst.utils.shfqa import load_sequencer_program load_sequencer_program(daq, "DEV2345", 0, seqc)
Toolkit APIshfqa.qachannels[0].generator.load_sequencer_program(seqc)
-
Additional helper classes that easy the use of complex functionalities. E.g. Handling of Waveforms and Command Tables.
Conclusion¶
In general, the Toolkit API is the best choice for most use cases. Since it is only a wrapper around the Core API, it does not lack any functionality and falling back to the Core API is always possible.
The Core API is the right choice for custom frameworks that want to get the last bit of performance out of the LabOne Python API and are willing to pay the additional development cost.