Skip to content

Repository files navigation

code%20style black 000000 License MIT yellow fold left

Zurich Instruments LabOne API Examples

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. Examples for other APIs, i.e., C, .NET, and LabVIEW are located inside the LabOne installation directory. For more details, see the LabOne API User Manual.

See the following sections for a detailed description on how to use the examples:

Project structure

📒 repository
  📂 hf2-mf-uhf (1)
    📂 <api> (3)
      📄 example_*
  📂 <instrument> (2)
    📂 <api> (3)
      📄 example_*
  📂 utils (4)
    📂 <api> (3)
  1. The hf2-mf-uhf directory contains examples valid for HF2, MF and UHF instruments.

  2. Instrument-specific examples are located in the respective directory.

  3. The modules directory includes examples for LabOne modules shared among various instruments.

  4. Each directory is separated into the different APIs, i.e., Python and MATLAB.

  5. General helper functions are located in the utils directory.

Python API

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 API 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.

MATLAB API

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 MATLAB API in the LabOne API User Manual.

To easily access the examples from within MATLAB, the function ziAddExamplePath, located in the root of this project, adds all the example subdirectories to the MATLAB’s path for this session.

>> ziAddPath

To see all the available examples, run:

>> ziListExamples

To run one of the examples, follow the steps below:

  • Power on your instrument and ensure it is discoverable in the LabOne user interface.

  • Start MATLAB and setup the MATLAB API.

  • Navigate to the MATLAB API directory and run the function ziAddExamplePath.

  • If an example is a MATLAB function, run it by calling its name in MATLAB with your device ID as the only input argument, e.g.,

    >> example_poll('dev1234')
  • If an example is a MATLAB script, first modify the device ID in the script and then run it by calling its name in MATLAB, e.g.,

    >> example_data_streaming_simple

About

Collection of examples for the different LabOne APIs that Zurich Instruments provide

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages