herosdevices.hardware.thorlabs.pm100

Device driver for Thorlabs PM100 series optical power and energy meters.

Module Contents

herosdevices.hardware.thorlabs.pm100.usbtmc_address_to_resource(address: str) → str[source]

Convert a Linux usbtmc device address into a VISA resource string.

If the given device node does not exist, the kernel usbtmc driver is probably not bound to the device anymore: userspace VISA access (pyvisa-py) detaches the kernel driver and it is only re-attached when the device is reconnected. In this case the USB bus is scanned for USBTMC devices instead. If exactly one is found, it is used, otherwise an error is raised.

Parameters:

address – Path of the usbtmc device, e.g. /dev/usbtmc0.

Returns:

The VISA resource string of the device.

class herosdevices.hardware.thorlabs.pm100.PM100(resource: str, keep_alive: bool = True, **kwargs)[source]

Bases: herosdevices.core.templates.VisaDeviceTemplate, herosdevices.interfaces.atomiq.Measurable

Device driver for the Thorlabs PM100A/D optical power and energy meter.

The device is controlled via SCPI commands over a VISA connection (typically USBTMC).

Parameters:
  • resource – Resource of the device. Either a Linux usbtmc device (e.g. /dev/usbtmc0), which is automatically resolved to the corresponding VISA resource string, or a VISA resource string directly (e.g. USB::0x1313::0x8078::P0019289::INSTR).

  • keep_alive – Keep the VISA connection open between operations.

Warning

Note, that if a device file (/dev/usbtmc0) is used, the device can not be restarted and needs to be reconnected to the host due to the PyVISA backend removing the /dev/usbtmc0 link upon access. You need to use a VISA string (printed on startup of the device) to be able to restart it for example via BOSS.

measure_target: str = 'power'

Set what the PM100.measure() method returns. Can be “power”, “voltage” or “frequency”

power: float

Optical power in W (or dBm if power_unit is set to “DBM”).

voltage: float

Voltage in V.

wavelength: float

Operation wavelength for the wavelength correction in nm. Only settable if the sensor supports it.

frequency: float

Pulse repetition rate in Hz.

beam_diameter: float

Beam diameter in mm, used for power/energy density calculations.

attenuation: float

User attenuation (positive) / gain (negative) factor in dB.

averaging_rate: int

Averaging rate, one sample takes approximately 3 ms (3000 averages take approximately 1 s).

power_unit: str

Unit for power readings, either “W” or “DBM”.

power_range: float

Upper limit of the power measurement range in W.

voltage_range: float

Upper limit of the voltage measurement range in V.

power_autorange: int

on).

Type:

Auto-ranging of the power measurement (0

Type:

off, 1

voltage_autorange: int

on).

Type:

Auto-ranging of the voltage measurement (0

Type:

off, 1

sensor_type: int

Type of the connected sensor as reported by the device.

zero_adjust() → None[source]

Run the zero adjustment (dark offset) routine.

Make sure the sensor is blocked from all light of the beam source during this routine, otherwise all subsequent measurements will have an offset.

measure() → float[source]

Perform a measurement depending on the setting of PM100.measure_target.

Returns:

The measured quantity in SI base units (“W”, “V” or “Hz”)

resource
connection