Python Utils SHFQC¶
zhinst.utils.shfqc
¶
Zurich Instruments LabOne Python API Utility functions for SHFQC.
AwgModule
¶
Bases: ModuleBase
ziDAQServer(host, port, api_level, allow_version_mismatch=False)
¶
Class to connect with a Zurich Instruments data server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
Host string e.g. '127.0.0.1' for localhost |
required |
port |
int
|
Port number e.g. 8004 for the ziDataServer. |
required |
api_level |
Literal[0, 1, 4, 5, 6]
|
API level number. |
required |
allow_version_mismatch |
bool
|
if set to True, the connection to the data-server will succeed even if the data-server is on a different version of LabOne. If False, an exception will be raised if the data-server is on a different version. (default = False) |
False
|
api_level: Literal[0, 1, 4, 5, 6]
property
¶
The ziAPI level used for the active connection.
.. versionadded:: 22.08
host: str
property
¶
The host used for the active connection.
.. versionadded:: 22.08
port: int
property
¶
The port used for the active connection.
.. versionadded:: 22.08
asyncGetAsEvent(path)
¶
Trigger an event on the specified node.
The node data is returned by a subsequent poll command.
The difference to the non async equivalent is that this function returns immediately, even before the data server has received the request. This gives the lowest latency at the cost of not providing feedback if the request fails
.. versionadded:: 23.02
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. Note: Wildcards and paths referring to streaming nodes are not permitted. |
required |
asyncSetDouble(path, value)
¶
Asynchronously set the value as double for a specified node.
Asynchronously means that the command is nonblocking and does not wait for the data server acknowledgement.
Warning
This command does have no error reporting at all.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
float
|
Value of the node. |
required |
asyncSetInt(path, value)
¶
Asynchronously set the value as integer for a specified node.
Asynchronously means that the command is nonblocking and does not wait for the data server acknowledgement.
Warning
This command does have no error reporting at all.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
int
|
Value of the node. |
required |
asyncSetString(path, value)
¶
Asynchronously set the value as string for a specified node.
Asynchronously means that the command is nonblocking and does not wait for the data server acknowledgement.
Warning
This command does have no error reporting at all.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
str
|
Value of the node. |
required |
awgModule()
¶
Create a AwgModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
AwgModule
|
Created module instance. |
connect()
¶
Initiate the connection to the data server.
Important
During the object initialization the connection is already
established. It is therefore not necessary to call this
function unless one actively disconnects from the data
server with the disconnect
method.
connectDevice(dev, interface, params=None)
¶
Connect with the data server to a specified device.
The device must be visible to the server. If the device is already connected the call will be ignored. The function will block until the device is connected and the device is ready to use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dev |
str
|
Device serial. |
required |
interface |
Literal['USB', 'PCIe', '1GbE']
|
Device interface. |
required |
params |
Optional[str]
|
Optional interface parameters string. |
None
|
dataAcquisitionModule()
¶
Create a DataAcquisitionModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
DataAcquisitionModule
|
Created module instance. |
deviceSettings()
¶
Create a Device Settings Module object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
DeviceSettingsModule
|
Created module instance. |
disconnect()
¶
Disconnects from the data server.
Important
During the destruction the connection is closed properly. This function therefore does not need to be called in normal usage.
disconnectDevice(dev)
¶
Disconnect a device from the data server.
This function will return immediately. The disconnection of the device may not yet be finished. Args: dev: Device serial string of device to disconnect.
echoDevice(dev)
¶
Deprecated, see the 'sync' command.
Sends an echo command to a device and blocks until answer is received. This is useful to flush all buffers between API and device to enforce that further code is only executed after the device executed a previous command. Args: dev: Device string e.g. 'dev100'.
flush()
¶
Deprecated, see the 'sync' command.
The flush command is identical to the sync command.
get(paths, *, flat=False, flags=0, settingsonly=True, subscribedonly=False, basechannelonly=False, excludevectors=False)
¶
Return a dict with all nodes from the specified sub-tree.
Note: Flags are ignored for a path that specifies one or more leaf nodes.
Specifying flags, either as positional or keyword argument is
mandatory if an empty set would be returned given the
default flags (settingsonly).
High-speed streaming nodes (e.g. /devN/demods/0/sample
) are
are never returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths |
str
|
Path string of the node. Multiple paths can be specified as a comma-separated list. Wild cards are supported to select multiple matching nodes. |
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
|
flags |
Union[ziListEnum, int]
|
Flags specifying how the selected nodes are listed
(see |
0
|
settingsonly |
bool
|
Returns only nodes which are marked as setting (default: True). |
True
|
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
|
excludevectors |
bool
|
Exclude vector nodes (default: False). |
False
|
Returns:
Type | Description |
---|---|
LabOneResultNested
|
A dict with all nodes from the specified sub-tree. |
getAsEvent(path)
¶
Trigger an event on the specified node.
The node data is returned by a subsequent poll command.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. Note: Wildcards and paths referring to streaming nodes are not permitted. |
required |
getAuxInSample(path)
¶
Returns a single auxin sample.
The auxin data is averaged in contrast to the auxin data embedded in the demodulator sample.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node |
required |
getByte(path)
¶
getComplex(path)
¶
getConnectionAPILevel()
¶
Returns ziAPI level used for the active connection.
DEPRECATED, use api_level.
Returns:
Type | Description |
---|---|
Literal[0, 1, 4, 5, 6]
|
ziAPI level used for the active connection. |
getDIO(path)
¶
getDebugLogpath()
¶
Path where logfiles are stored.
Note, it will return an empty string if the path has not
been set or logging has not been enabled via setDebugLevel()
.
Returns:
Type | Description |
---|---|
str
|
Path to directory where logfiles are stored. |
getDouble(path)
¶
getInt(path)
¶
getList(path, flags=8)
¶
DEPRECATED: superseded by get(...).
Return a list with all nodes from the specified sub-tree. Args: path: Path string of the node. Use wild card to select all. flags: Specify which type of nodes to include in the result. Allowed: ZI_LIST_NODES_SETTINGSONLY = 0x08 (default) ZI_LIST_NODES_ALL = 0x00 (all nodes)
getSample(path)
¶
Returns a single demodulator sample (including DIO and AuxIn).
For more efficient data recording use subscribe and poll methods!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node |
required |
Returns:
Type | Description |
---|---|
Dict[str, ndarray]
|
Single demodulator sample (including DIO and AuxIn). |
getString(path)
¶
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 node.
HF2 devices do not support this functionality.
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 |
impedanceModule()
¶
Create a ImpedanceModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
ImpedanceModule
|
Created module instance. |
listNodes(path, *, flags=None, 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 |
Optional[Union[ziListEnum, int]]
|
Flags specifying how the selected nodes are listed
(see |
None
|
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=None, recursive=False, absolute=False, leavesonly=False, settingsonly=False, streamingonly=False, subscribedonly=False, basechannelonly=False, getonly=False, excludevectors=False, excludestreaming=False)
¶
Returns a list of nodes with description found at the specified path.
HF2 devices do not support this functionality.
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 |
Optional[Union[ziListEnum, int]]
|
Flags specifying how the selected nodes are listed
(see |
None
|
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]
|
JSON dictionary nodepath:information |
logOff()
¶
Disables logging of commands sent to a server.
logOn(flags, filename, style=2)
¶
Enables logging of commands sent to a server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flags |
int
|
Flags (LOG_NONE: 0x00000000 LOG_SET_DOUBLE: 0x00000001 LOG_SET_INT: 0x00000002 LOG_SET_BYTE: 0x00000004 LOG_SET_STRING: 0x00000008 LOG_SYNC_SET_DOUBLE: 0x00000010 LOG_SYNC_SET_INT: 0x00000020 LOG_SYNC_SET_BYTE: 0x00000040 LOG_SYNC_SET_STRING: 0x00000080 LOG_GET_DOUBLE: 0x00000100 LOG_GET_INT: 0x00000200 LOG_GET_BYTE: 0x00000400 LOG_GET_STRING: 0x00000800 LOG_GET_DEMOD: 0x00001000 LOG_GET_DIO: 0x00002000 LOG_GET_AUXIN: 0x00004000 LOG_GET_COMPLEX: 0x00008000 LOG_LISTNODES: 0x00010000 LOG_SUBSCRIBE: 0x00020000 LOG_UNSUBSCRIBE: 0x00040000 LOG_GET_AS_EVENT: 0x00080000 LOG_UPDATE: 0x00100000 LOG_POLL_EVENT: 0x00200000 LOG_POLL: 0x00400000 LOG_ALL : 0xffffffff) |
required |
filename |
str
|
Log file name. |
required |
style |
Literal[0, 1, 2]
|
Log style (LOG_STYLE_TELNET: 0, LOG_STYLE_MATLAB: 1, LOG_STYLE_PYTHON: 2 (default)). |
2
|
multiDeviceSyncModule()
¶
Create a MultiDeviceSyncModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
MultiDeviceSyncModule
|
Created module instance. |
pidAdvisor()
¶
Create a PID Advisor Module object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
PidAdvisorModule
|
Created module instance. |
poll(recording_time_s, timeout_ms, flags=0, flat=False)
¶
Poll all Events available before and within an given time period.
Continuously check for value changes (by calling pollEvent) in all subscribed nodes for the specified duration and return the data. If no value change occurs in subscribed nodes before duration + timeout, poll returns no data. This function call is blocking (it is synchronous). However, since all value changes are returned since either subscribing to the node or the last poll (assuming no buffer overflow has occurred on the Data Server), this function may be used in a quasi-asynchronous manner to return data spanning a much longer time than the specified duration. The timeout parameter is only relevant when communicating in a slow network. In this case it may be set to a value larger than the expected round-trip time in the network.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recording_time_s |
float
|
Recording time in [s]. The function will block during that time. |
required |
timeout_ms |
int
|
Poll timeout in [ms]. Recommended value is 500ms. |
required |
flags |
int
|
Poll flags. DEFAULT = 0x0000: Default. FILL = 0x0001: Fill holes. THROW = 0x0004: Throw EOFError exception if sample loss is detected (only possible in combination with DETECT). DETECT = 0x0008: Detect data loss holes. |
0
|
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]
|
A dict with the polled events. (Empty if no event occurred within the given timeout) |
pollEvent(timeout_ms)
¶
Poll a single Event.
An event are one or multiple changes that occurred in one single subscribed node. This is a low-level function to obtain a single event from the data server connection. To get all data waiting in the buffers, this command should be executed continuously until an empty dict is returned.
The poll()
function is better suited in many cases, as it
returns the data accumulated over some time period.
Args:
timeout_ms: Poll timeout in [ms]. Recommended value is 500ms.
Returns:
Type | Description |
---|---|
Dict[str, LabOneResultAny]
|
A dict with the polled event. (Empty if no event occurred within the given timeout) |
precompensationAdvisor()
¶
Create a PrecompensationAdvisorModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
PrecompensationAdvisorModule
|
Created module instance. |
programRT(dev, filename)
¶
quantumAnalyzerModule()
¶
Create a QuantumAnalyzerModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
QuantumAnalyzerModule
|
Created module instance. |
record()
¶
revision()
¶
Get the revision number of the Python interface of Zurich Instruments.
Returns:
Type | Description |
---|---|
int
|
Revision number. |
scopeModule()
¶
Create a ScopeModule object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
ScopeModule
|
Created module instance. |
set(items_or_path, value=None)
¶
Overloaded function.
-
set(self, items: _MultipleNodeItems)
Set multiple nodes.
items
is a list of path/value pairs.A transaction is used to optimize the data transfer.
-
set(self, path: str, value: Any)
Set a single node value.
path
is the node path andvalue
the value to set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items_or_path |
Union[Union[List[Tuple[str, Any]], Tuple[Tuple[str, Any]]], str]
|
A list of path/value pairs or the node path string. |
required |
value |
Optional[Any]
|
The value to set in case of a single node set (items is the node path). |
None
|
setByte(path, value)
¶
setComplex(path, value)
¶
setDebugLevel(severity)
¶
Enables debug log and sets the debug level.
Resets the debug levels for individual sinks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
severity |
Literal[0, 1, 2, 3, 4, 5, 6]
|
Debug level (trace:0, debug:1, info:2, status:3, warning:4, error:5, fatal:6). |
required |
setDebugLevelConsole(severity)
¶
Enables debug log and sets the debug level for the console output. Args: severity: Debug level (trace:0, debug:1, info:2, status:3, warning:4, error:5, fatal:6).
setDebugLevelFile(severity)
¶
Enables debug log and sets the debug level for the file output. Args: severity: Debug level (trace:0, debug:1, info:2, status:3, warning:4, error:5, fatal:6).
setDebugLogpath(path)
¶
Sets the path where logfiles are stored.
Note, it will restart logging if it was already enabled via setDebugLevel().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path to directory where logfiles are stored. |
required |
setDeprecated(items)
¶
setDouble(path, value)
¶
setInt(path, value)
¶
setString(path, value)
¶
setVector(path, value)
¶
Set the value for a specified vector node.
The command is different from the other set commands and is Optimized for vector transfer. It blocks until the device itself has acknowledged the complete vector data set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
Union[ndarray, List[Union[int, float, complex]], Tuple[Union[int, float, complex], ...], str]
|
Vector ((u)int8, (u)int16, (u)int32, (u)int64, float, double) or string to write. |
required |
subscribe(path)
¶
Subscribe to one or several nodes.
Fetch data with the poll command. In order to avoid fetching old data that is still in the buffer, execute a sync command before subscribing to data streams.
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 |
sweep()
¶
Create a Sweeper Module object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
SweeperModule
|
Created module instance. |
sync()
¶
Synchronize all data paths. Ensures that get and poll commands return data which was recorded after the setting changes in front of the sync command. This sync command replaces the functionality of all syncSet, flush, and echoDevice commands.
Warning
This blocks until all devices connected to the data server report a ready state! This can take up to a minute.
syncSetDouble(path, value)
¶
Synchronously set the value as double for a specified node.
Synchronously means that the command is blocking until the device has acknowledged the set request.
Warning
This command takes significantly longer than a non sync command and should be used with care.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
float
|
Value of the node. |
required |
Returns:
Type | Description |
---|---|
float
|
Acknowledged value by the device. |
syncSetInt(path, value)
¶
Synchronously set the value as integer for a specified node.
Synchronously means that the command is blocking until the device has acknowledged the set request.
Warning
This command takes significantly longer than a non sync command and should be used with care.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
int
|
Value of the node. |
required |
Returns:
Type | Description |
---|---|
int
|
Acknowledged value by the device. |
syncSetString(path, value)
¶
Synchronously set the value as string for a specified node.
Synchronously means that the command is blocking until the device has acknowledged the set request.
Warning
This command takes significantly longer than a non sync command and should be used with care.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path string of the node. |
required |
value |
str
|
Value of the node. |
required |
Returns:
Type | Description |
---|---|
str
|
Acknowledged value by the device. |
unsubscribe(path)
¶
Unsubscribe data streams.
Use this command after recording to avoid buffer overflows that may increase the latency of other command.
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 |
update()
¶
Check if additional devices are attached.
Only revelant for connections to an HF2 Data Server. This function is not needed for servers running under windows as devices will be detected automatically.
version()
¶
Get version string of the Python interface of Zurich Instruments.
writeDebugLog(severity, message)
¶
Outputs message to the debug log (if enabled).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
severity |
Literal[0, 1, 2, 3, 4, 5, 6]
|
Debug level (trace:0, debug:1, info:2, status:3, warning:4, error:5, fatal:6). message: Message to output to the log. |
required |
zoomFFT()
¶
Create a zoomFFT Module object.
This will start a thread for running an asynchronous module.
Returns:
Type | Description |
---|---|
ZoomFFTModule
|
Created module instance. |
configure_marker_and_trigger(daq, device_id, channel_index, *, trigger_in_source, trigger_in_slope, marker_out_source)
¶
Configures the trigger inputs and marker outputs of a specified AWG core.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index of the used SG channel. |
required |
trigger_in_source |
str
|
Alias for the trigger input used by the sequencer. For a list of available values use: daq.help(f"/{dev_id}/sgchannels/{channel_index}/awg/auxtriggers/0/channel") |
required |
trigger_in_slope |
str
|
Alias for the slope of the input trigger used by sequencer. For a list of available values use daq.help(f"/{dev_id}/sgchannels/{channel_index}/awg/auxtriggers/0/slope") |
required |
marker_out_source |
str
|
Alias for the marker output source used by the sequencer. For a list of available values use daq.help(f"/{dev_id}/sgchannels/{channel_index}/marker/source") |
required |
configure_pulse_modulation(daq, device_id, channel_index, *, enable, osc_index=0, osc_frequency=100000000.0, phase=0.0, global_amp=0.5, gains=(1.0, -1.0, 1.0, 1.0), sine_generator_index=0)
¶
Configure the pulse modulation.
Configures the sine generator to digitally modulate the AWG output, for generating single sideband AWG signals.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index of the used SG channel. |
required |
enable |
int
|
Enables modulation. |
required |
osc_index |
int
|
Selects which oscillator to use. |
0
|
osc_frequency |
float
|
Oscillator frequency used to modulate the AWG outputs. (default = 100e6) |
100000000.0
|
phase |
float
|
Sets the oscillator phase. (default = 0.0) |
0.0
|
global_amp |
float
|
Global scale factor for the AWG outputs. (default = 0.5) |
0.5
|
gains |
tuple
|
Sets the four amplitudes used for single sideband generation. default values correspond to upper sideband with a positive oscillator frequency. (default = (1.0, -1.0, 1.0, 1.0)) |
(1.0, -1.0, 1.0, 1.0)
|
sine_generator_index |
int
|
Selects which sine generator to use on a given channel. |
0
|
configure_qa_channel(daq, device_id, *, input_range, output_range, center_frequency, mode)
¶
Configures the RF input and output of a specified QA channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
input_range |
int
|
Maximal range of the signal input power in dbM. |
required |
output_range |
int
|
Maximal range of the signal output power in dbM. |
required |
center_frequency |
float
|
Center Frequency of the analysis band. |
required |
mode |
str
|
Select between "spectroscopy" and "readout" mode. |
required |
configure_qa_sequencer_triggering(daq, device_id, *, aux_trigger, play_pulse_delay=0.0)
¶
Configures the triggering of a specified sequencer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
aux_trigger |
str
|
Alias for the trigger used in the sequencer. For a list of available values use. daq.help(f"/{device_id}/qachannels/0/generator/auxtriggers/0/channel") |
required |
play_pulse_delay |
float
|
Delay in seconds before the start of waveform playback. |
0.0
|
configure_result_logger_for_readout(daq, device_id, *, result_source, result_length, num_averages=1, averaging_mode=0)
¶
Configures a specified result logger for readout mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
result_source |
str
|
String-based tag to select the result source in readout mode, e.g. "result_of_integration" or "result_of_discrimination". |
required |
result_length |
int
|
Number of results to be returned by the result logger. |
required |
num_averages |
int
|
Number of averages, will be rounded to 2^n. |
1
|
averaging_mode |
int
|
Select the averaging order of the result, with 0 = cyclic and 1 = sequential. |
0
|
configure_result_logger_for_spectroscopy(daq, device_id, *, result_length, num_averages=1, averaging_mode=0)
¶
Configures a specified result logger for spectroscopy mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
result_length |
int
|
Number of results to be returned by the result logger |
required |
num_averages |
int
|
Number of averages, will be rounded to 2^n. |
1
|
averaging_mode |
int
|
Select the averaging order of the result, with 0 = cyclic and 1 = sequential. |
0
|
configure_scope(daq, device_id, *, input_select, num_samples, trigger_input, num_segments=1, num_averages=1, trigger_delay=0.0)
¶
Configures the scope for a measurement.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
input_select |
dict
|
Keys (int) map a specific scope channel with a signal source (str), e.g. "channel0_signal_input". For a list of available values use daq.help(f"/{device_id}/scopes/0/channels/0/inputselect"). |
required |
num_samples |
int
|
Number of samples. |
required |
trigger_input |
str
|
Specifies the trigger source of the scope acquisition - if set to None, the self-triggering mode of the scope becomes active, which is useful e.g. for the GUI. For a list of available trigger values use daq.help(f"/{device_id}/scopes/0/trigger/channel"). |
required |
num_segments |
int
|
Number of distinct scope shots to be returned after ending the acquisition. |
1
|
num_averages |
int
|
Specifies how many times each segment should be averaged on hardware; to finish a scope acquisition, the number of issued triggers must be equal to num_segments * num_averages. |
1
|
trigger_delay |
float
|
Delay in samples specifying the time between the start of data acquisition and reception of a trigger. |
0.0
|
configure_sg_channel(daq, device_id, channel_index, *, enable, output_range, center_frequency, rflf_path)
¶
Configures the RF input and output of a specified SG channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index of the used SG channel. |
required |
enable |
int
|
Whether or not to enable the channel. |
required |
output_range |
int
|
Maximal range of the signal output power in dbM. |
required |
center_frequency |
float
|
Center Frequency before modulation. |
required |
rflf_path |
int
|
Switch between RF and LF paths. |
required |
configure_sine_generation(daq, device_id, channel_index, *, enable, osc_index=0, osc_frequency=100000000.0, phase=0.0, gains=(0.0, 1.0, 1.0, 0.0), sine_generator_index=0)
¶
Configures the sine generator output of a specified SG channel.
Configures the sine generator output of a specified channel for generating continuous wave signals without the AWG.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index of the used SG channel. |
required |
enable |
int
|
Enables the sine generator output. |
required |
osc_index |
int
|
Selects which oscillator to use. |
0
|
osc_frequency |
float
|
Oscillator frequency used by the sine generator. (default = 100e6) |
100000000.0
|
phase |
float
|
Sets the oscillator phase. (default = 0.0) |
0.0
|
gains |
tuple
|
Sets the four amplitudes used for single sideband. generation. default values correspond to upper sideband with a positive oscillator frequency. gains are set in this order: I/sin, I/cos, Q/sin, Q/cos (default = (0.0, 1.0, 1.0, 0.0)) |
(0.0, 1.0, 1.0, 0.0)
|
sine_generator_index |
int
|
Selects which sine generator to use on a given channel. |
0
|
configure_weighted_integration(daq, device_id, *, weights, integration_delay=0.0, clear_existing=True)
¶
Configures the weighted integration on a specified channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
weights |
dict
|
Dictionary containing the complex weight vectors, where keys correspond to the indices of the integration units to be configured. |
required |
integration_delay |
float
|
Delay in seconds before starting readout. |
0.0
|
clear_existing |
bool
|
Specify whether to set all the integration weights to zero before proceeding with the present upload. |
True
|
enable_result_logger(daq, device_id, *, mode, acknowledge_timeout=1.0)
¶
Resets and enables a specified result logger.
Blocks until the host has received the enable acknowledgment from the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
mode |
str
|
Select between "spectroscopy" and "readout" mode. |
required |
acknowledge_timeout |
float
|
Maximum time to wait for diverse acknowledgments in the implementation. |
1.0
|
.. versionadded:: 0.1.1
enable_scope(daq, device_id, *, single, acknowledge_timeout=1.0)
¶
Resets and enables the scope.
Blocks until the host has received the enable acknowledgment from the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
single |
int
|
0 = continuous mode, 1 = single-shot. |
required |
acknowledge_timeout |
float
|
Maximum time to wait for diverse acknowledgments in the implementation. |
1.0
|
.. versionadded:: 0.1.1
enable_sequencer(daq, device_id, channel_index, *, single, channel_type)
¶
Starts the sequencer of a specific channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index specifying which sequencer to enable - there is one sequencer per channel. (Always 0 for the qa channel) |
required |
single |
int
|
1 - Disable sequencer after finishing execution. 0 - Restart sequencer after finishing execution. |
required |
channel_type |
str
|
Identifier specifying if the sequencer from the qa or sg channel should be used. ("qa" or "sg") |
required |
get_result_logger_data(daq, device_id, *, mode, timeout=1.0)
¶
Return the measured data of a specified result logger.
Blocks until the specified result logger is finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
mode |
str
|
Select between "spectroscopy" and "readout" mode. |
required |
timeout |
float
|
Maximum time to wait for data in seconds. |
1.0
|
Returns:
Type | Description |
---|---|
array
|
Array containing the result logger data. |
get_scope_data(daq, device_id, *, timeout=5.0)
¶
Queries the scope for data once it is finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
timeout |
float
|
Maximum time to wait for the scope data in seconds. |
5.0
|
Returns:
Type | Description |
---|---|
tuple
|
Three-element tuple with: * recorded_data (array): Contains an array per scope channel with the recorded data. * recorded_data_range (array): Full scale range of each scope channel. * scope_time (array): Relative acquisition time for each point in recorded_data in seconds starting from 0. |
load_sequencer_program(daq, device_id, channel_index, sequencer_program, *, channel_type, awg_module=None, timeout=10)
¶
Compiles and loads a program to a specified sequencer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index specifying to which sequencer the program below is uploaded - there is one sequencer per channel. (Always 0 for the qa channel) |
required |
sequencer_program |
str
|
Sequencer program to be uploaded. |
required |
channel_type |
str
|
Identifier specifying if the sequencer from the qa or sg channel should be used. ("qa" or "sg") |
required |
awg_module |
AwgModule
|
The standalone AWG compiler is used instead. .. deprecated:: 22.08 |
None
|
timeout |
float
|
Maximum time to wait for the compilation on the device in seconds. |
10
|
max_qubits_per_qa_channel(daq, device_id)
¶
Returns the maximum number of supported qubits per channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
start_continuous_sw_trigger(daq, device_id, *, num_triggers, wait_time)
¶
Start a continuous trigger.
Issues a specified number of software triggers with a certain wait time in between. The function guarantees reception and proper processing of all triggers by the device, but the time between triggers is non-deterministic by nature of software triggering.
Warning
Only use this function for prototyping and/or cases without strong timing requirements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
num_triggers |
int
|
Number of triggers to be issued. |
required |
wait_time |
float
|
Time between triggers in seconds. |
required |
upload_commandtable(daq, device_id, channel_index, command_table)
¶
Uploads a command table in the form of a string to the appropriate channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index specifying which SG channel to upload the command table to. |
required |
command_table |
str
|
The command table to be uploaded. |
required |
write_to_waveform_memory(daq, device_id, channel_index, waveforms, *, channel_type, clear_existing=True)
¶
Writes pulses to the waveform memory of a specified generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daq |
ziDAQServer
|
Instance of a Zurich Instruments API session connected to a Data Server. The device with identifier device_id is assumed to already be connected to this instance. |
required |
device_id |
str
|
SHFQC device identifier, e.g. |
required |
channel_index |
int
|
Index specifying which sequencer the waveforms below are written to - there is one generator per channel. |
required |
waveforms |
dict
|
Dictionary of waveforms, the key specifies the slot to which to write the value which is a complex array containing the waveform samples. |
required |
channel_type |
str
|
Identifier specifying if the waveforms should be uploaded to the qa or sg channel. ("qa" or "sg") |
required |
clear_existing |
bool
|
Specify whether to clear the waveform memory before the present upload. (Only used when channel_type is "qa"!) |
True
|