Device Management#
The device management in devctrl.devices may be slightly overkill for small setups, but it has two important advantages over just hard-coding devices:
- Device classes with exchangable devices:
Each device type (laser, amplifier, voltmeter…) has a base class which implements common functionalities. For example, all lasers will have a
off()andon()method. This means you do not have to duplicate your code when you have use a different laser because a coworker stole yours, but you can simply connect to a different one. The disadvantage is that each device has to implemented as a subclass of the base class, which usually means writing boilerplate code for apylablibdevice.
Dummy implementations: Each device class has a “dummy implementation”, which implements all methods but does nothing under the hood.
By connecting just dummy devices, you can test large parts of your software without ever connecting to a device, which enables faster testing and working on the software outside the lab.
Device Discovery#
When implemented, devices can be discovered automatically.
For devices where this is not implemented, you must manually register the device like this devctrl.device.lamp.BenthamPsu610.add_device("name=Halogen-Lamp serial_number=32540/1 default_current=8.5000"),
where the argument of add_device must contain the necessary information such as GPIB name or IP address.