Skip to content

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

License

Notifications You must be signed in to change notification settings

zhinst/labone-api-examples

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 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:

Project structure

📒 repository
  📂 common (1)
    📂 <api> (3)
      📄 example_*
  📂 <instrument> (2)
    📂 <api> (3)
      📄 example_*
  📂 utils (4)
    📂 <api> (3)
  1. The common directory contains examples valid for all instruments.

  2. Instrument specific examples are located in the respective directory

  3. Each directory is separated into the different APIs (e.g. python)

  4. 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 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 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 call ziAddExamplePath

  • 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')

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages