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.
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 |
Most dependencies are installed automatically. For some devices, however, there are exceptions that need to be installed manually:
- ANDO spectrometer: prologix-gpib-ethernet
- Allied Vision GigE cameras: Vimba SDK
It is recommended to install the package into a virtual environment.
pip install labdevices
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.
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.
There is two kinds of tests implemented:
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()
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
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.
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.
- Repo owner: Julian Krauth, [email protected]
- Institution: Vrije Universiteit Amsterdam, Faculty of Sciences, The Netherlands