Throlabs module

This module contains drivers for Thorlabs devices. At the moment, this includes the PM100-series power meters.

Examples

Below is a minimum working example showing how to use a PM100D power meter.

import pyvisa
from Devices.Throlabs import PM100

rm = pyvisa.ResourceManager()
# Instantiate the PM100D with a predefined attenuation curve
pm = PM100(rm, 'USB0::0x1313::0x8078::P0017770::INSTR', attName='ppms-tap')

pm.wavelength = 530 # Set wavelength for an accurate reading

# When reading the power, the wavelength-dependent attenuation
# characteristics are automatically taken into account
print(f'Power: {pm.power * 1e3} mW')
class Throlabs.PM100(rm, address, attName=None, attConfig=PosixPath('Config/PM100.json'))[source]

Bases: object

Driver class for ThorLabs PM100x power meter head units.

Manages instrument communication via PyVISA and applies an optional polynomial wavelength-dependent attenuation calibration. Provides explicit getters and property accessors for core SCPI functionality.

Initializes the power meter connection and loads optional calibration data.

Parameters:
  • rm (pyvisa.ResourceManager) – The VISA resource manager instance.

  • address (str) – The VISA resource address for the device.

  • attName (str, optional) – The key inside the JSON configuration file corresponding to the desired attenuation profile. Up to 9th order polynomials are accepted.

  • attConfig (str, default: "Config/PM100_attenuation.json") – Path to the JSON configuration file containing polynomial coefficients for external attenuation/gain adjustments.

property average

Returns the number of samples averaged.

Returns:

count – Number of samples per measurement.

Return type:

int

property energy

Returns measured pulse energy.

Returns:

energy – Measured pulse energy.

Return type:

float

property filterLowpass

Returns the state of the low-pass filter.

Returns:

enabled – True if low-pass filter is enabled.

Return type:

bool

property frequency

Returns measured repetition frequency.

Returns:

frequency – Measured frequency in Hz.

Return type:

float

getAverage()[source]

Returns the number of samples averaged.

Returns:

count – Number of samples per measurement.

Return type:

int

getEnergy()[source]

Returns measured pulse energy.

Returns:

energy – Measured pulse energy.

Return type:

float

getError()[source]

Returns the latest error code and message from the error queue.

Returns:

error – Formatted error message.

Return type:

str

getFilterLowpass()[source]

Returns the state of the low-pass filter.

Returns:

enabled – True if low-pass filter is enabled.

Return type:

bool

getFrequency()[source]

Returns measured repetition frequency.

Returns:

frequency – Measured frequency in Hz.

Return type:

float

getID()[source]

Returns the instrument identification string.

Returns:

idn – Identification string (manufacturer, model, serial, firmware).

Return type:

str

getPower(applyCalibration=True)[source]

Returns measured power.

Parameters:

applyCalibration (bool, default: True) – Whether to apply the loaded polynomial attenuation profile.

Returns:

power – Measured optical power.

Return type:

float

getSensorID()[source]

Returns the connected sensor identification string.

Returns:

info – Sensor identification and configuration information.

Return type:

str

getTemperature()[source]

Returns current sensor temperature.

Returns:

temp – Temperature in Celsius.

Return type:

float

getThermopileAccelerator()[source]

Returns the state of the thermopile accelerator.

Returns:

active – True if thermopile accelerator is active.

Return type:

bool

getWavelength()[source]

Returns current operation wavelength.

Returns:

wavelength – Current wavelength in nm.

Return type:

float

property power

Returns measured power.

Parameters:

applyCalibration (bool, default: True) – Whether to apply the loaded polynomial attenuation profile.

Returns:

power – Measured optical power.

Return type:

float

setAutoRange(state=True, mode='POW')[source]

Enables or disables auto-ranging for a specific mode.

Parameters:
  • state (bool, default: True) – True to enable, False to disable.

  • mode (str, default: "POW") – Measurement mode (e.g., “POW”, “CURR”, “VOLT”).

setAverage(val)[source]

Sets the number of samples to average.

Parameters:

val (int) – Number of samples.

setFilterLowpass(state: bool)[source]

Enables or disables the low-pass filter.

Parameters:

state (bool) – True to enable, False to disable.

setThermopileAccelerator(state: bool)[source]

Enables or disables the thermopile accelerator.

Parameters:

state (bool) – True to enable, False to disable.

setUnits(target)[source]

Sets measurement units.

Parameters:

target (str) – Unit type (‘W’ or ‘DBM’).

setWavelength(val)[source]

Sets operation wavelength.

Parameters:

val (float) – Wavelength in nm.

property temperature

Returns current sensor temperature.

Returns:

temp – Temperature in Celsius.

Return type:

float

property thermopileAccelerator

Returns the state of the thermopile accelerator.

Returns:

active – True if thermopile accelerator is active.

Return type:

bool

property wavelength

Returns current operation wavelength.

Returns:

wavelength – Current wavelength in nm.

Return type:

float

zero()[source]

Initiates zero adjustment (non-blocking).