PM100D module

Created on Thu Dec 2 08:27:01 2021

@author: MartinMihaylov

class Instruments_Libraries.PM100D.PM100D(resource_str, visa_library='@py', **kwargs)[source]

Bases: BaseInstrument

Thorlabs PM100-series power meter wrapper using PyVISA.

You can construct either with:
  • resource_str=”P00XXXXX” # serial only (legacy behavior)

  • resource_str=”USB0::…::INSTR” # full VISA resource (also works)

Parameters:
  • resource_str (str | None) – Either the device serial (e.g., ‘P00XXXXX’) or a full VISA string. Kept for backward compatibility.

  • visa_library (str) – Optional PyVISA backend string, e.g., @py’ for pyvisa-py.

abort()[source]

Abort measurement.

Return type:

None

adjust_current_range()[source]

Legacy function. Do not use. Adjust the Current Measurement interactively.

adjust_energy_meas()[source]

Legacy function. Do not use. Adjust the Energy Measurement interactively.

adjust_power_meas()[source]

Legacy function. Do not use. Adjust the power measurement interactively.

Return type:

None

adjust_voltage_range()[source]

Legacy function. Do not use. Adjust the Voltage Measurement interactively.

config_current()[source]

Configure for current measurement.

Return type:

None

config_energy()[source]

Configure for energy measurement.

Return type:

None

config_energy_density()[source]

Configure for energy density measurement.

Return type:

None

config_freq()[source]

Configure for frequency measurement.

Return type:

None

config_power()[source]

Configure for power measurement.

Return type:

None

config_power_density()[source]

Configure for power density measurement.

Return type:

None

config_resistance()[source]

Configure for sensor presence resistance measurement.

Return type:

None

config_temp()[source]

Configure for sensor temperature measurement.

Return type:

None

config_voltage()[source]

Configure for voltage measurement.

Return type:

None

default_power_meas(wavelength)[source]

Legacy function. Do not use! Use get_Power instead. Performs a power measurement with hard coded parameters! PowerRange is set to auto.

Parameters:

wavelength (float) – Wavelength in nm.

Returns:

Power in dBm.

Return type:

float

default_power_meas_w(wavelength)[source]

Legacy function. Do not use! Use get_Power instead. Performs a power measurement with hard coded parameters! PowerRange is set to auto.

Parameters:
  • WaveLength (float) – Wavelength in nm.

  • wavelength (float | int)

Returns:

Power in W.

Return type:

float

display_param(type)[source]

Legacy function. Do not use. This function will print all the adjusted parameters.

Parameters:
  • Type (str) – Can be set to Type = [‘Power’,’Energy’,’Current’,’Voltage’]

  • type (str)

Return type:

None

display_param_dict(type)[source]

This function will print all the adjusted parameters.

Parameters:

type (str) – Can be set to Type = [‘Power’,’Energy’,’Current’,’Voltage’]

Returns:

  • Headers (str) – String with [‘Power’,’Energy’,’Current’,’Voltage’]

  • Data (list) – Data from the instrument.

  • Params (list) – List with str for different data that are extracted from the instrument.

Return type:

tuple[list, list, list]

fetch_data(allow_NaN=False, delay=None)[source]

Reads last measurement data. WILL NOT START THE MEASUREMENT! Use readData() instead. Returns ‘nan’ if no data is available.

Parameters:
  • allow_NaN (bool)

  • delay (float | None)

Return type:

float

get_adapter_type()[source]

Queries default sensor adapter type.

Return type:

str

get_auto_current_range()[source]

Queries the auto-ranging function state.

Return type:

str

get_auto_power_range()[source]

Queries the auto-ranging function state.

Return type:

str

get_auto_voltage_range()[source]

Queries the auto-ranging function state.

get_average()[source]

Queries the averaging rate.

get_beam_diameter()[source]

Queries the beam diameter.

get_beeper()[source]

Return the state of the beeper.

Return type:

int

get_calibration()[source]

Returns a human readable calibration string.

Return type:

str

get_current_range()[source]

Queries the actual current range.

Return type:

str

get_energy_range()[source]

Queries the energy range.

Return type:

str

get_freq_range(state)[source]

Queries the frequency range.

Parameters:

state (str) – Can be [‘MAX’,’MIN’]

Return type:

str | None

get_pd_power()[source]

