datalogd.plugins.thorlabspm100_datasource module¶
-
class
datalogd.plugins.thorlabspm100_datasource.
ThorlabsPM100DataSource
(sinks=[], serial_number=None, interval=1.0)[source]¶ Bases:
datalogd.plugins.thorlabspm100_datasource.ThorlabsPMDataSource
Provide data from a Thorlabs PM100 laser power meter.
This is a wrapper around
ThorlabsPMDataSource
with the appropriate USB PID used as default. See its documentation regarding configuring permissions for accessing the USB device.Parameters: - serial_number – Serial number of power meter to use. If
None
, will use the first device found. - interval – How often to poll the sensors, in seconds.
- serial_number – Serial number of power meter to use. If
-
class
datalogd.plugins.thorlabspm100_datasource.
ThorlabsPM16DataSource
(sinks=[], serial_number=None, interval=1.0)[source]¶ Bases:
datalogd.plugins.thorlabspm100_datasource.ThorlabsPMDataSource
Provide data from a Thorlabs PM16 laser power meter.
This is a wrapper around
ThorlabsPMDataSource
with the appropriate USB PID (0x807c) used as default. See its documentation regarding configuring permissions for accessing the USB device.Parameters: - serial_number – Serial number of power meter to use. If
None
, will use the first device found. - interval – How often to poll the sensors, in seconds.
- serial_number – Serial number of power meter to use. If
-
class
datalogd.plugins.thorlabspm100_datasource.
ThorlabsPM400DataSource
(sinks=[], serial_number=None, interval=1.0)[source]¶ Bases:
datalogd.plugins.thorlabspm100_datasource.ThorlabsPMDataSource
Provide data from a Thorlabs PM400 laser power meter.
This is a wrapper around
ThorlabsPMDataSource
with the appropriate USB PID used as default. See its documentation regarding configuring permissions for accessing the USB device.Parameters: - serial_number – Serial number of power meter to use. If
None
, will use the first device found. - interval – How often to poll the sensors, in seconds.
- serial_number – Serial number of power meter to use. If
-
class
datalogd.plugins.thorlabspm100_datasource.
ThorlabsPMDataSource
(sinks=[], serial_number=None, usb_vid='0x1313', usb_pid='0x8078', interval=1.0)[source]¶ Bases:
datalogd.DataSource
Provide data from a Thorlabs 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:
# Thorlabs PM100D SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1313", ATTRS{idProduct}=="8078", OWNER="root", GROUP="plugdev", MODE="0664" # Thorlabs PM400 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1313", ATTRS{idProduct}=="8075", OWNER="root", GROUP="plugdev", MODE="0664" # Thorlabs PM16 Series SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1313", ATTRS{idProduct}=="807c", OWNER="root", GROUP="plugdev", MODE="0664"
where the
idVendor
andidProduct
fields should match that listed from runninglsusb
. Theplugdev
group must be created and the user added to it:groupadd plugdev usermod -aG plugdev yourusername
A reboot will then ensure permissions are set and the user is a part of the group (or use
udevadm control --reload
and re-login). To check the permissions have been set correctly, get the USB bus and device numbers from the output oflsusb
. For exampleBus 001 Device 010: ID 1313:8075 ThorLabs PM400 Handheld Optical Power/Energy Meter
the bus ID is 001 and device ID is 010. Then list the device using
ls -l /dev/bus/usb/[bus ID]/[device ID]
crw-rw-r-- 1 root plugdev 189, 9 Mar 29 13:19 /dev/bus/usb/001/010
The middle “rw” and the “plugdev” indicates read-write permissions enabled to any user in the plugdev group. You can check which groups your current user is in using the
groups
command.Note that you may also allow read-write access to any user (without having to use/create a plugdev group) by changing the lines in the udev rule to
MODE="0666"
and removing theGROUP="plugdev"
part.Parameters: - serial_number – Serial number of power meter to use. If
None
, will use the first device found. - usb_vid – USB vendor ID (0x1313 or 4883 for Thorlabs).
- usb_pid – USB product ID (0x8078 for PM100D, 0x8075 for PM400).
- interval – How often to poll the sensors, in seconds.
- serial_number – Serial number of power meter to use. If