Skip to main content

SDK for typical devices found in an atomic physics research lab.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labdevices-0.10.2.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

labdevices-0.10.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file labdevices-0.10.2.tar.gz.

File metadata

  • Download URL: labdevices-0.10.2.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for labdevices-0.10.2.tar.gz
Algorithm Hash digest
SHA256 da3d98f4e3d348b21ccf0503ebf8cfda2b0b644cec31153366abc188ad1e909c
MD5 73187079f80e02dea15ac248ae28039c
BLAKE2b-256 2f71c115aaeda80030921bc6a322604cc3dc20df744daab74aa0abe5af85f0d9

See more details on using hashes here.

File details

Details for the file labdevices-0.10.2-py3-none-any.whl.

File metadata

  • Download URL: labdevices-0.10.2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for labdevices-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93802cebbb744dc677301b8a68145f44ae1aacbdacf4dbf711171072c0b88be7
MD5 3d01ffccc034ad5f39ef50181a64613e
BLAKE2b-256 7d1a74953414fca851177dcf678e8dfcb6eb6fe3f6681ab1dad4318741d2f4bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page