Skip to content

Python Toolkit API LabOne Modules

LabOne modules abstract certain functionalities in the client. They are exposed in the toolkit API the same way devices are and can be instantiated through the Session. For more infos on the usage take a look at the dedicated module section.

Some modules have dedicated classes exposing useful helper functions. But all modules expose the object oriented node tree handling.

Important

Not all modules have dedicated classes. This does not mean that these modules cannot be used with the toolkit API. All modules are supported but not all of them have additional helper functions on top of the their core functionality.

zhinst.toolkit.driver.modules.ModuleType = t.Union[BaseModule, DAQModule, SHFQASweeper, SweeperModule, ScopeModule, ImpedanceModule, DeviceSettingsModule, PIDAdvisorModule, PrecompensationAdvisorModule] module-attribute

zhinst.toolkit.driver.modules.base_module.BaseModule(raw_module, session)

Bases: Node

Generic toolkit driver for a LabOne Modules.

All module specific class are derived from this class. It exposes the nodetree and also implements common functions valid for all modules. It also can be used directly, e.g. for modules that have no special class in toolkit.

Parameters:

Name Type Description Default
raw_module ZIModule

zhinst.core module.

required
session Session

Session to the Data Server.

required

raw_module: ZIModule property

Underlying core module.

execute()

Start the module execution.

Subscription or unsubscription is not possible until the execution is finished.

progress()

Progress of the execution.

Returns:

Type Description
float

Progress of the execution with a number between 0 and 1

read()

Read scope data.

If the recording is still ongoing only a subset of data is returned.

Returns:

Type Description
NodeDict

Scope data.

subscribe(signal)

Subscribe to a node.

The node can either be a node of this module or of a connected device.

Parameters:

Name Type Description Default
signal Union[Node, str]

Node that should be subscribed to.

required

unsubscribe(signal)

Unsubscribe from a node.

The node can either be a node of this module or of a connected device.

Parameters:

Name Type Description Default
signal Union[Node, str]

Node that should be unsubscribed from.

required

wait_done(*, timeout=20.0, sleep_time=0.5)

Waits until the module is finished.

Warning: Only usable for modules that make use of the /finished node.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the measurement (default: 20).

20.0
sleep_time int

Time in seconds to wait between requesting sweeper state. (default: 0.5)

0.5

Raises:

Type Description
TimeoutError

The measurement is not completed before timeout.

zhinst.toolkit.driver.modules.base_module.ZIModule = t.TypeVar('ZIModule', bound=ModuleBase) module-attribute