quantify_scheduler.backends.zhinst_backend

Backend for Zurich Instruments.

Module Contents

Classes

ZIAcquisitionConfig

Zurich Instruments acquisition configuration.

ZIDeviceConfig

Zurich Instruments device configuration.

Functions

ensure_no_operations_overlap(timing_table)

Iterates over all hardware_channels in a schedule to determine if any of the pulses

_extract_port_clock_channelmapping(→ Dict[str, str])

Take the hardware configuration file and return a dictionary that maps port-clock

_determine_clock_sample_start(→ Tuple[int, float])

depending on the output channel, select the right clock cycle time and sample rate

_determine_clock_start(hardware_channel, abs_time, ...)

_determine_sample_start(hardware_channel, abs_time, ...)

_add_channel_information(→ pandas.DataFrame)

_apply_latency_corrections(→ pandas.DataFrame)

Changes the "abs_time" of a timing table depending on the specified latencies

_determine_measurement_fixpoint_correction(...)

Calculates by how much time to shift all operations to ensure a measurement starts

_apply_measurement_fixpoint_correction(→ pandas.DataFrame)

Updates the abs_time of all operations based on the measurement fixpoint correction.

_add_clock_sample_starts(→ pandas.DataFrame)

Adds the sequence clock cycle start and sampling start of each operation for each

_add_waveform_ids(→ pandas.DataFrame)

Multiple (numerical) waveforms might be needed to represent a single operation.

