pylablib.devices.Conrad package¶
Submodules¶
pylablib.devices.Conrad.base module¶
-
exception
pylablib.devices.Conrad.base.
ConradError
[source]¶ Bases:
pylablib.core.devio.base.DeviceError
Generic Conrad devices error
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
pylablib.devices.Conrad.base.
ConradBackendError
(exc)[source]¶ Bases:
pylablib.devices.Conrad.base.ConradError
,pylablib.core.devio.comm_backend.DeviceBackendError
Generic Conrad backend communication error
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
pylablib.devices.Conrad.base.
RelayBoard
(conn, start_addr=1)[source]¶ Bases:
pylablib.core.devio.comm_backend.ICommBackendWrapper
Conrad relay board controller
Parameters: - conn – serial connection parameters (usually port or a tuple containing port and baudrate)
- start_addr – address which is assigned to the first board in the chain upon initialization; all following boards increase the address by 1
-
Error
¶ alias of
ConradError
-
class
TMessage
(comm, addr, data)¶ Bases:
tuple
-
addr
¶
-
comm
¶
-
count
()¶ Return number of occurrences of value.
-
data
¶
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
-
query
(comm, addr=1, data=0, multi_result=False)[source]¶ Send a query with the given command, address and data.
If
multi_result==False
, read a single reply frame; otherwise, keep reading until reply with the same command as sent is received (used in initialization and broadcast queries).
-
get_all_relays
(addr=1)[source]¶ Get all relay states.
If addr is not 0, return dictionary
{relay:value}
, whererelay
is the relay index on the board (between 1 and 8 inclusive). Ifaddr==0
(broadcast), return dictionary{addr:board_state}
, whereboard_state
is in turn a state dictionary is described above.
-
set_all_relays
(values, addr=1)[source]¶ Set all relay states.
values can be a list (listing relay states from lowest to highest), or a dictionary
{relay:value}
, where relays are numbered from 1 to 8. Relays without values are kept unchanged. Ifaddr==0
, broadcast to all boards
-
set_relay
(relay, enable=True, addr=1)[source]¶ Get the state at a given relay (indexed from 1 to 8 inclusive)
-
class
NoParameterCaller
(device, kind)¶ Bases:
object
Class to simplify calling functions without a parameter
-
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
-
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)