Miscellaneous

This is a collection of modules and members with a general scope.

cohesivm.config

This module loads the config.ini file by recursively searching for it in the root of the project folder. It provides two methods for retrieving the data.

get_section(section: str) Dict[str, Any][source]

Retrieves the entire section from the configuration file.

Parameters:

section – The section name in the configuration file.

Returns:

A dictionary containing key-value pairs of the section.

Raises:

KeyError – If the section is not found in the configuration file.

get_option(section: str, option: str) Any[source]

Retrieves the value for a specific option within a given section from the configuration file.

Parameters:
  • section – The section name in the configuration file.

  • option – The option name within the section.

Returns:

The value corresponding to the specified section and option.

Raises:
  • NoSectionError – If the section is not found in the configuration file.

  • NoOptionError – If the option is not found within the section in the configuration file.

cohesivm.serial_communication

This module implements a class for serial communication with a physical device.

class SerialCommunication(com_port: str, baudrate: int = 9600, timeout: int = 1)[source]

Bases: object

A class for establishing and managing serial communication with a physical device.

Parameters:
  • com_port – The COM port of the device.

  • baudrate – The baudrate for serial communication. Default is 9600.

  • timeout – The timeout value for serial communication. Default is 1.

send_data(data: str) None[source]

Send data to the connected device over the serial interface.

Parameters:

data – The data to be sent.

receive_data() str[source]

Receive a signal or response from the connected device over the serial interface.

Returns:

The received response.

send_and_receive_data(data: str, delay: float = 0.5) str[source]

Send data to the connected device over the serial interface and receive its response after a specified delay.

Parameters:
  • data – The data to be sent.

  • delay – The waiting time in s before receiving the response.

Returns:

The received response.

Exceptions

exception CompatibilityError[source]

Raised if the components/parameters of a composite class are not compatible with each other.

exception StateError[source]

Raised by an Experiment if a method is not valid in the current ExperimentState.

Type Aliases

class DatabaseValue
cohesivm.database.DatabaseValue: Tuple[int | float | bool] | int | float | bool | str

A value with the appropriate type to be stored in the database.

class DatabaseDict
cohesivm.database.DatabaseDict: Dict[str, DatabaseValue]

A dictionary mapping strings to values which can be stored in the database.

class Dataset
cohesivm.database.Dataset: Tuple[Dict[str, numpy.ndarray], Metadata]

A tuple of (i) data arrays which are mapped to contact IDs and (ii) the corresponding metadata of the dataset.

Generics

class TChannel
cohesivm.channels.TChannel

A generic type which is bound to cohesivm.channels.Channel.

class TChannel
cohesivm.devices.ossila.OssilaX200.TChannel

A generic type which is bound to cohesivm.devices.ossila..OssilaX200.OssilaX200Channel.

class TChannel
cohesivm.devices.agilent.Agilent4156C.TChannel

A generic type which is bound to cohesivm.devices.agilent.Agilent4156C.Agilent4156CChannel.