Package: labdevices
labdevicesSDK 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 devicesThe given links guide you to the programmer manuals of the included devices.CompanyModelANDOAQ-6315A/Bspectrum analyzerAllied VisionGigEcamerasApplied Motion ProductsSTF03Dstepper motor controllerKeysight3000T X-Seriesoscilloscope53220A/53230AcounterKuhne ElectronicMKU LO 8-13 PLLlocal oscillatorNewportSMC100positioner controllerPfeiffer VacuumTPG362vacuum gaugeRohde & SchwarzFPC1000spectrum analyzerRTB2000oscilloscopeStanford Research SystemsDG645delay generatorThorlabsTSP01temperature sensorThird party dependenciesMost dependencies are installed automatically. For some devices, however, there are exceptions that need to be installed manually:ANDO spectrometer:prologix-gpib-ethernetAllied Vision GigE cameras:Vimba SDKInstallationIt is recommended to install the package into a virtual environment.A) For general usepip install labdevicesB) For developmentClone the repository and from inside the package folder runpip 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.UsageOnce the labdevices package is installed, simply do e.g.fromlabdevices.thorlabsimportTSP01or 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 importfromlabdevices.thorlabsimportTSP01DummywithDummyadded 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.TestingThere is two kinds of tests implemented:Interface testsRun bypython -m unittest test.test_interfaceThis checks that all devices have the basic methods implemented that a device needs, like e.g.initialize(),query(), orclose()Unit testsRun by e.g.python -m unittest test.test_keysight.CounterTestpython -m unittest test.test_keysight.CounterDummyTestAs 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 DummyTestTroubleshootingUbuntuIf you want to read a VISA address with the pyvisa package and you get a message of the following typeFound a device whose serial number cannot be read. The partial VISA resource name is: USB0::2733::443::???::2::INSTRthe issue is related to the permissions regarding theudev 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 alsohere) you have to create a group with the nameusbbyaddgroup --system usbNext, add your user to that group bysudo adduser <user> usbwhere<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 name50-myusb.rules(if it does not exist yet) and add the following lineSUBSYSTEM=="usb", MODE="0666", GROUP="usb"After restarting the PC check that you are part of the usb group by typinggroupsinto the terminal.The communication with the usb device should now work.Ethernet devicesIf 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.ContactRepo owner:  Julian Krauth,j.krauth@vu.nlInstitution: Vrije Universiteit Amsterdam, Faculty of Sciences, The Netherlands