Queries the photodiode response value.

Return type:

str

get_power(unit=None, wavelength=None, *, allow_NaN=False, delay=None)[source]

Performs a Power measurement.

Parameters:
  • unit (str, optional) – Power unit [‘W’,’dBm’]. The default is (keep unchanged).

  • waveLength (float, optional) – Wavelength in nm. The default is (keep unchanged).

  • allow_NaN (bool, optional) – If True, returns ‘nan’ if no data is available. The default is False.

  • delay (float, optional) – Delay in seconds between query and read. The default is (standard delay).

  • wavelength (float | None)

Returns:

Power in dBm or W.

Return type:

float

get_power_range()[source]

Queries the power range.

get_power_units()[source]

Queries the power unit.

Return type:

str

get_pyro()[source]

Queries the pyro-detectr response value.

Return type:

str

get_thermopile()[source]

Queries the thermopile response value.

Return type:

str

get_volt_range()[source]

Queries the current voltage range.

get_wavelength()[source]

Queries the operation wavelength.

init()[source]

Start measurement.

Return type:

None

meas_current()[source]

Performs a current measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_energy()[source]

Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_energy_density()[source]

Performs an energy density measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_freq()[source]

Performs a frequency measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_power()[source]

Performs a Power measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_power_density()[source]

Performs a power density measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_resistance()[source]

Performs a sensor presence resistance measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_temp()[source]

Performs a sensor temperature measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

meas_voltage()[source]

Performs a voltage measurement. Maxim: Does nothing? Measure with Init() or readData() instead!

Return type:

None

power_meas()[source]

Legacy function. Do not use! Use get_Power instead. Performs a power measurement interactively, returning data from the measurement.

Return type:

float

power_specifications()[source]

Legacy function. Do not use. This function will print all the adjusted parameters for the power measurement.

Return type:

None

read_config()[source]

Query the current measurement configuration.

Return type:

str

read_data(allow_NaN=False, delay=1)[source]

Starts a measurement and reads last measurement data. Returns last measurement data or ‘nan’ if no data is available.

Parameters:
  • allow_NaN (bool)

  • delay (float | None)

Return type:

float

self_test()[source]

Use this query command to perform the instrument self-test routine. The command places the coded result in the Output Queue. A returned value of zero (0) indicates that the test passed, other values indicate that the test failed.

set_adapter_type(state)[source]
Parameters:

state (str) –

Sets default sensor adapter type:

Allow senor types are: [‘PHOTodiode’,’THERmal’,’PYRo’]

Return type:

None

set_auto_current_range(state)[source]

Switches the auto-ranging function on and off.

Parameters:

state (str/int) – Can be set to [‘ON’,’OFF’,1,0].

Return type:

None

set_auto_power_range(state)[source]

Switches the auto-ranging function on and off.

Parameters:

state (str/int) – Can be set to [‘ON’,’OFF’,1,0].

Return type:

None

set_auto_voltage_range(state)[source]

Switches the auto-ranging function on and off.

Parameters:

state (str/int) – Can be [‘ON’,’OFF’,1,0]

Return type:

None

set_average(value)[source]
Parameters:

value (float/int) – Sets the averaging rate (1 sample takes approx. 3ms)

Return type:

None

set_current_range(value)[source]
Parameters:

value (float/int) – Sets the current range in A.

Return type:

None

set_energy_range(value)[source]
Parameters:

value (float) – Sets the energy range in J

Return type:

None

set_parameters(type)[source]

Legacy function. Do not use. This function will set the measurement parameters interactively.

Parameters:

type (str) – Can be set to Type = [‘Power’,’Energy’,’Current’,’Voltage’]

Return type:

None

set_pd(state)[source]
Parameters:

state (str/int) –

Sets the bandwidth of the photodiode input stage.

Can be [‘ON’,’OFF’,1,0]

Return type:

None

set_power_range(value)[source]
Parameters:

value (float/int) – Sets the current range in W

Return type:

None

set_power_units(state)[source]
Parameters:

state (str) – Sets the power unit W or dBm. Can be [‘W’,’dBm’].

Return type:

None

set_voltage_range(value)[source]
Parameters:

value (float) – Sets the voltage range in V

Return type:

None

set_wavelength(value)[source]
Parameters:

value (float/int) – Sets the operation wavelength in nm.

Return type:

None