Skip to content

Python Toolkit API Device Settings Module

zhinst.toolkit.driver.modules.device_settings_module.DeviceSettingsModule(device_settings_module, session)

Bases: BaseModule

Implements the device settings module for storing and loading settings.

The Device Settings Module provides functionality for saving and loading device settings to and from file. The file is saved in XML format.

For simple save and load two helper functions exist save_to_file and load_from_file.

Note

It is not recommend to use this function to read the device settings. Instead one can use the zhinst-toolkit functionality to read all settings from a device/subtree from the device directly by calling it.

For a complete documentation see the LabOne user manual

Parameters:

Name Type Description Default
device_settings_module DeviceSettingsModule

Instance of the core Impedance Module.

required
session Session

Session to the Data Server.

required

load_from_file(filename, device, timeout=30)

Load a LabOne settings file to a device.

This function creates an new module instance to avoid misconfiguration. It is also synchronous, meaning it will block until loading the settings has finished.

Parameters:

Name Type Description Default
filename Union[str, Path]

The path to the settings file.

required
device Union[DeviceType, str]

The device to load the settings to.

required
timeout float

Max time to wait for the loading to finish.

30

Raises:

Type Description
TimeoutError

If the loading of the settings timed out.

read()

Read device settings.

Note: It is not recommend to use this function to read the device settings. Instead one can use the zhinst-toolkit functionality to read all settings from a device/subtree from the device directly by calling it.

device = session.connect_device()
...
device_settings = device()
demods_settings = device.demods()

Returns:

Type Description
NodeDict

Device settings.

save_to_file(filename, device, timeout=30)

Save the device settings to a LabOne settings file.

This function creates an new module instance to avoid misconfiguration. It is also synchronous, meaning it will block until save operation has finished.

Parameters:

Name Type Description Default
filename Union[str, Path]

The path to the settings file.

required
device Union[DeviceType, str]

The device which settings should be saved.

required
timeout int

Max time to wait for the loading to finish.

30

Raises:

Type Description
TimeoutError

If the loading of the settings timed out.