optimato / lab-control-lib

Laboratory Control Library
1 stars 1 forks source link

LabControl-lib

LabControl lib is a suite of tools initially developed for the Optimal Imaging and Tomography group, University of Trieste/Elettra sincrotone, and based on earlier code developed in the X-ray Nano-Imaging Group, at the University of Southampton. See below for a list of contributors.

This package is a library, in the sense that it provides the tools to for laboratory management, but does not include actual drivers for any lba device. For this, a custom laboratory control package has to be be written. This control package imports the library, defines and registers the various drivers to connect to the hardware piece.

Terminology

General principles

The design of this software is made to address these limitations:

The solution is a distributed device management. Each device is managed by a driver that runs on a unique process, and is wrapped by a proxy server. Control and data access is done through one or more proxy clients to the proxy server. Since all communication is through TCP sockets, drivers can run on different computers, as long as they are on the same network. An "admin" status is conferred only to one client at a time to ensure that no two processes attempt at controlling a device simultaneously (all "read-only" methods are however allowed by non-admin clients).

The key components of this package are the driver base classes, and the proxy server/client architecture.

In practice, each driver can be implemented as if it is meant to be the single instance connected to the device. The base class DriverBase takes care of a few things (logging, configuration, metadata collection, periodic calls), while SocketDriverBase has all what is needed to connect to devices that have socket connections.

The client/server infrastructure is provided through decorators on the driver classes and their exposed methods. These decorators are provided by the module proxydevice. All drivers that can be provided as servers are decorated with @proxydevice, and methods are made remotely accessible with the method decorator @proxycall. See the module doc for more info.

Additional classes

Devices normally fall in two main categories: motion devices, and detectors. There is therefore a high-level class Motor meant to provide access to the underlying device through a common interface (with methods inspired from the spec language). For detectors, the common interface is CameraBase, which is a subclass of DriverBase. The hope is to make instances of Motor and CameraBase subclasses sufficient for everyday use.

An additional driver called Manager is also defined in this library. The manager is a "driver" in the sense that it is part of the classes that are accessed through proxy clients. Manager takes care of metadata collection and scan and file numbering and naming conventions. See manager.py for more info.

Writing a control package

The init() method has to be called early to inform the library of the most important parameters for its functioning, namely

User Interface

The ui subpackage provides some tools for user interface.

TBC