datalogd.plugins.thorlabspm100_datasource module

class datalogd.plugins.thorlabspm100_datasource.ThorlabsPM100DataSource(sinks=[], serialnumber=None, usb_vid='0x1313', usb_pid='0x8078', interval=1.0)[source]

Bases: datalogd.DataSource

Provide data from a Thorlabs PM100 laser power meter.

This uses the VISA protocol over USB. On Linux, read/write permissions to the power meter device must be granted. This can be done with a udev rule such as:

/etc/udev/rules.d/52-thorlabspm100.rules
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1313", ATTRS{idProduct}=="8078", OWNER="root", GROUP="usbusers", MODE="0666"

where the idVendor and idProduct fields should match that listed from running lsusb. The usbusers group must be created and the user added to it:

groupadd usbusers
usermod -aG usbusers yourusername

A reboot will then ensure permissions are set and the user is a part of the group.

Parameters:
  • serialnumber – Serial number of power meter to use. If None, will use the first device found.
  • interval – How often to poll the sensors, in seconds.
close()[source]

Close the connection to the power meter.

read_power()[source]

Read power and send data to any connected sinks.