This repository contains various examples for controlling Zurich Instruments devices through the LabOne APIs.
Only Python and Matlab examples can be found in this repository right now. Examples for other APIs will move here soon. Until then, the examples for C, .NET, and LabVIEW can be found in the LabOne API documentation or inside the LabOne installation.
See the following sections for a detailed description on how to use the examples:
📒 repository 📂 hf2-mf-uhf (1) 📂 <api> (3) 📄 example_* 📂 <instrument> (2) 📂 <api> (3) 📄 example_* 📂 utils (4) 📂 <api> (3)
-
The
hf2-mf-uhf
directory contains examples valid for HF2, MF and UHF instruments. -
Instrument specific examples are located in the respective directory
-
Each directory is separated into the different APIs (e.g. python)
-
General helper functions are located in the
utils
directory
In order to run the Python examples, one needs to have the latest zhinst
package installed and LabOne up and running.
(Please refer to the LabOne User Manual for further information.)
The Python examples are designed in a way that they can be run from the command line:
$ python path/to/example.py --help
Each example has a run_example
function that contains the example source.
Feel free to experiment, change or copy parts of the examples.
In order to run the Matlab examples, one needs to have the latest LabOne version installed and running. For more information to setup the Matlab API see the online documentation.
To easily access the examples from within Matlab, the function ziAddExamplePath
, located in the root of this project, adds all example subdirectories to the Matlab’s path for this session.
>> ziAddPath
To see all examples available run
>> ziListExamples
In order to run one of the examples please perform the following steps:
-
Start the instrument and make sure that the correct Data Server is running (task manager on windows)
-
On the Instrument, connect Signal Output1 to the Signal Input1 by means of a BNC cable
-
Start MATLAB
-
Setup the LabOne in Matlab (see. online documentation.)
-
Navigate to this folder in MATLAB
-
Run the MATLAB function
ziAddExamplePath.m
with the callziAddExamplePath
-
Start an example by calling the example by name in MATLAB with your device ID as the only input argument, e.g.,
>> example_poll('dev123')