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
- 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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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_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_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.
- 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_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 isNone
, set to the maximal range.
- 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.
- 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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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, settinginclude=-10
queries all available variables, which is equivalent toinclude="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)