Skip to content

Python Toolkit API SHFQA

zhinst.toolkit.driver.devices.shfqa.SHFQA(serial, device_type, session)

Bases: BaseInstrument

High-level driver for the Zurich Instruments SHFQA.

max_qubits_per_channel: int cached property

Maximum number of supported qubits per channel.

Returns:

Type Description
int

Maximum number of supported qubits per channel.

qachannels: t.Sequence[QAChannel] cached property

A Sequence of QAChannels.

Returns:

Type Description
Sequence[QAChannel]

A Sequence of QAChannels.

scopes: t.Sequence[SHFScope] cached property

A Sequence of SHFScopes.

Returns:

Type Description
Sequence[SHFScope]

A Sequence of SHFScopes.

start_continuous_sw_trigger(*, num_triggers, wait_time)

Issues a specified number of software triggers.

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. Only use this function for prototyping and/or cases without strong timing requirements.

Parameters:

Name Type Description Default
num_triggers int

Number of triggers to be issued

required
wait_time float

Time between triggers in seconds

required

zhinst.toolkit.driver.devices.shfqa.QAChannel(device, session, tree)

Bases: Node

Quantum Analyzer Channel for the SHFQA.

QAChannel implements basic functionality to configure QAChannel settings of the SHFQA instrument. Besides the Generator, Readout and Sweeper modules it also provides an easy access to commonly used QAChannel parameters.

Parameters:

Name Type Description Default
device SHFQA

SHFQA device object.

required
session Session

Underlying session.

required
tree tuple[str, ...]

Node tree (node path as tuple) of the corresponding node.

required

generator: Generator cached property

Generator.

Returns:

Type Description
Generator

Generator node.

readout: Readout cached property

Readout.

Returns:

Type Description
Readout

Readout node.

spectroscopy: Spectroscopy cached property

Spectroscopy.

Returns:

Type Description
Spectroscopy

Spectroscopy node.

configure_channel(*, input_range, output_range, center_frequency, mode)

Configures the RF input and output of a specified channel.

Parameters:

Name Type Description Default
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 [Hz]

required
mode SHFQAChannelMode

Select between spectroscopy and readout mode.

required

zhinst.toolkit.driver.devices.shfqa.Generator(root, tree, serial, index, max_qubits_per_channel, device_type, device_options)

Bases: AWG

Generator node.

Implements basic functionality of the generator allowing the user to write and upload their '.seqC' code.

In contrast to other AWG Sequencers, e.g. from the HDAWG, SHFSG it does not provide writing access to the Waveform Memories and hence does not come with predefined waveforms such as gauss or ones. Therefore, all waveforms need to be defined in Python and uploaded to the device using upload_waveforms method.

Parameters:

Name Type Description Default
root NodeTree

Root of the nodetree

required
tree tuple

Tree (node path as tuple) of the current node

required
daq_server

Instance of the ziDAQServer

required
serial str

Serial of the device.

required
index int

Index of the corresponding awg channel

required
max_qubits_per_channel int

Max qubits per channel

required

available_aux_trigger_inputs: list[str] property

List of available aux trigger sources for the generator.

Returns:

Type Description
list[str]

List of available aux trigger sources for the generator.

configure_sequencer_triggering(*, aux_trigger, play_pulse_delay=0.0)

Configure the sequencer triggering.

Parameters:

Name Type Description Default
aux_trigger str

Alias for the trigger source used in the sequencer. For the list of available values, use available_aux_trigger_inputs

required
play_pulse_delay float

Delay in seconds before the start of waveform playback.

0.0

read_from_waveform_memory(slots=None)

Read pulses from the waveform memory.

Parameters:

Name Type Description Default
slots Optional[list[int]]

List of waveform indexes to read from the device. If not specified all assigned waveforms will be downloaded.

None

Returns:

Type Description
Waveforms

Mutable mapping of the downloaded waveforms.

write_to_waveform_memory(pulses, *, clear_existing=True)

Writes pulses to the waveform memory.

Parameters:

Name Type Description Default
pulses Union[Waveforms, dict]

Waveforms that should be uploaded.

required
clear_existing bool

Flag whether to clear the waveform memory before the present upload. (default = True)

True

zhinst.toolkit.driver.nodes.readout.Readout(root, tree, serial, index, max_qubits_per_channel)

Bases: Node

Readout node.

Implements basic functionality of the readout, e.g allowing the user to write the integration weight.

Parameters:

Name Type Description Default
root NodeTree

Root of the nodetree

required
tree tuple

Tree (node path as tuple) of the current node

required
serial str

Serial of the device.

required
index int

Index of the corresponding awg channel

required
max_qubits_per_channel int

Max qubits per channel

required

multistate: MultiState cached property

Multistate discrimination node tree branch.

configure_result_logger(*, result_source, result_length, num_averages=1, averaging_mode=AveragingMode.CYCLIC)

Configures the result logger for readout mode.

Parameters:

Name Type Description Default
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 AveragingMode

Select the averaging order of the result, with 0 = cyclic and 1 = sequential.

CYCLIC

read(*, timeout=10)

Waits until the logger finished recording and returns the measured data.

Parameters:

Name Type Description Default
timeout float

Maximum time to wait for data in seconds (default = 10s)

10

Returns:

Type Description
array

Result logger data.

read_integration_weights(slots=None)

Read integration weights from the waveform memory.

Parameters:

Name Type Description Default
slots Optional[list[int]]

List of weight slots to read from the device. If not specified all available weights will be downloaded.

None

Returns:

Type Description
Waveforms

Mutable mapping of the downloaded weights.

run()

Reset and enable the result logger.

stop(*, timeout=10, sleep_time=0.05)

Stop the result logger.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Readout (default: 10).

10
sleep_time float

