pylablib.devices.NKT package
Submodules
pylablib.devices.NKT.interbus module
- exception pylablib.devices.NKT.interbus.InterbusError[source]
Bases:
DeviceError
Generic Interbus 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.NKT.interbus.InterbusBackendError(exc)[source]
Bases:
InterbusError
,DeviceBackendError
Generic Interbus 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.NKT.interbus.TInterbusTelegram(dest, src, typ, payload)
Bases:
tuple
- dest
- payload
- src
- typ
- class pylablib.devices.NKT.interbus.GenericInterbusDevice(conn)[source]
Bases:
ICommBackendWrapper
Generic Interbus-connected device.
- Parameters:
conn – serial connection parameters (usually port, a tuple containing port and baudrate, or a tuple with full specification such as
("COM1", 9600, 8, 'N', 1)
)
- Error
alias of
InterbusError
- ib_using_address(dest)[source]
Context manager for temporary using a different default destination address
- ib_get_reg(dest, address, dtype='raw', array='auto')[source]
Get register value at the given destination device and register address.
dtype is the register type, which can be
"raw"
(raw bytes),"str"
(string),"u8"
,"u16"
,"u32"
,"i8"
,"i16"
,"i32"
(different integer values).
- ib_set_reg(dest, address, value, dtype='raw', array='auto', echo=True)[source]
Set register value at the given destination device and register address.
dtype is the register type, which can be
"raw"
(raw bytes),"str"
(string),"u8"
,"u16"
,"u32"
,"i8"
,"i16"
,"i32"
(different integer values).If
echo==True
, return the subsequent value of the register.
- ib_scan_devices(dests='all', timeout=0.05)[source]
Scan for devices on the bus and return their addresses and types.
dests is a list of addresses to check (
"all"
means all addresses from 1 to 48 inclusive) timeout is the timeout to wait for each device reply. func and payload specify the message to send (by default, ‘read coil’ command with no arguments, which should always return and error) Since the addresses are polled consecutively, this function can take a long time (~25s for the default settings).
- 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.NKT.interbus.IInterbusModule(ib_device, dest)[source]
Bases:
IDevice
Specific Interbus module.
Deals with specific registers available for this module.
- Parameters:
ib_device – instance of the generic Interbus controller used to access the module.
dest – module address on the bus.
- 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 connection
- 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
- open()
Open the connection
- set_device_variable(key, value)
Set the value of a settings parameter
- class pylablib.devices.NKT.interbus.GenericInterbusModule(ib_device, dest)[source]
Bases:
IInterbusModule
- 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 connection
- get_all_registers()
Get values of all defined registers
- 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_register(name)
Get value of the given register based on its name
- 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"
.
- get_status()
Get device status as a set of set bits
- is_opened()
Check if the device is connected
- open()
Open the connection
- set_device_variable(key, value)
Set the value of a settings parameter
- set_register(name, value)
Set value of the given register based on its name
- class pylablib.devices.NKT.interbus.SuperKExtremeInterbusModule(ib_device, dest)[source]
Bases:
IInterbusModule
- 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 connection
- get_all_registers()
Get values of all defined registers
- 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_register(name)
Get value of the given register based on its name
- 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"
.
- get_status()
Get device status as a set of set bits
- is_opened()
Check if the device is connected
- open()
Open the connection
- set_device_variable(key, value)
Set the value of a settings parameter
- set_register(name, value)
Set value of the given register based on its name
- class pylablib.devices.NKT.interbus.SuperKFrontPanelInterbusModule(ib_device, dest)[source]
Bases:
IInterbusModule
- 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 connection
- get_all_registers()
Get values of all defined registers
- 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_register(name)
Get value of the given register based on its name
- 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"
.
- get_status()
Get device status as a set of set bits
- is_opened()
Check if the device is connected
- open()
Open the connection
- set_device_variable(key, value)
Set the value of a settings parameter
- set_register(name, value)
Set value of the given register based on its name
- class pylablib.devices.NKT.interbus.SuperKSelectDriverInterbusModule(ib_device, dest)[source]
Bases:
IInterbusModule
- 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 connection
- get_all_registers()
Get values of all defined registers
- 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_register(name)
Get value of the given register based on its name
- 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"
.
- get_status()
Get device status as a set of set bits
- i = 7
- is_opened()
Check if the device is connected
- open()
Open the connection
- set_device_variable(key, value)
Set the value of a settings parameter
- set_register(name, value)
Set value of the given register based on its name
- class pylablib.devices.NKT.interbus.SuperKSelectInterbusModule(ib_device, dest)[source]
Bases:
IInterbusModule
- 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 connection
- get_all_registers()
Get values of all defined registers
- 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_register(name)
Get value of the given register based on its name
- 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"
.
- get_status()
Get device status as a set of set bits
- is_opened()
Check if the device is connected
- open()
Open the connection
- set_device_variable(key, value)
Set the value of a settings parameter
- set_register(name, value)
Set value of the given register based on its name
- class pylablib.devices.NKT.interbus.InterbusSystem(conn, modules='auto')[source]
Bases:
GenericInterbusDevice
A collection of NKT modules connected to the same Interbus.
- Parameters:
conn – serial connection parameters (usually port, a tuple containing port and baudrate, or a tuple with full specification such as
("COM1", 9600, 8, 'N', 1)
)modules – Interbus modules identifiers; can be
"auto"
(detect all connected modules), a list of module addresses, or a dictionary{addr: name}
of the aliases for the modules (e.g.,{'laser':15, 'varia':18}
)
- m
dictionary of modules, defined either by their address or by their name (if provided upon creation)
- Error
alias of
InterbusError
- 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"
.
- ib_get_default_address()
Get destination address used by default in Interbus methods
- ib_get_reg(dest, address, dtype='raw', array='auto')
Get register value at the given destination device and register address.
dtype is the register type, which can be
"raw"
(raw bytes),"str"
(string),"u8"
,"u16"
,"u32"
,"i8"
,"i16"
,"i32"
(different integer values).
- ib_scan_devices(dests='all', timeout=0.05)
Scan for devices on the bus and return their addresses and types.
dests is a list of addresses to check (
"all"
means all addresses from 1 to 48 inclusive) timeout is the timeout to wait for each device reply. func and payload specify the message to send (by default, ‘read coil’ command with no arguments, which should always return and error) Since the addresses are polled consecutively, this function can take a long time (~25s for the default settings).
- ib_set_default_address(dest)
Set destination address used by default in Interbus methods
- ib_set_reg(dest, address, value, dtype='raw', array='auto', echo=True)
Set register value at the given destination device and register address.
dtype is the register type, which can be
"raw"
(raw bytes),"str"
(string),"u8"
,"u16"
,"u32"
,"i8"
,"i16"
,"i32"
(different integer values).If
echo==True
, return the subsequent value of the register.
- ib_using_address(dest)
Context manager for temporary using a different default destination address
- 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)