Skip to content

Python Core API LabOne Modules

All LabOne Modules have the same interface which is defined in the ModuleBase class. For a detailed introduction into the LabOne Modules take a look at the dedicated documentation section.

zhinst.core.AwgModule

Bases: ModuleBase

zhinst.core.DataAcquisitionModule

Bases: ModuleBase

zhinst.core.DeviceSettingsModule

Bases: ModuleBase

zhinst.core.ImpedanceModule

Bases: ModuleBase

zhinst.core.MultiDeviceSyncModule

Bases: ModuleBase

zhinst.core.PidAdvisorModule

Bases: ModuleBase

zhinst.core.PrecompensationAdvisorModule

Bases: ModuleBase

zhinst.core.QuantumAnalyzerModule

Bases: ModuleBase

zhinst.core.RecorderModule

Bases: ModuleBase

zhinst.core.ScopeModule

Bases: ModuleBase

zhinst.core.SweeperModule

Bases: ModuleBase

zhinst.core.ZoomFFTModule

Bases: ModuleBase

zhinst.core.ModuleBase

clear()

End the module thread.

execute()

Start the module execution.

Subscribing or unsubscribing is not possible until the execution is finished.

finish()

Stop the execution.

The execution may be restarted by calling 'execute' again.

finished()

Check if the execution has finished.

Returns:

Type Description
bool

Flag if the execution is finished.

get(path, *, flat=False)

Return a dict with all nodes from the specified sub-tree.

Parameters:

Name Type Description Default
path str

Path string of the node. Use wild card to select all.

required
flat bool

Specify which type of data structure to return. Return data either as a flat dict (True) or as a nested dict tree (False). Default = False.

False

Returns:

Type Description
LabOneResultNested

A dict with all nodes from the specified sub-tree.

getDouble(path)

Get a double value from the specified node.

Parameters:

Name Type Description Default
path str

Path string of the node.

required

Returns:

Type Description
float

Floating point double value.

getInt(path)

Get a integer value from the specified node.

Parameters:

Name Type Description Default
path str

Path string of the node.

required

Returns:

Type Description
int

Integer value.

getString(path)

Get a string value from the specified node.

Parameters:

Name Type Description Default
path str

Path string of the node.

required

Returns:

Type Description
str

String value.

getStringUnicode(path)

Get a unicode encoded string value from the specified node.

Deprecated, please use getString instead. Args: path: Path string of the node.

Returns:

Type Description
str

Unicode encoded string value.

help(path='*')

Prints a well-formatted description of a module parameter.

Parameters:

Name Type Description Default
path str

Path for which the nodes should be listed. The path may contain wildcards so that the returned nodes do not necessarily have to have the same parents.

'*'

listNodes(path, *, flags=0, recursive=False, absolute=False, leavesonly=False, settingsonly=False, streamingonly=False, subscribedonly=False, basechannelonly=False, getonly=False, excludevectors=False, excludestreaming=False)

This function returns a list of node names found at the specified path.

Parameters:

Name Type Description Default
path str

Path for which the nodes should be listed. The path may contain wildcards so that the returned nodes do not necessarily have to have the same parents.

required
flags Union[ziListEnum, int]

Flags specifying how the selected nodes are listed (see zhinst.core.ziListEnum). Flags can also specified by the keyword arguments below.

0
recursive bool

Returns the nodes recursively (default: False)

False
absolute bool

Returns absolute paths (default: True)

False
leavesonly bool

Returns only nodes that are leaves, which means they are at the outermost level of the tree (default: False).

False
settingsonly bool

Returns only nodes which are marked as setting (default: False).

False
streamingonly bool

Returns only streaming nodes (default: False).

False
subscribedonly bool

Returns only subscribed nodes (default: False).

False
basechannelonly bool

Return only one instance of a node in case of multiple channels (default: False).

False
getonly bool

Return only nodes that can be used in a get request

False
excludestreaming bool

Exclude streaming nodes (default: False).

False
excludevectors bool

Exclude vector nodes (default: False).

False

Returns:

Type Description
List[str]

List of node names.

listNodesJSON(path, *, flags=0, recursive=False, absolute=False, leavesonly=False, settingsonly=False, streamingonly=False, subscribedonly=False, basechannelonly=False, getonly=False, excludevectors=False, excludestreaming=False)

Returns a json dict of all nodes found at the specified path.

Parameters:

Name Type Description Default
path str

Path for which the nodes should be listed. The path may contain wildcards so that the returned nodes do not necessarily have to have the same parents.

required
flags Union[ziListEnum, int]

Flags specifying how the selected nodes are listed (see zhinst.core.ziListEnum). Flags can also specified by the keyword arguments below. They are the same as for listNodes(), except that recursive, absolute, and leavesonly are enforced.

0
settingsonly bool

Returns only nodes which are marked as setting (default: False).

False
streamingonly bool

Returns only streaming nodes (default: False).

False
subscribedonly bool

Returns only subscribed nodes (default: False).

False
basechannelonly bool

Return only one instance of a node in case of multiple channels (default: False).

False
excludestreaming bool

Exclude streaming nodes (default: False).

False
excludevectors bool

Exclude vector nodes (default: False).

False

Returns:

Type Description
str

JSON dictionary nodepath:information

progress()

Reports the progress of the execution.

Returns:

Type Description
ndarray

Progress with a number between 0 and 1.

read(flat=False)

Read the module output data.

If the module execution is still ongoing only a subset of data is returned. If huge data sets are produced call this method to keep memory usage reasonable.

Parameters:

Name Type Description Default
flat bool

Specify which type of data structure to return. Return data either as a flat dict (True) or as a nested dict tree (False). Default = False.

False

Returns:

Type Description
Dict[str, LabOneResultAny]

The module output data.

save(filename)

Save measured data to file.

Parameters:

Name Type Description Default
filename str

File name string (without extension).

required

subscribe(path)

Subscribe to one or several nodes.

After subscription the module execution can be started with the 'execute' command. During the module execution paths can not be subscribed or unsubscribed.

Parameters:

Name Type Description Default
path Union[str, List[str]]

Path string of the node. Use wild card to select all. Alternatively also a list of path strings can be specified.

required

trigger()

Execute a manual trigger, if applicable.

unsubscribe(path)

Unsubscribe from one or several nodes.

During the module execution paths can not be subscribed or unsubscribed.

Parameters:

Name Type Description Default
path Union[str, List[str]]

Path string of the node. Use wild card to select all. Alternatively also a list of path strings can be specified.

required