Sleep interval in seconds. (default = 0.05)

0.05

Raises:

Type Description
TimeoutError

The result logger could not been stopped within the given time.

wait_done(*, timeout=10, sleep_time=0.05)

Wait until the readout is finished.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Readout (default: 10).

10
sleep_time float

Sleep interval in seconds. (default = 0.05)

0.05

Raises:

Type Description
TimeoutError

if the readout recording is not completed within the given time.

write_integration_weights(weights, *, integration_delay=0.0, integration_length=None, clear_existing=True)

Configures the weighted integration.

Parameters:

Name Type Description Default
weights Union[Waveforms, 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 the readout.

0.0
integration_length Optional[int]

Number of samples over which the weighted integration runs. If set to None, the integration length is determined by the length of the first weights vector.

None
clear_existing bool

Flag whether to clear the waveform memory before the present upload.

True

zhinst.toolkit.driver.nodes.spectroscopy.Spectroscopy(root, tree, serial, index)

Bases: Node

Spectroscopy node.

Implements basic functionality of the spectroscopy, e.g allowing the user to read the result logger data.

Parameters:

Name Type Description Default
root NodeTree

Root of the nodetree

required
tree tuple

Tree (node path as tuple) of the current node

required
serial str

Serial of the device.

required
index int

Index of the corresponding awg channel

required

configure_result_logger(*, result_length, num_averages=1, averaging_mode=AveragingMode.CYCLIC)

Configures the result logger for spectroscopy mode.

Parameters:

Name Type Description Default
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 AveragingMode

Averaging order of the result.

CYCLIC

read(*, timeout=10)

Waits until the logger finished recording and returns the measured data.

Parameters:

Name Type Description Default
timeout float

Maximum time to wait for data in seconds (default = 10s)

10

Returns:

Type Description
array

An array containing the result logger data.

run()

Resets and enables the spectroscopy result logger.

stop(*, timeout=10, sleep_time=0.05)

Stop the result logger.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Spectroscopy (default: 10).

10
sleep_time float

Time in seconds to wait between requesting Spectroscopy state

0.05

Raises: TimeoutError: If the result logger could not been stopped within the given time.

wait_done(*, timeout=10, sleep_time=0.05)

Wait until spectroscopy is finished.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Spectroscopy (default: 10).

10
sleep_time float

Time in seconds to wait between requesting Spectroscopy state

0.05

Raises:

Type Description
TimeoutError

if the spectroscopy recording is not completed within the given time.

zhinst.toolkit.driver.nodes.shfqa_scope.SHFScope(root, tree, daq_server, serial)

Bases: Node

SHFQA Scope Node.

Implements basic functionality of the scope node, e.g allowing the user to read the data.

Parameters:

Name Type Description Default
root NodeTree

Root of the nodetree

required
tree tuple

Tree (node path as tuple) of the current node

required
daq_server ziDAQServer

Instance of the ziDAQServer

required
serial str

Serial of the device.

required

available_inputs: list[str] property

List of the available signal sources for the scope channels.

available_trigger_inputs: list[str] property

List of the available trigger sources for the scope.

configure(*, input_select, num_samples, trigger_input, num_segments=1, num_averages=1, trigger_delay=0)

Configures the scope for a measurement.

Parameters:

Name Type Description Default
input_select dict[int, str]

Map of a specific scope channel an their signal source, e.g. "channel0_signal_input". (For a list of available values use available_inputs)

required
num_samples int

Number samples to recorded in a scope shot.

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 available_trigger_inputs.

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

read(*, timeout=10)

Read out the recorded data from the scope.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Scope (default: 10).

10

Returns:

Type Description
tuple

(recorded_data, recorded_data_range, scope_time)

Raises:

Type Description
TimeoutError

if the scope recording is not completed before timeout.

run(*, single=True, timeout=10, sleep_time=0.005)

Run the scope recording.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Scope (default = 10).

10
sleep_time float

Time in seconds to wait between requesting the progress and records values (default = 0.005).

0.005

Raises:

Type Description
TimeoutError

The scope did not start within the specified timeout.

stop(*, timeout=10, sleep_time=0.005)

Stop the scope recording.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the scope (default = 10).

10
sleep_time float

Time in seconds to wait between requesting the progress and records values (default = 0.005).

0.005

Raises:

Type Description
TimeoutError

The scope did not stop within the specified timeout.

wait_done(*, timeout=10, sleep_time=0.005)

Wait until the scope recording is finished.

Parameters:

Name Type Description Default
timeout float

The maximum waiting time in seconds for the Scope (default = 10).

10
sleep_time float

Time in seconds to wait between requesting the progress and records values (default = 0.005).

0.005

Raises:

Type Description
TimeoutError

The scope did not finish within the specified timeout.

zhinst.toolkit.interface.SHFQAChannelMode

Bases: Enum

SHFQA channel mode.

Attributes:

Name Type Description
SPECTROSCOPY str

Spectroscopy mode.

READOUT str

Readout mode.

READOUT: str = 'readout' class-attribute instance-attribute

SPECTROSCOPY: str = 'spectroscopy' class-attribute instance-attribute

zhinst.toolkit.interface.AveragingMode

Bases: IntEnum

Averaging modes.

Attributes:

Name Type Description
CYCLIC int

All frequency points are measured once from start frequency to stop frequency. The sweeper then moves back to start frequency and repeats the sweep the number of times specified by the number of averages setting.

SEQUENTIAL int

A frequency point is measured the number of times specified by the number of averages setting. In other words, the same frequency point is measured repeatedly until the number of averages is reached and the sweeper then moves to the next frequency point.

CYCLIC: int = 0 class-attribute instance-attribute

SEQUENTIAL: int = 1 class-attribute instance-attribute