cohesivm.devices

This Module contains the Device Abstract Base Class and the implemented devices (standalone modules) which follow this ABC. The main responsibilities are to establish the communication with the physical device and to contain the measurement channels (Channel). For simplicity, the source code of the channel implementations may also be put into the modules of the devices.

class Device(channels: List[TChannel])[source]

Bases: ABC

Implements the connection and the channels of a measurement device.

Parameters:

channels – A list of implemented Channel instances.

property name: str

Name of the device which is the name of the class.

property channels: List[TChannel]

A list of implemented Channel instances.

property channels_names: List[str]

A list of class names of the channels.

property channels_settings: List[DatabaseDict]

A list of settings dictionaries of the channels.

abstract _establish_connection() Any[source]

Opens the device connection and returns the resource.

connect() Generator[None, None, None][source]

Establishes the connection to the device and enables its channels. Must be used in form of a resource such that the channels are disabled and the connection is closed safely.

Example

with device.connect():
    device.channel[0].measure()