Skip to content

Python Utils SHFQA

zhinst.utils.shfqa

Zurich Instruments LabOne Python API Utility functions for SHFQA.

SHFQA_MAX_SIGNAL_GENERATOR_CARRIER_COUNT = 16 module-attribute

SHFQA_MAX_SIGNAL_GENERATOR_WAVEFORM_LENGTH = 4 * 2 ** 10 module-attribute

SHFQA_SAMPLING_FREQUENCY = 2000000000.0 module-attribute

configure_channel = configure_maker(get_channel_settings, partial(build_docstring_configure, new_first_line='Configures the RF input and output of a specified channel.')) module-attribute

configure_result_logger_for_readout = configure_maker(get_result_logger_for_readout_settings, partial(build_docstring_configure, 'Configures a specified result logger for readout mode.')) module-attribute

configure_result_logger_for_spectroscopy = configure_maker(get_result_logger_for_spectroscopy_settings, partial(build_docstring_configure, 'Configures a specified result logger for spectroscopy mode.')) module-attribute

configure_scope = configure_maker(get_scope_settings, partial(build_docstring_configure, new_first_line='Configures the scope for a measurement.')) module-attribute

configure_sequencer_triggering = configure_maker(get_sequencer_triggering_settings, partial(build_docstring_configure, new_first_line='Configures the triggering of a specified sequencer.')) module-attribute

configure_weighted_integration = configure_maker(get_configure_weighted_integration_settings, partial(build_docstring_configure, 'Configures the weighted integration on a specified channel.')) module-attribute

enable_result_logger(daq, device_id, channel_index, *, 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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
channel_index int

Index specifying which result logger to enable - there is one result logger per channel.

required
mode str

Select between "spectroscopy" and "readout" mode.

required
acknowledge_timeout float

Maximum time to wait for diverse acknowledgments in the implementation.

.. versionadded:: 0.1.1

1.0

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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
single int

0 = continuous mode, 1 = single-shot.

required
acknowledge_timeout float

Maximum time to wait for diverse acknowledgments in the implementation.

.. versionadded:: 0.1.1

1.0

enable_sequencer(daq, device_id, channel_index, *, single)

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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
channel_index int

Index specifying which sequencer to enable - there is one sequencer per channel.

required
single int

1 - Disable sequencer after finishing execution. 0 - Restart sequencer after finishing execution.

required

get_result_logger_data(daq, device_id, channel_index, *, 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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
channel_index int

Index specifying which result logger to query results from - there is one result logger per channel.

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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

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, **_)

Compiles and loads a program to a specified sequencer.

This function is composed of 4 steps
  1. Reset the generator to ensure a clean state.
  2. Compile the sequencer program with the offline compiler.
  3. Upload the compiled binary elf file.
  4. Validate that the upload was successful and the generator is ready again.

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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
channel_index int

Index specifying to which sequencer the program below is uploaded - there is one sequencer per channel.

required
sequencer_program str

Sequencer program to be uploaded.

required

Raises:

Type Description
RuntimeError

If the Upload was not successfully or the device could not process the sequencer program.

max_qubits_per_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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required

start_continuous_sw_trigger(daq, device_id, *, 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.

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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
num_triggers int

Number of triggers to be issued.

required
wait_time float

Time between triggers in seconds.

required

write_to_waveform_memory(daq, device_id, channel_index, waveforms, *, 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

SHFQA device identifier, e.g. dev12004 or 'shf-dev12004'.

required
channel_index int

Index specifying which generator 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
clear_existing bool

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

True