_parse_local_oscillators(→ Dict[str, ...)

Returns the LocalOscillator domain models parsed from the data dictionary.

_parse_devices(...)

_validate_schedule(→ None)

Validates the CompiledSchedule required values for creating the backend.

apply_waveform_corrections(→ Tuple[int, int, ...)

Add waveform corrections such as modulation, changing the

_flatten_dict(→ Iterable[Tuple[Any, Any]])

Flattens a collection to an iterable set of tuples.

_get_instruction_list(...)

Iterates over a timing table for a specific output for which clock_cycle_start and

compile_backend(...)

Compiles backend for Zurich Instruments hardware according

_add_lo_config(→ None)

Adds configuration for a local oscillator required for a specific output channel to

_add_wave_nodes(...)

_compile_for_hdawg(...)

param device:

_assemble_hdawg_sequence(→ Tuple[str, str])

_compile_for_uhfqa(...)

Initialize programming the UHFQA ZI Instrument.

_assemble_uhfqa_sequence(→ str)

construct_waveform_table(→ Dict[str, numpy.ndarray])

Iterates over all unique waveforms in a timing_table dataframe to calculate the

Attributes

logger

handler

formatter

SUPPORTED_DEVICE_TYPES

WAVEFORM_GRANULARITY

HDAWG_DEVICE_TYPE_CHANNEL_GROUPS

DEVICE_SAMPLING_RATES

CLOCK_SAMPLE_FACTOR

NUM_UHFQA_READOUT_CHANNELS

MAX_QAS_INTEGRATION_LENGTH

logger[source]
handler[source]
formatter[source]
SUPPORTED_DEVICE_TYPES: List[str] = ['HDAWG', 'UHFQA'][source]
WAVEFORM_GRANULARITY: Dict[quantify_scheduler.backends.types.zhinst.DeviceType, int][source]
HDAWG_DEVICE_TYPE_CHANNEL_GROUPS: Dict[str, Dict[int, int]][source]
DEVICE_SAMPLING_RATES: Dict[quantify_scheduler.backends.types.zhinst.DeviceType, Dict[int, int]][source]
CLOCK_SAMPLE_FACTOR = 8[source]
NUM_UHFQA_READOUT_CHANNELS = 10[source]
MAX_QAS_INTEGRATION_LENGTH = 4096[source]
ensure_no_operations_overlap(timing_table: pandas.DataFrame)[source]

Iterates over all hardware_channels in a schedule to determine if any of the pulses have overlap.

Parameters:

timing_table – a timing table containing the absolute time and duration as well as the hardware channels on which these pulses are to be applied.

Raises:

ValueError – If there is overlap between operations.

_extract_port_clock_channelmapping(hardware_cfg: Dict[str, Any]) Dict[str, str][source]

Take the hardware configuration file and return a dictionary that maps port-clock pairs to instrument output channels.

e.g.: {‘q0:mw-q0.01’: ‘ic_hdawg0.channel_0’,

‘q0:res-q0.ro’: ‘ic_uhfqa0.channel_0’}

_determine_clock_sample_start(hardware_channel: str, abs_time: float, operation_name: str = '') Tuple[int, float][source]

depending on the output channel, select the right clock cycle time and sample rate from the channel descriptor for ZI channels. the sample is returned as a float to preserve information of incorrect rounding to full samples if present.

_determine_clock_start(hardware_channel: str, abs_time: float, operation_name: str)[source]
_determine_sample_start(hardware_channel: str, abs_time: float, operation_name: str)[source]
_add_channel_information(timing_table: pandas.DataFrame, port_clock_channelmapping: dict) pandas.DataFrame[source]
_apply_latency_corrections(timing_table: pandas.DataFrame, latency_dict: dict) pandas.DataFrame[source]

Changes the “abs_time” of a timing table depending on the specified latencies for each port-clock combination as specified in the latency dict. The latencies are added to the abs_time elements fulfilling the specific port-clock combination.

_determine_measurement_fixpoint_correction(measurement_start_sample: int, common_frequency: float = 600000000.0) Tuple[float, int][source]

Calculates by how much time to shift all operations to ensure a measurement starts at sample 0.

Parameters:
  • measurement_start_sample – the sample at which the measurement starts

  • common_frequency – The shift needs to be such that it occurs at a multiple of the common frequency. A larger common frequency results in a smaller time correction. This largest common frequency is the common frequency of the HDAWG and UHFQA and is 600 MHz.

Returns:

  • The time correction to be applied in seconds

  • The correction in number of samples.

_apply_measurement_fixpoint_correction(timing_table: pandas.DataFrame, common_frequency: float = 600000000.0) pandas.DataFrame[source]

Updates the abs_time of all operations based on the measurement fixpoint correction.

The abs_time is applied to all operations between two acquisitions. After that the samples and clocks are re-calculated to reflect this change in time.

Parameters:
  • timing_table – A timing table that has the samples already determined.

  • common_frequency – The shift needs to be such that it occurs at a multiple of the common frequency. A larger common frequency results in a smaller time correction. This largest common frequency is the common frequency of the HDAWG and UHFQA and is 600 MHz.

_add_clock_sample_starts(timing_table: pandas.DataFrame) pandas.DataFrame[source]

Adds the sequence clock cycle start and sampling start of each operation for each channel

_add_waveform_ids(timing_table: pandas.DataFrame) pandas.DataFrame[source]

Multiple (numerical) waveforms might be needed to represent a single operation.

This waveform_id consists of a concatenation of the waveform_op_id with the sample_start and modulation phase added to it.

_parse_local_oscillators(data: Dict[str, Any]) Dict[str, quantify_scheduler.backends.types.common.LocalOscillator][source]

Returns the LocalOscillator domain models parsed from the data dictionary.

Parameters:

data – The hardware map “local_oscillators” entry.

Returns:

A dictionary of unique LocalOscillator instances.

Raises:

RuntimeError – If duplicate LocalOscillators have been found.

_parse_devices(data: Dict[str, Any]) List[quantify_scheduler.backends.types.zhinst.Device][source]
_validate_schedule(schedule: quantify_scheduler.schedules.schedule.Schedule) None[source]

Validates the CompiledSchedule required values for creating the backend.

Parameters:

schedule

Raises:

ValueError – The validation error.

apply_waveform_corrections(output: quantify_scheduler.backends.types.zhinst.Output, waveform: numpy.ndarray, start_and_duration_in_seconds: Tuple[float, float], instrument_info: quantify_scheduler.backends.types.zhinst.InstrumentInfo, is_pulse: bool) Tuple[int, int, numpy.ndarray][source]

Add waveform corrections such as modulation, changing the waveform starting time by shifting it and resizing it based on the Instruments granularity.

Parameters:
  • output

  • waveform

  • start_and_duration_in_seconds

  • instrument_info

  • is_pulse – True if it is a pulse to be up converted, False if it is an integration weight.

_flatten_dict(collection: Dict[Any, Any]) Iterable[Tuple[Any, Any]][source]

Flattens a collection to an iterable set of tuples.

Parameters:

collection

_get_instruction_list(output_timing_table: pandas.DataFrame) List[quantify_scheduler.backends.types.zhinst.Instruction][source]

Iterates over a timing table for a specific output for which clock_cycle_start and waveform_id have been determined to return a list of all instructions to be played on a Zurich Instruments device.

class ZIAcquisitionConfig[source]

Zurich Instruments acquisition configuration.

Parameters:
  • n_acquisitions – the number of distinct acquisitions in this experiment.

  • resolvers – resolvers used to retrieve the results from the right UHFQA nodes. See also resolvers

  • bin_mode – the bin mode (average or append)

n_acquisitions: int[source]
resolvers: Dict[int, Callable][source]
bin_mode: quantify_scheduler.enums.BinMode[source]
class ZIDeviceConfig[source]

Zurich Instruments device configuration.

Parameters:
  • name – the name of the schedule the config is for.

  • settings_builder – the builder to configure the ZI settings. This typically includes AWG and AWG settings.

  • acq_config – the acquisition config contains the number of acquisitions and a dictionary of resolvers used to retrieve the results from the right UHFQA nodes. Note that this part of the config is not needed during prepare, but only during the retrieve acquisitions step.

name: str[source]
settings_builder: quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder[source]
acq_config: Optional[ZIAcquisitionConfig][source]
compile_backend(schedule: quantify_scheduler.schedules.schedule.Schedule, hardware_cfg: Dict[str, Any]) quantify_scheduler.schedules.schedule.CompiledSchedule[source]

Compiles backend for Zurich Instruments hardware according to the CompiledSchedule and hardware configuration.

This method generates sequencer programs, waveforms and configurations required for the instruments defined in the hardware configuration.

Parameters:
  • schedule – The schedule to be compiled.

  • hardware_cfg – Hardware configuration, defines the compilation step from the pulse-level to a hardware backend.

Returns:

A collection containing the compiled backend configuration for each device.

Raises:

NotImplementedError – Thrown when using unsupported ZI Instruments.

_add_lo_config(channel: quantify_scheduler.backends.types.zhinst.Output, local_oscillators: Dict[str, quantify_scheduler.backends.types.common.LocalOscillator], resources: Dict[str, quantify_scheduler.resources.Resource], device_configs: Dict[str, Union[ZIDeviceConfig, float]]) None[source]

Adds configuration for a local oscillator required for a specific output channel to the device configs.

_add_wave_nodes(device_type: quantify_scheduler.backends.types.zhinst.DeviceType, awg_index: int, wf_id_mapping: Dict[str, int], numerical_wf_dict: Dict[str, numpy.ndarray], settings_builder: quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder) quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder[source]
_compile_for_hdawg(device: quantify_scheduler.backends.types.zhinst.Device, timing_table: pandas.DataFrame, numerical_wf_dict: Dict[str, numpy.ndarray], repetitions: int) quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder[source]
Parameters:
  • device

  • timing_table

  • numerical_wf_dict

  • repetitions

Raises:

ValueError

_assemble_hdawg_sequence(instructions: List[quantify_scheduler.backends.types.zhinst.Instruction], wf_id_mapping: Dict[str, int], numerical_wf_dict: Dict[str, numpy.ndarray], repetitions: int, schedule_duration: float, markers: Union[str, int, None] = None, trigger: int = None) Tuple[str, str][source]
_compile_for_uhfqa(device: quantify_scheduler.backends.types.zhinst.Device, timing_table: pandas.DataFrame, numerical_wf_dict: Dict[str, numpy.ndarray], repetitions: int, operations: Dict[str, quantify_scheduler.operations.operation.Operation], bin_mode: quantify_scheduler.enums.BinMode) Tuple[quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder, ZIAcquisitionConfig][source]

Initialize programming the UHFQA ZI Instrument.

Creates a sequence program and converts schedule pulses to waveforms for the UHFQA.

Parameters:
  • device

  • timing_table

  • numerical_wf_dict

  • repetitions

  • operations

_assemble_uhfqa_sequence(instructions: List[quantify_scheduler.backends.types.zhinst.Instruction], wf_id_mapping: Dict[str, int], repetitions: int, device_name: str, trigger: int = 2) str[source]
construct_waveform_table(timing_table: pandas.DataFrame, operations_dict: Dict[str, quantify_scheduler.operations.operation.Operation], device_dict: Dict[str, quantify_scheduler.backends.types.zhinst.Device]) Dict[str, numpy.ndarray][source]

Iterates over all unique waveforms in a timing_table dataframe to calculate the numerical waveforms.

Parameters:
  • timing_table – A timing table for which the waveform_id has been determined

  • operations_dict – The Operations contained in a Schedule.

  • device_dict – A dictionary containing the Device objects describing the devicesin the hardware configuration.

Returns:

numerical_waveform dict, a dictionary containing the complex valued waveforms that will be uploaded to the control hardware.