pylablib.devices.Ophir package

Submodules

pylablib.devices.Ophir.base module

exception pylablib.devices.Ophir.base.OphirError[source]

Bases: DeviceError

Generic Ophir device error

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception pylablib.devices.Ophir.base.OphirBackendError(exc)[source]

Bases: OphirError, DeviceBackendError

Generic Ophir backend communication error

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class pylablib.devices.Ophir.base.OphirDevice(conn)[source]

Bases: ICommBackendWrapper

Generic Ophir device.

Parameters:

conn – serial connection parameters (usually port or a tuple containing port and baudrate)

Error

alias of OphirError

query(comm)[source]

Send a query to the device and parse the reply

apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

close()

Close the backend

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_opened()

Check if the device is connected

lock(timeout=None)

Lock the access to the device from other threads/processes (isn’t necessarily implemented)

locking(timeout=None)

Context manager for lock & unlock

open()

Open the backend

set_device_variable(key, value)

Set the value of a settings parameter

unlock()

Unlock the access to the device from other threads/processes (isn’t necessarily implemented)

class pylablib.devices.Ophir.base.THeadInfo(type, serial, name, capabilities)

Bases: tuple

capabilities
name
serial
type
class pylablib.devices.Ophir.base.TDeviceInfo(id, serial, name, rom_version)

Bases: tuple

id
name
rom_version
serial
class pylablib.devices.Ophir.base.TWavelengthInfo(mode, rng, curr_idx, presets, curr_wavelength)

Bases: tuple

curr_idx
curr_wavelength
mode
presets
rng
class pylablib.devices.Ophir.base.TRangeInfo(curr_idx, ranges, curr_range)

Bases: tuple

curr_idx
curr_range
ranges
class pylablib.devices.Ophir.base.VegaPowerMeter(conn)[source]

Bases: OphirDevice

Ophir Vega power meter.

Parameters:

conn – serial connection parameters (usually port or a tuple containing port and baudrate)

get_head_info()[source]

Get head information.

Return tuple (type, serial, name, capabilities).

get_device_info()[source]

Get device information.

Return tuple (id, serial, name, rom_version).

reset()[source]

Reset the device

get_power()[source]

Get the current power readings.

Return either measured power, or "over", if the power is overrange.

get_energy()[source]

Get the current energy readings.

Return either measured energy, or "over", if the energy is overrange.

get_frequency()[source]

Get the current frequency readings.

Return either measured frequency, or "over", if the power is overrange.

get_units()[source]

Get device reading units

get_wavelength_info()[source]

Get wavelength setting info.

Return tuple (mode, rng, curr_idx, presets, curr_wavelength), where mode is the measurement mode ("continuous" or "discrete"), rng is a 2-tuple with the full wavelength range (in m) for continuous mode or a set of all wavelengths for discrete mode, curr_idx is the current wavelength preset index, presets is the list of all preset wavelengths (in m) for continuous mode or a set of all wavelengths for discrete mode, and curr_wavelength is the current measurement wavelength (in m) for continuous mode or the current wavelength name for discrete mode.

get_wavelength()[source]

Get current wavelength (in nm)

set_wavelength(wavelength)[source]

Set current wavelength (in nm).

wavelength is either a wavelength (in m) for the continuous mode, or a wavelength preset (as a string) for a discrete mode.

get_range_info()[source]

Get power range info.

Return tuple (curr_idx, ranges, curr_range), where curr_idx is the current power range index, ranges is the list of ranges (in W) for all indices and curr_range is the current range (in W).

get_range()[source]

Get current power range (maximal power in W)

get_range_idx()[source]

Get current power range index

Index goes from 0 (highest) to maximal (lowest); auto-ranging is -1.

set_range_idx(rng_idx)[source]

Set current range index.

rng_idx is the range index from 0 (highest) to maximal (lowest); auto-ranging is -1. The corresponding ranges are given by get_range_info().

set_range(rng)[source]

Set current power range.

Select the smallest available range which is larger than rng (or maximal range, if the requested range is too large) If rng is "auto", enable autorange; if rng is None, set to the maximal range.

get_battery_condition()[source]

Check if the batter is OK

get_baudrate()[source]

Get current baud rate

get_supported_baudrates()[source]

Get a list of all supported baud rates

set_baudrate(baudrate)[source]

Set current baud rate.

If the baudrate is different from the current one, close the device connection. The device object will need to be re-created with the newly specified baud rate.

is_filter_in()[source]

Check if the filter is set to be on at the power meter

set_filter(filter_in=True)[source]

Change the filter setting at the power meter (on or off)

is_diffuser_in()[source]

Check if the diffuser is set to be on at the power meter

set_diffuser(diffuser_in=True)[source]

Change the diffuser setting at the power meter (on or off)

Error

alias of OphirError

apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

close()

Close the backend

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_opened()

Check if the device is connected

lock(timeout=None)

Lock the access to the device from other threads/processes (isn’t necessarily implemented)

locking(timeout=None)

Context manager for lock & unlock

open()

Open the backend

query(comm)

Send a query to the device and parse the reply

set_device_variable(key, value)

Set the value of a settings parameter

unlock()

Unlock the access to the device from other threads/processes (isn’t necessarily implemented)

Module contents