Thorlabs Optical Power Meter

v0.1.2
io.github.K-Dense-AI/labmcp-thorlabs-pm Checked 1 day ago Published 2 months ago

MCP server for Thorlabs optical power meters (PM100 family, PM400, PM101, PM5020) over SCPI.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_connection_info Get Connection Info

Report which instrument is connected (identity, address, simulated or real), whether the server is read-only, and the active safety limits. Call this first.

get_command_log Get Command Log

Return the most recent raw commands sent to / replies received from the instrument (newest last). Useful for debugging and for recording what was done.

ParameterTypeDescription
limitinteger

reconnect Reconnect

Close and re-open the connection to the instrument (e.g. after it was power cycled or a cable was re-plugged).

get_device_info Get Device Info

Identify the meter console and the attached sensor head (model, serial, type, wavelength range, power ranges), and report the present wavelength, averaging, range and zero value.

read_power Read Power

Read the optical power once (in W, plus dBm and a formatted string). The reading uses the configured correction wavelength and averaging; set the wavelength first.

log_power_series Log Power Series

Log a series of power readings to characterise laser stability, warm-up or drift. Returns mean, stdev, min/max, RMS and peak-to-peak stability (%) and drift (%/min), plus the readings (downsampled to `max_points`; use `save_path`, a new .csv file, to keep all of them).

ParameterTypeDescription
countintegerNumber of readings
interval_snumberSeconds between readings (0 = as fast as the meter allows)
max_pointsintegerMaximum readings returned in the reply
save_pathOptional CSV path for every reading

set_wavelength Set Wavelength

Set the correction wavelength (nm) the meter uses to convert sensor signal to power. Must be within the sensor's calibrated range (see `get_device_info`); sent as a whole number of nm.

ParameterTypeDescription
wavelength_nm *numberSource wavelength in nm

set_averaging Set Averaging

Set how many samples the meter averages for each reading. More averaging lowers noise but slows each reading (PM100 series: ~3 ms per sample; PM400/PM101/PM5020: 1 ms).

ParameterTypeDescription
count *integerSamples averaged per reading (PM100: ~3 ms per sample)

set_range Set Range

Select auto-ranging, or a fixed power range that fits `range_w` (the meter picks the most sensitive range that can hold that power). A fixed range reports over-range if exceeded.

ParameterTypeDescription
modestringauto-ranging or a fixed range
range_wFor manual mode: the highest power you expect, in W

zero_sensor Zero Sensor

Dark-zero the sensor (removes dark current / thermal offset). BEFORE calling, ask the user to block the beam and cover the sensor aperture completely, and wait for them to confirm: zeroing with light on the sensor corrupts all later readings. Takes a few seconds.

read_sensor_temperature Read Sensor Temperature

Read the sensor head temperature in °C (thermal sensors and other heads with a built-in temperature sensor only).