hvl_ccb package

Submodules

hvl_ccb.configuration module

Facilities providing classes for handling configuration for communication protocols and devices.

class hvl_ccb.configuration.ConfigurationMixin(configuration)[source]

Bases: abc.ABC

Mixin providing configuration to a class.

config

ConfigDataclass property.

Returns:the configuration
static config_cls()[source]

Return the default configdataclass class.

Returns:a reference to the default configdataclass class
configuration_save_json(path: str) → None[source]

Save current configuration as JSON file.

Parameters:path – path to the JSON file.
classmethod from_json(filename: str)[source]

Instantiate communication protocol using configuration from a JSON file.

Parameters:filename – Path and filename to the JSON configuration
hvl_ccb.configuration.configdataclass(direct_decoration=None, frozen=True)[source]

Decorator to make a class a configdataclass. Types in these dataclasses are enforced. Implement a function clean_values(self) to do additional checking on value ranges etc.

It is possible to inherit from a configdataclass and re-decorate it with @configdataclass. In a subclass, default values can be added to existing fields. Note: adding additional non-default fields is prone to errors, since the order has to be respected through the whole chain (first non-default fields, only then default-fields).

Parameters:frozen – defaults to True. False allows to later change configuration values. Attention: if configdataclass is not frozen and a value is changed, typing is not enforced anymore!

hvl_ccb.experiment_manager module

Main module containing the top level ExperimentManager class. Inherit from this class to implement your own experiment functionality in another project and it will help you start, stop and manage your devices.

exception hvl_ccb.experiment_manager.ExperimentError[source]

Bases: Exception

Exception to indicate that the current status of the experiment manager is on ERROR and thus no operations can be made until reset.

class hvl_ccb.experiment_manager.ExperimentManager(devices: Dict[str, hvl_ccb.dev.base.Device])[source]

Bases: hvl_ccb.dev.base.DeviceSequenceMixin

Experiment Manager can start and stop communication protocols and devices. It provides methods to queue commands to devices and collect results.

add_device(name: str, device: hvl_ccb.dev.base.Device) → None[source]

Add a new device to the manager. If the experiment is running, automatically start the device. If a device with this name already exists, raise an exception.

Parameters:
  • name – is the name of the device.
  • device – is the instantiated Device object.
Raises:

DeviceExistingException

finish() → None[source]

Stop experimental setup, stop all devices.

is_error() → bool[source]

Returns true, if the status of the experiment manager is error.

Returns:True if on error, false otherwise
is_finished() → bool[source]

Returns true, if the status of the experiment manager is finished.

Returns:True if finished, false otherwise
is_running() → bool[source]

Returns true, if the status of the experiment manager is running.

Returns:True if running, false otherwise
run() → None[source]

Start experimental setup, start all devices.

start() → None[source]

Alias for ExperimentManager.run()

status

Get experiment status.

Returns:experiment status enum code.
stop() → None[source]

Alias for ExperimentManager.finish()

class hvl_ccb.experiment_manager.ExperimentStatus[source]

Bases: enum.Enum

Enumeration for the experiment status

ERROR = 5
FINISHED = 4
FINISHING = 3
INITIALIZED = 0
RUNNING = 2
STARTING = 1

Module contents

Top-level package for HVL Common Code Base.