Skip to main content

labdevices

Continuous integration MIT licensed MIT licensed

SDK for devices used in our atomic physics research lab. Since there is probably more of those devices used in other labs as well, this package might be of a more general use.

Included devices

The given links guide you to the programmer manuals of the included devices.

Company Model
ANDO AQ-6315A/B spectrum analyzer
Allied Vision GigE cameras
Applied Motion Products STF03D stepper motor controller
Keysight 3000T X-Series oscilloscope
53220A/53230A counter
Kuhne Electronic MKU LO 8-13 PLL local oscillator
Newport SMC100 positioner controller
Pfeiffer Vacuum TPG362 vacuum gauge
Rohde & Schwarz FPC1000 spectrum analyzer
RTB2000 oscilloscope
Stanford Research Systems DG645 delay generator
Thorlabs TSP01 temperature sensor

Third party dependencies

Most dependencies are installed automatically. For some devices, however, there are exceptions that need to be installed manually:

Installation

It is recommended to install the package into a virtual environment.

A) For general use

pip install labdevices

B) For development

Clone the repository and from inside the package folder run

pip install -e .

Changes in the code will then be reflected when reimporting the labdevices package. No new installation necessary.

There is also a Jupyter Notebook provided that contains some use examples and is handy for development.

Usage

Once the labdevices package is installed, simply do e.g.

from labdevices.thorlabs import TSP01

or similar corresponding commands. For each device there should be a dummy device available in order to test software, when there is actually no device connected. For the switching to a dummy device simply import

from labdevices.thorlabs import TSP01Dummy

with Dummy added to the device's class name. All methods of these mock devices return the same type as their real equivalents. They also accept functions that change their internal parameters. However, their functionality is for now limited, i.e. functions that get a certain parameter will always return the same value, even if the parameter was set to a different value.

Testing

There is two kinds of tests implemented:

Interface tests

Run by

python -m unittest test.test_interface

This checks that all devices have the basic methods implemented that a device needs, like e.g. initialize(), query(), or close()

Unit tests

Run by e.g.

python -m unittest test.test_keysight.CounterTest
python -m unittest test.test_keysight.CounterDummyTest

As shown here, these tests should exist for each device and its dummy version. For CI only the tests of the dummy devices are run (see .travis.yml). The test with the actual device can only be performed with the respective device attached.

The idea of those tests is to check that all the methods work, that the return format is correct, and that the dummy devices support calling all available methods and properties.

In the future one might want to improve the tests by e.g. changing a parameter and checking whether that parameter was actually changed. But this is currently not supported by the dummy devices.

In order to run a test across all the dummy classes use:

python -m unittest test -k DummyTest

Troubleshooting

Ubuntu

If you want to read a VISA address with the pyvisa package and you get a message of the following type

Found a device whose serial number cannot be read. The partial VISA resource name is: USB0::2733::443::???::2::INSTR

the issue is related to the permissions regarding the udev rules. If you don't have permission to write on USB devices you will not be able to communicate properly with the device. To solve this problem (see also here) you have to create a group with the name usb by

addgroup --system usb

Next, add your user to that group by

sudo adduser <user> usb

where <user> is your Ubuntu user name, which is also shown in the terminal at the beginning of each line.

Create a file in /etc/udev/rules.d/ with the name 50-myusb.rules (if it does not exist yet) and add the following line

SUBSYSTEM=="usb", MODE="0666", GROUP="usb"

After restarting the PC check that you are part of the usb group by typing groups into the terminal.

The communication with the usb device should now work.

Ethernet devices

If an Ethernet device is not recognized, check its settings. Usually a fixed (not dynamic) IP address can be given. That address has to be part of the local subnet.

Contact

  • Repo owner: Julian Krauth, j.krauth@vu.nl
  • Institution: Vrije Universiteit Amsterdam, Faculty of Sciences, The Netherlands

Metadata

Release files for labdevices 0.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for labdevices 0.10.2
File Size Uploaded Provenance Actions
labdevices-0.10.2.tar.gz 1.3 MB Without provenance Details for labdevices-0.10.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for labdevices 0.10.2
File Interpreter ABI Platform Actions
labdevices-0.10.2-py3-none-any.whl Python 3 none any Details for labdevices-0.10.2-py3-none-any.whl

Total release size: 2.6 MB

Release files / labdevices-0.10.2.tar.gz

Download URL labdevices-0.10.2.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
da3d98f4e3d348b21ccf0503ebf8cfda2b0b644cec31153366abc188ad1e909c
BLAKE2b-256 checksum
How to use checksums
2f71c115aaeda80030921bc6a322604cc3dc20df744daab74aa0abe5af85f0d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

Release files / labdevices-0.10.2-py3-none-any.whl

Download URL labdevices-0.10.2-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
93802cebbb744dc677301b8a68145f44ae1aacbdacf4dbf711171072c0b88be7
BLAKE2b-256 checksum
How to use checksums
7d1a74953414fca851177dcf678e8dfcb6eb6fe3f6681ab1dad4318741d2f4bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

Security for labdevices 0.10.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page