Property tree

Distributed hierarchical property tree: the local copy is synchronized bidirectionally through the Property Hub and Propertylogger.

Overview

quatm/servers/properties.py provides the property tree (Properties): it manages the configuration and properties of the control centre and maintains a synchronized copy of the property dictionary. A local set / get publishes to the Property Hub, and central changes are pushed back to the local copy. Properties are addressed like a file system (for example Drivers/xxx, or an absolute path starting with /).

Key methods

MethodDescription
set(key, value)Set a property and publish the change to the Property Hub
get(key, default=...)Read a value (always returns a deep copy; creates the default if missing)
delete(key)Delete an entry (including all its children) and broadcast the change
changes()Return the keys changed since the previous call
close / close_allClose sockets and background threads

PropertyAttribute exposes a single property of the property tree as an ordinary Python attribute (the host must have _props).

Usage

from quatm.servers.properties import Properties

props = Properties()
props.set("laser/power", 50e-3)
power = props.get("laser/power")