Skip to content

Commit d434797

Browse files
tobiasahmarkheik
andauthored
Refactoring (#18)
Adapt labber drivers to new toolkit 0.3 This is a major refactoring of the Labber drivers and breaks the API in many ways. It is however necessary since the old drivers did not scale with the fast pace our software and instruments evolve. Before you upgrade read the documentation and see how the changes affect your workflow. (The old driver will continue to work but will not be actively maintained!) The refactored driver has the following features: * Introduce python package zhint-labber which is able to automatically generate * the Labber driver for each Zurich Instruments device (including HF2). * Easy to access CLI for zhinst-labber. * Node naming aligned with LabOne. * Automatic support for all nodes available on the device. * Enhanced logging functionality. * Waveform Processor that is able to convert native AWG Waveforms into its parts. * Add DAQ, Sweeper and SHFQA sweeper modules Co-authored-by: Markus Heikkinen <[email protected]>
1 parent ec4cfb3 commit d434797

File tree

99 files changed

+20644
-58041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+20644
-58041
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
jobs:
11+
tests:
12+
name: "Python ${{ matrix.python }}"
13+
runs-on: "ubuntu-latest"
14+
env:
15+
USING_COVERAGE: "3.9"
16+
strategy:
17+
matrix:
18+
name: [py37, py38, py39, py310]
19+
include:
20+
- name: py37
21+
python: 3.7
22+
- name: py38
23+
python: 3.8
24+
- name: py39
25+
python: 3.9
26+
coverage: "--cov"
27+
- name: py310
28+
python: "3.10"
29+
30+
steps:
31+
- uses: "actions/checkout@v2"
32+
- uses: "actions/setup-python@v1"
33+
with:
34+
python-version: "${{ matrix.python }}"
35+
- name: "Install dependencies"
36+
run: |
37+
set -xe
38+
python -VV
39+
python -m site
40+
python -m pip install --upgrade pip setuptools wheel
41+
python -m pip install --upgrade coverage[toml] virtualenv pytest-cov codecov
42+
python -m pip install --upgrade -r requirements.txt
43+
python -m pip install .
44+
- name: "Run pytest targets for ${{ matrix.python }}"
45+
run: |
46+
pytest --cov=zhinst.labber tests/
47+
- name: codecov
48+
if: matrix.coverage
49+
run: |
50+
codecov

.gitignore

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,69 @@
1-
*.pyc
2-
1+
#project files
2+
.idea
33
.vscode
4+
pytest.ini
5+
6+
# Byte-compiled / optimized / DLL files
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
11+
# Distribution / packaging
12+
.Python
13+
build/
14+
_build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
pip-wheel-metadata/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# Unit test / coverage reports
34+
htmlcov/
35+
.tox/
36+
.nox/
37+
.coverage
38+
.coverage.*
39+
.cache
40+
nosetests.xml
41+
coverage.xml
42+
*.cover
43+
*.py,cover
44+
.hypothesis/
45+
.pytest_cache/
446

47+
# Jupyter Notebook
48+
examples/*.ipynb
49+
*.ipynb_checkpoints
50+
.ipynb_*
51+
52+
# pyenv
53+
.python-version
54+
_version.py
55+
56+
# Environments
57+
.env
58+
.venv
59+
env/
60+
venv*/
61+
ENV/
62+
env.bak/
63+
venv.bak/
64+
65+
#db, web
566
.DS_Store
67+
68+
# documentation
69+
_autosummary

AUTHORS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This is the list of zhinst-labber's significant contributors.
2+
#
3+
# This does not necessarily list everyone who has contributed code,
4+
# especially since many employees of one corporation may be contributing.
5+
# To see the full list of contributors, see the revision history in
6+
# source control.
7+
8+
Zurich Instruments
9+
Tobias Ahrens
10+
Markus Heikkinen

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# zhinst-labber Changelog
22

33

4+
## Version 0.3.0
5+
* Adapt drivers to ``zhinst-toolkit`` 0.3.x which is a major refactoring and improves
6+
speed, stability and feature availability.
7+
* Introduce python package ``zhint-labber`` which is able to automatically generate
8+
the Labber driver for each Zurich Instruments device (including HF2).
9+
* Easy to access CLI for zhinst-labber.
10+
* Node naming aligned with LabOne.
11+
* Automatic support for all nodes available on the device.
12+
* Enhanced logging functionality.
13+
* Waveform Processor that is able to convert native AWG Waveforms into its parts.
14+
* Add DAQ, Sweeper and SHFQA sweeper modules
15+
16+
## Version 0.2.0
17+
* Add SHFQA and SHFSG support
18+
419
## Version 0.1.0
5-
* initial release
20+
* initial release

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include src/ *.json

README.md

Lines changed: 49 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,73 @@
1-
# Zurich Instruments Labber Drivers
1+
![CI](https://github.com/zhinst/zhinst-labber/workflows/CI/badge.svg?branch=main)
2+
[![Coverage](https://codecov.io/gh/zhinst/zhinst-labber/branch/main/graph/badge.svg?token=VUDDFQE20M)](https://codecov.io/gh/zhinst/zhinst-labber)
3+
[![PyPI version](https://badge.fury.io/py/zhinst-labber.svg)](https://badge.fury.io/py/zhinst-labber)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
6+
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?style=social&label=Follow%20%40zhinst)](https://twitter.com/zhinst)
27

3-
The Zurich Instruments Labber Drivers are a collection of instrument drivers for
4-
the scientific measurement software [Labber](http://labber.org/). They provide
5-
a high-level interface of Zurich Instruments devices such as
8+
# Zurich Instruments Labber Drivers
69

7-
* the PQSC Programmable Quantum System Controller
8-
* the HDAWG Arbitrary Waveform Generator
9-
* the UHFQA and SHFQA Quantum Analyzers
10-
* the MFLI and UHFLI Lock-In Amplifiers
10+
The Zurich Instruments Labber Drivers is a python package that is able to
11+
automatically generate and update instrument drivers for all Zurich Instruments
12+
devices for the scientific measurement software [Labber](http://labber.org/).
1113

1214
The Labber drivers are based on the
1315
[Zurich Instruments Toolkit](https://github.com/zhinst/zhinst-toolkit)
14-
(*zhinst-toolkit*), an extension of our Python API *ziPython* for high-level
15-
instrument control.
16+
(*zhinst-toolkit*), a high level driver of our Python API *ziPython*.
1617

18+
> **WARNING**
19+
>
20+
> Upgrading from zhinst-labber versions lower than 0.3 needs some special attention
21+
> since version 0.3 breaks the API in many ways and measurements need to be adapted.
22+
> If you need more Information on the upgrading process or need assistance feel
23+
> free to contact the Zurich Instruments support at any time. ([email protected])
1724
1825
# Status
1926

2027
The Zurich Instruments Labber Drivers are well tested and considered stable
2128
enough for general usage. The interfaces may have some incompatible changes
22-
between releases. Please check the changelog if you are upgrading.
23-
24-
25-
# Getting Started
26-
27-
## LabOne
28-
29-
As prerequisite, the LabOne software version 20.01 or later must be installed.
30-
It can be downloaded for free at https://www.zhinst.com/labone. Follow the
31-
installation instructions specific to your platform. Verify that you can connect
32-
to your instrument(s) using the web interface of LabOne. If you are upgrading
33-
from an older version, be sure to update the firmware of al your devices using
34-
the web interface before continuing. In principle LabOne can be installed in a
35-
remote machine, but we highly recommend to install on the local machine where
36-
you intend to run the experiment.
29+
between releases. Please check the changelog if you are upgrading to the latest version.
3730

31+
## LabOne software
32+
As a prerequisite, the LabOne software version 22.02 or later must be installed.
33+
It can be downloaded for free at
34+
[https://www.zhinst.com/labone](https://www.zhinst.com/labone). Follow the
35+
installation instructions specific to your platform. Verify that you can
36+
connect to your instrument(s) using the web interface of LabOne. If you are
37+
upgrading from an older version, be sure to update the firmware of all
38+
Zurich Instruments devices in use by using the web interface.
3839

39-
## Labber Drivers
40+
In principle LabOne can be installed in a remote machine, but we highly
41+
recommend to install it on a local machine where you intend to run the experiment.
4042

41-
Download this repository as ZIP folder and unpack its content. It contains a set of
42-
folders with the names *'Zurich_Instruments_XXXX'* that define the instrument
43-
drivers. In order to make the drivers available in Labber, the folders
44-
*'Zurich_Instruments_XXXX'* need to be copied to your *local* Labber Drivers
45-
folder. It is located in *'C:\Users\USERNAME\Labber\Drivers'* or similar. Once
46-
the driver folders are copied to your local Labber Drivers folder, they are
47-
available to be selected in the *Labber Instrument Server*.
48-
49-
## Install dependencies (e.g. `zhinst-toolkit`)
50-
51-
The Zurich Instruments Labber Drivers are based on the
52-
[Zurich Instruments Toolkit](https://github.com/zhinst/zhinst-toolkit) and a small set of third party packages.
53-
A complete list can be found inside the [requirements.txt](requirements.txt)[]().
54-
There are two ways to install these dependencies:
55-
56-
### Using Labber's Python distribution
43+
# Getting Started
5744

58-
Labber comes with its own Python distribution that is used by default. The required packages needs to be installed with to this Python distribution,
59-
which is done using Labber's own `pip` package manager. It is located
60-
(on Windows) under C:\Program Files
61-
*'(x86)\Labber\python-labber\Scripts\pip.exe'* or similar.
45+
Labber comes with its own Python distribution that is used by default.
46+
If not specified otherwise (Preferences -> Advanced -> Python distribution) the
47+
following command needs to be executed within this distribution.
48+
(C:\\Program Files\\Labber\\python-labber\\Scripts\\pip.exe or similar).
6249

63-
From within the unpacked project folder run:
64-
``` bash
65-
<path to Labber Scripts folder>\pip install -r requirements.txt
50+
```
51+
pip install zhinst-labber
6652
```
6753

68-
### Use your own Anaconda distribution
54+
The drivers for an device can now be generated using the command line interface.
6955

70-
Alternatively, Labber can also configured to use your own Python distribution. Under *Instrument Server -> Preferences -> Advanced -> Python Distribution* you can
71-
point Labber to a different Python distribution, for example your *Anaconda*
72-
environment. If you chose for example you *base* Anaconda environment, install the required packages as followed.
56+
For example the following command generated the driver for the Device DEV1234
57+
inside the Labber driver folder of the ZI user.
7358

74-
From within the unpacked project folder run:
7559
```
76-
conda activate base
77-
pip install -r requirements.txt
60+
zhinst-labber setup "C:\Users\ZI\Labber\Drivers" DEV1234 localhost
7861
```
7962

80-
## Try It Out
63+
## Documentation
64+
For a full documentation see [here](https://docs.zhinst.com/zhinst-labber/en/latest).
65+
66+
## Contributing
67+
We welcome contributions by the community, either as bug reports, fixes and new
68+
code. Please use the GitHub issue tracker to report bugs or submit patches.
69+
Before developing something new, please get in contact with us.
8170

82-
To see if your installation was successful, try to connect to your device. Add
83-
the instrument driver of your model to the *Instrument Server* with the serial
84-
number (e.g. *'dev1234'*) in the *Address* field and start the instrument. If
85-
the window turns green and no error emssage appears, you are ready to go!
71+
## License
72+
This software is licensed under the terms of the MIT license.
73+
See [LICENSE](LICENSE) for more detail.

0 commit comments

Comments
 (0)