quantify_scheduler

Import alias

Maps to

quantify_scheduler.schedules.schedule.Schedule

Schedule

quantify_scheduler.operations.operation.Operation

Operation

quantify_scheduler.schedules.schedule.CompiledSchedule

CompiledSchedule

quantify_scheduler.Resource

Resource

backends

qblox

qblox_backend

Compiler backend for Qblox hardware.

generate_port_clock_to_device_map(mapping)[source]

Generates a mapping which specifies which port-clock combinations belong to which device.

Note

The same device may contain multiple port-clock combinations, but each port-clock combination may only occur once.

Parameters

mapping ({str: Any}Dict[str, Any]) – The hardware mapping config.

Return type

{Tuple[str, str]: str}Dict[Tuple[str, str], str]

Returns

A dictionary with as key a tuple representing a port-clock combination, and as value the name of the device. Note that multiple port-clocks may point to the same device.

hardware_compile(schedule, hardware_cfg)[source]

Main function driving the compilation. The principle behind the overall compilation works as follows:

For every instrument in the hardware configuration, we instantiate a compiler object. Then we assign all the pulses/acquisitions that need to be played by that instrument to the compiler, which then compiles for each instrument individually.

This function then returns all the compiled programs bundled together in a dictionary with the QCoDeS name of the instrument as key.

Parameters
  • schedule (ScheduleSchedule) – The schedule to compile. It is assumed the pulse and acquisition info is already added to the operation. Otherwise and exception is raised.

  • hardware_cfg ({str: Any}Dict[str, Any]) – The hardware configuration of the setup.

Return type

CompiledScheduleCompiledSchedule

Returns

The compiled schedule.

compiler_abc

Compiler base and utility classes for Qblox backend.

class ControlDeviceCompiler(parent, name, total_play_time, hw_mapping)[source]

Abstract class for any device requiring logic for acquisition and playback of pulses.

__init__(parent, name, total_play_time, hw_mapping)[source]

Constructor for a ControlDeviceCompiler object.

Parameters
  • parent (CompilerContainer) – Reference to the parent object.

  • name (strstr) – Name of the QCoDeS instrument this compiler object corresponds to.

  • total_play_time (floatfloat) – Total time execution of the schedule should go on for. This parameter is used to ensure that the different devices, potentially with different clock rates, can work in a synchronized way when performing multiple executions of the schedule.

  • hw_mapping ({str: Any}Dict[str, Any]) – The hardware configuration dictionary for this specific device. This is one of the inner dictionaries of the overall hardware config.

add_acquisition(port, clock, acq_info)[source]

Assigns a certain acquisition to this device.

Parameters
  • port (strstr) – The port the pulse needs to be sent to.

  • clock (strstr) – The clock for modulation of the pulse. Can be a BasebandClock.

  • acq_info (OpInfoOpInfo) – Data structure containing all the information regarding this specific acquisition operation.

add_pulse(port, clock, pulse_info)[source]

Assigns a certain pulse to this device.

Parameters
  • port (strstr) – The port the pulse needs to be sent to.

  • clock (strstr) – The clock for modulation of the pulse. Can be a BasebandClock.

  • pulse_info (OpInfoOpInfo) – Data structure containing all the information regarding this specific pulse operation.

abstract compile(repetitions=1)[source]

An abstract method that should be overridden by a subclass to implement the actual compilation. Method turns the pulses and acquisitions added to the device into device-specific instructions.

Parameters

repetitions (intint (default: 1)) – Number of times execution the schedule is repeated.

Return type

{str: Any}Dict[str, Any]

Returns

A data structure representing the compiled program.

property portclocks_with_data

All the port-clock combinations associated with at least one pulse and/or acquisition.

Return type

Set[Tuple[str, str]]Set[Tuple[str, str]]

Returns

A set containing all the port-clock combinations that are used by this InstrumentCompiler.

abstract property supports_acquisition

Specifies whether the device can perform acquisitions.

Return type

boolbool

Returns

The maximum amount of sequencers

class InstrumentCompiler(parent, name, total_play_time, hw_mapping=None)[source]

Abstract base class that defines a generic instrument compiler. The subclasses that inherit from this are meant to implement the compilation steps needed to compile the lists of quantify_scheduler.backends.types.qblox.OpInfo representing the pulse and acquisition information to device-specific instructions.

Each device that needs to be part of the compilation process requires an associated InstrumentCompiler.

__init__(parent, name, total_play_time, hw_mapping=None)[source]

Constructor for an InstrumentCompiler object.

Parameters
  • parent (CompilerContainer) – Reference to the parent object.

  • name (strstr) – Name of the QCoDeS instrument this compiler object corresponds to.

  • total_play_time (floatfloat) – Total time execution of the schedule should go on for. This parameter is used to ensure that the different devices, potentially with different clock rates, can work in a synchronized way when performing multiple executions of the schedule.

  • hw_mapping ({str: Any} | NoneOptional[Dict[str, Any]] (default: None)) – The hardware configuration dictionary for this specific device. This is one of the inner dictionaries of the overall hardware config.

abstract compile(repetitions)[source]

An abstract method that should be overridden in a subclass to implement the actual compilation. It should turn the pulses and acquisitions added to the device into device-specific instructions.

Parameters

repetitions (intint) – Number of times execution of the schedule is repeated.

Return type

AnyAny

Returns

A data structure representing the compiled program. The type is dependent on implementation.

prepare()[source]

Method that can be overridden to implement logic before the main compilation starts. This step is to extract all settings for the devices that are dependent on settings of other devices. This step happens after instantiation of the compiler object but before the start of the main compilation.

Return type

NoneNone

class QbloxBaseModule(parent, name, total_play_time, hw_mapping)[source]

Qblox specific implementation of quantify_scheduler.backends.qblox.compiler_abc.InstrumentCompiler.

This class is defined as an abstract base class since the distinctions between the different devices are defined in subclasses. Effectively, this base class contains the functionality shared by all Qblox devices and serves to avoid repeated code between them.

__init__(parent, name, total_play_time, hw_mapping)[source]

Constructor function.

Parameters
  • parent (quantify_scheduler.backends.qblox.compiler_container.CompilerContainer) – Reference to the parent object.

  • name (strstr) – Name of the QCoDeS instrument this compiler object corresponds to.

  • total_play_time (floatfloat) – Total time execution of the schedule should go on for. This parameter is used to ensure that the different devices, potentially with different clock rates, can work in a synchronized way when performing multiple executions of the schedule.

  • hw_mapping ({str: Any}Dict[str, Any]) – The hardware configuration dictionary for this specific device. This is one of the inner dictionaries of the overall hardware config.

abstract assign_frequencies(sequencer)[source]

An abstract method that should be overridden. Meant to assign an IF frequency to each sequencer, or an LO frequency to each output (if applicable). For each sequencer, the following relation is obeyed: \(f_{RF} = f_{LO} + f_{IF}\).

In this step it is thus expected that either the IF and/or the LO frequency has been set during instantiation. Otherwise an error is thrown. If the frequency is overconstraint (i.e. multiple values are somehow specified) an error is thrown during assignment.

Raises

ValueError – Neither the LO nor the IF frequency has been set and thus contain None values.

compile(repetitions=1)[source]

Performs the actual compilation steps for this pulsar, by calling the sequencer level compilation functions and combining them into a single dictionary. The compiled program has a settings key, and keys for every sequencer.

Parameters

repetitions (intint (default: 1)) – Number of times execution the schedule is repeated.

Return type

{str: Any} | NoneOptional[Dict[str, Any]]

Returns

The compiled program corresponding to this pulsar. It contains an entry for every sequencer and general “settings”. If the device is not actually used, and an empty program is compiled, None is returned instead.

distribute_data()[source]

Distributes the pulses and acquisitions assigned to this pulsar over the different sequencers based on their portclocks. Raises an exception in case the device does not support acquisitions.

prepare()[source]

Performs the logic needed before being able to start the compilation. In effect, this means assigning the pulses and acquisitions to the sequencers and calculating the relevant frequencies in case an external local oscillator is used.

Return type

NoneNone

abstract update_settings()[source]

Updates the settings to set all parameters that are determined by the compiler.

is_pulsar: bool

Specifies if it is a standalone Pulsar or a cluster module. To be overridden by the cluster compiler if needed.

property portclocks

Returns all the port and clocks available to this device.

Return type

List[Tuple[str, str]]List[Tuple[str, str]]

abstract property settings_type

Specifies the PulsarSettings class used by the instrument.

Return type

PulsarSettingsPulsarSettings

abstract property static_hw_properties

The static properties of the hardware. This effectively gathers all the differences between the different modules.

Return type

StaticHardwarePropertiesStaticHardwareProperties

class QbloxBasebandModule(parent, name, total_play_time, hw_mapping)[source]

Abstract class with all the shared functionality between the QRM and QCM baseband modules.

assign_frequencies(sequencer)[source]

Meant to assign an IF frequency to each sequencer, or an LO frequency to each output (if applicable). For each sequencer, the following relation is obeyed: \(f_{RF} = f_{LO} + f_{IF}\).

In this step it is thus expected that either the IF and/or the LO frequency has been set during instantiation. Otherwise an error is thrown. If the frequency is overconstraint (i.e. multiple values are somehow specified) an error is thrown during assignment.

Raises

ValueError – Neither the LO nor the IF frequency has been set and thus contain None values.

update_settings()[source]

Updates the settings to set all parameters that are determined by the compiler.

property settings_type

The settings type used by baseband-type devices.

Return type

typetype

class QbloxRFModule(parent, name, total_play_time, hw_mapping)[source]

Abstract class with all the shared functionality between the QRM-RF and QCM-RF modules.

assign_frequencies(sequencer)[source]

Meant to assign an IF frequency to each sequencer, or an LO frequency to each output (if applicable). For each sequencer, the following relation is obeyed: \(f_{RF} = f_{LO} + f_{IF}\).

In this step it is thus expected that either the IF and/or the LO frequency has been set during instantiation. Otherwise an error is thrown. If the frequency is overconstraint (i.e. multiple values are somehow specified) an error is thrown during assignment.

Raises

ValueError – Neither the LO nor the IF frequency has been set and thus contain None values.

update_settings()[source]

Updates the settings to set all parameters that are determined by the compiler.

property settings_type

The settings type used by RF-type devices

Return type

typetype

class Sequencer(parent, name, portclock, static_hw_properties, connected_outputs, seq_settings, lo_name=None, downconverter=False)[source]

Class that performs the compilation steps on the sequencer level.

__init__(parent, name, portclock, static_hw_properties, connected_outputs, seq_settings, lo_name=None, downconverter=False)[source]

Constructor for the sequencer compiler.

Parameters
  • parent (QbloxBaseModuleQbloxBaseModule) – A reference to the parent instrument this sequencer belongs to.

  • name (strstr) – Name of the sequencer. This is supposed to match "seq{index}".

  • portclock (Tuple[str, str]Tuple[str, str]) – Tuple that specifies the unique port and clock combination for this sequencer. The first value is the port, second is the clock.

  • seq_settings (dictdict) – Sequencer settings dictionary.

  • lo_name (str | NoneOptional[str] (default: None)) – The name of the local oscillator instrument connected to the same output via an IQ mixer. This is used for frequency calculations.

  • downconverter (boolbool (default: False)) – Boolean which expresses whether a downconverter is being used or not. Defaults to False, in case case no downconverter is being used.

apply_output_mode_to_data(pulse, data, mode)[source]

Takes the pulse and ensures it is played on the right path for "real" or "imag" mode, returns same data for mode == "complex" as this should be handled correctly already.

Effectively this means that when data is an array of real numbers and the mode == "imag" the data will be cast to an array of complex numbers, otherwise the same data will be returned.

Parameters
  • pulse (OpInfoOpInfo) – The pulse information.

  • data (ndarrayndarray) – Real-valued array (when mode != "complex") or complex-valued array (when mode == "complex").

  • mode ({‘complex’, ‘real’, ‘imag’}Literal[‘complex’, ‘real’, ‘imag’]) – The output mode. Must be one of "complex", "real" or "imag".

Return type

ndarrayndarray

Returns

The (potentially made imag) data.

Raises

ValueError – Mode is not "complex" but the input data has an imaginary part.

compile(repetitions=1)[source]

Performs the full sequencer level compilation based on the assigned data and settings. If no data is assigned to this sequencer, the compilation is skipped and None is returned instead.

Parameters

repetitions (intint (default: 1)) – Number of times execution the schedule is repeated.

Return type

{str: Any} | NoneOptional[Dict[str, Any]]

Returns

The compiled program. If no data is assigned to this sequencer, the compilation is skipped and None is returned instead.

generate_qasm_program(total_sequence_time, awg_dict=None, weights_dict=None, repetitions=1)[source]

Generates a QASM program for a sequencer. Requires the awg and acq dicts to already have been generated.

Example of a program generated by this function:

        wait_sync     4
        set_mrk       1
        move          10,R0         # iterator for loop with label start
start:
        wait          4
        set_awg_gain  22663,10206  # setting gain for 9056793381316377208
        play          0,1,4
        wait          176
        loop          R0,@start
        set_mrk       0
        upd_param     4
        stop
Parameters
  • total_sequence_time (floatfloat) – Total time the program needs to play for. If the sequencer would be done before this time, a wait is added at the end to ensure synchronization.

  • awg_dict ({str: Any} | NoneOptional[Dict[str, Any]] (default: None)) – Dictionary containing the pulse waveform data and the index that is assigned to the I and Q waveforms, as generated by the generate_awg_dict function. This is used to extract the relevant indexes when adding a play instruction.

  • weights_dict ({str: Any} | NoneOptional[Dict[str, Any]] (default: None)) – Dictionary containing the acquisition waveform data and the index that is assigned to the I and Q waveforms, as generated by the generate_acq_dict function. This is used to extract the relevant indexes when adding an acquire instruction.

  • repetitions (int | NoneOptional[int] (default: 1)) – Number of times to repeat execution of the schedule.

Return type

strstr

Returns

The generated QASM program.

static get_indices_from_wf_dict(uuid, wf_dict)[source]

Takes a waveforms_dict or weights_dict and extracts the waveform indices based off of the uuid of the pulse/acquisition.

Parameters
  • uuid (strstr) – The unique identifier of the pulse/acquisition.

  • wf_dict ({str: Any}Dict[str, Any]) – The awg or acq dict that holds the waveform data and indices.

Return type

Tuple[int, int]Tuple[int, int]

Returns

  • Index of the I waveform.

  • Index of the Q waveform.

update_settings()[source]

Updates the sequencer settings to set all parameters that are determined by the compiler.

property connected_outputs

The indices of the output paths that this sequencer is producing awg data for.

For the baseband modules, these indices correspond directly to a physical output (e.g. index 0 corresponds to output 1 etc.).

For the RF modules, indexes 0 and 1 correspond to path0 and path1 of output 1, respectively, while indexes 2 and 3 correspond to path0 and path1 of output 2.

Return type

Tuple[int] | Tuple[int, int]Union[Tuple[int], Tuple[int, int]]

property frequency

The frequency used for modulation of the pulses.

Return type

floatfloat

Returns

The frequency.

property has_data

Whether or not the sequencer has any data (meaning pulses or acquisitions) assigned to it or not.

Return type

boolbool

Returns

Has data been assigned to this sequencer?

property name

The name assigned to this specific sequencer.

Return type

strstr

Returns

The name.

property output_mode

Specifies whether the sequencer is using only path0 (real), path1 (imag) or both (complex).

If real or imag, the sequencer is restricted to only using real valued data.

Return type

{‘complex’, ‘real’, ‘imag’}Literal[‘complex’, ‘real’, ‘imag’]

property portclock

A tuple containing the unique port and clock combination for this sequencer.

Return type

Tuple[str, str]Tuple[str, str]

Returns

The portclock.

property settings

Gives the current settings.

Return type

SequencerSettingsSequencerSettings

Returns

The settings set to this sequencer.

compiler_container

Contains the compiler container class.

class CompilerContainer(schedule)[source]

Container class that holds all the compiler objects for the individual instruments.

This class serves to allow all the possible compilation steps that involve multiple devices at the same time, such as calculating the modulation frequency for a device with a separate local oscillator from a clock that is defined at the schedule level.

It is recommended to construct this object using the from_mapping factory method.

__init__(schedule)[source]

Constructor for the instrument container.

Parameters

schedule (ScheduleSchedule) – The schedule to be compiled.

add_instrument_compiler(name, instrument, mapping)[source]

Adds an instrument compiler to the container.

Parameters
  • name (strstr) – Name of the instrument.

  • instrument (str | typeUnion[str, type]) – A reference to the compiler class. Can either be passed as string or a direct reference.

  • mapping ({str: Any}Dict[str, Any]) – The hardware mapping dict for this specific instrument.

Return type

NoneNone

compile(repetitions)[source]

Performs the compilation for all the individual instruments.

Parameters

repetitions (intint) – Amount of times to perform execution of the schedule.

Return type

{str: Any}Dict[str, Any]

Returns

Dictionary containing all the compiled programs for each instrument. The key refers to the name of the instrument that the program belongs to.

classmethod from_mapping(schedule, mapping)[source]

Factory method for the CompilerContainer. This is the preferred way to use the CompilerContainer class.

Parameters
Return type

CompilerContainerCompilerContainer

instrument_compilers

The compilers for the individual instruments.

resources

The resources attribute of the schedule. Used for getting the information from the clocks.

total_play_time

The total duration of the schedule in absolute time this class will be compiling.

constants

Constants for compilation to Qblox hardware.

DOWNCONVERTER_FREQ: float = 4400000000.0

LO frequency used by the Qblox downconverter.

GRID_TIME = 4

Clock period of the sequencers. All time intervals used must be multiples of this value.

IMMEDIATE_SZ_GAIN = 65535

Size of gain instruction immediates in Q1ASM programs.

IMMEDIATE_SZ_OFFSET = 65535

Size of offset instruction immediates in Q1ASM programs.

IMMEDIATE_SZ_WAIT = 65535

Size of wait instruction immediates in Q1ASM programs.

MAX_MIXER_AMP_RATIO = 2.0

Highest value the amplitude correction can be set to. N.B. This correction is defined as Q/I.

MAX_MIXER_PHASE_ERROR_DEG = 45

Lowest phase shift that can be configured in the instruments for mixer corrections.

MIN_MIXER_AMP_RATIO = 0.5

Lowest value the amplitude correction can be set to. N.B. This correction is defined as Q/I.

MIN_MIXER_PHASE_ERROR_DEG = -45

Lowest phase shift that can be configured in the instruments for mixer corrections.

MIN_TIME_BETWEEN_ACQUISITIONS = 1000

Minimum time between two acquisitions to prevent FIFO errors.

NUMBER_OF_REGISTERS: int = 64

Number of registers available in the Qblox sequencers.

NUMBER_OF_SEQUENCERS_QCM = 6

Number of sequencers supported by a QCM in the latest firmware.

NUMBER_OF_SEQUENCERS_QRM = 6

Number of sequencers supported by a QRM in the latest firmware.

PULSE_STITCHING_DURATION = 1e-06

Duration of the individual pulses when pulse stitching is used.

REGISTER_SIZE = 4294967295

Size of registers in Q1ASM programs.

SAMPLING_RATE = 1000000000

Sampling rate of the Qblox control/readout instruments.

helpers

Helper functions for Qblox backend.

find_all_port_clock_combinations(d)[source]

Generates a list with all port and clock combinations found in a dictionary with nested structures. Traversing the dictionary is done using the find_inner_dicts_containing_key function.

Parameters

d (dictdict) – The dictionary to traverse.

Return type

List[Tuple[str, str]]List[Tuple[str, str]]

Returns

A list containing tuples representing the port and clock combinations found in the dictionary.

find_inner_dicts_containing_key(d, key)[source]

Generates a list of the first dictionaries encountered that contain a certain key, in a complicated dictionary with nested dictionaries or Iterables.

This is achieved by recursively traversing the nested structures until the key is found, which is then appended to a list.

Parameters
  • d (dictdict) – The dictionary to traverse.

  • key (AnyAny) – The key to search for.

Return type

List[dict]List[dict]

Returns

A list containing all the inner dictionaries containing the specified key.

generate_uuid_from_wf_data(wf_data, decimals=12)[source]

Creates a unique identifier from the waveform data, using a hash. Identical arrays yield identical strings within the same process.

Parameters
  • wf_data (ndarrayndarray) – The data to generate the unique id for.

  • decimals (intint (default: 12)) – The number of decimal places to consider.

Return type

strstr

Returns

A unique identifier.

generate_waveform_data(data_dict, sampling_rate)[source]

Generates an array using the parameters specified in data_dict.

Parameters
  • data_dict (dictdict) – The dictionary that contains the values needed to parameterize the waveform. data_dict[‘wf_func’] is then called to calculate the values.

  • sampling_rate (floatfloat) – The sampling rate used to generate the time axis values.

Return type

ndarrayndarray

Returns

The (possibly complex) values of the generated waveform.

generate_waveform_dict(waveforms_complex)[source]

Takes a dictionary with complex waveforms and generates a new dictionary with real valued waveforms with a unique index, as required by the hardware.

Parameters

waveforms_complex ({str: ndarray}Dict[str, ndarray]) – Dictionary containing the complex waveforms. Keys correspond to a unique identifier, value is the complex waveform.

Return type

{str: dict}Dict[str, dict]

Returns

  • A dictionary with as key the unique name for that waveform, as value another dictionary containing the real-valued data (list) as well as a unique index. Note that the index of the Q waveform is always the index of the I waveform +1.

  • .. admonition:: Examples

    import numpy as np
    from quantify_scheduler.backends.qblox.helpers import generate_waveform_dict
    
    complex_waveforms = {12345: np.array([1, 2])}
    generate_waveform_dict(complex_waveforms)
    
    # {'12345_I': {'data': [1, 2], 'index': 0},
    # '12345_Q': {'data': [0, 0], 'index': 1}}
    
    {'12345_I': {'data': [1, 2], 'index': 0},
     '12345_Q': {'data': [0, 0], 'index': 1}}
    

generate_waveform_names_from_uuid(uuid)[source]

Generates names for the I and Q parts of the complex waveform based on a unique identifier for the pulse/acquisition.

Parameters

uuid (AnyAny) – A unique identifier for a pulse/acquisition.

Return type

Tuple[str, str]Tuple[str, str]

Returns

  • uuid_I – Name for the I waveform.

  • uuid_Q – Name for the Q waveform.

is_multiple_of_grid_time(time, grid_time_ns=4)[source]

Takes a time in seconds and converts it to the ns grid time that the Qblox hardware expects.

Parameters
  • time (floatfloat) – A time in seconds.

  • grid_time_ns (intint (default: 4)) – A grid time in ns.

Return type

boolbool

Returns

If it the time is a multiple of the grid time.

output_mode_from_outputs(outputs)[source]

Takes the specified outputs to use and extracts a “sequencer mode” from it.

Modes:

  • "real": only path0 is used

  • "imag": only path1 is used

  • "complex": both path0 and path1 paths are used.

Parameters

outputs (Tuple[int] | Tuple[int, int]Union[Tuple[int], Tuple[int, int]]) – The outputs the sequencer is supposed to use. Note that the outputs start from 0, but the labels on the front panel start counting from 1. So the mapping differs n-1.

Return type

{‘complex’, ‘real’, ‘imag’}Literal[‘complex’, ‘real’, ‘imag’]

Returns

The mode

Raises

RuntimeError – The amount of outputs is more than 2, which is impossible for one sequencer.

output_name_to_outputs(name)[source]

Finds the output path index associated with the output names specified in the config.

For the baseband modules, these indices correspond directly to a physical output ( e.g. index 0 corresponds to output 1 etc.).

For the RF modules, index 0 and 2 correspond to path0 of output 1 and output 2 respectively, and 1 and 3 to path1 of those outputs.

Parameters

name (strstr) – name of the output channel. e.g. ‘complex_output_0’.

Return type

Tuple[int] | Tuple[int, int]Union[Tuple[int], Tuple[int, int]]

Returns

A tuple containing the indices of the physical (real) outputs.

to_grid_time(time, grid_time_ns=4)[source]

Takes a float value representing a time in seconds as used by the schedule, and returns the integer valued time in nanoseconds that the sequencer uses.

Parameters
  • time (floatfloat) – The time to convert.

  • grid_time_ns (intint (default: 4)) – The grid time to use in ns.

Return type

intint

Returns

The integer valued nanosecond time.

instrument_compilers

Compiler classes for Qblox backend.

class Cluster(parent, name, total_play_time, hw_mapping)[source]

Compiler class for a Qblox cluster.

__init__(parent, name, total_play_time, hw_mapping)[source]

Constructor for a Cluster compiler object.

Parameters
  • parent (CompilerContainerCompilerContainer) – Reference to the parent object.

  • name (strstr) – Name of the QCoDeS instrument this compiler object corresponds to.

  • total_play_time (floatfloat) – Total time execution of the schedule should go on for.

  • hw_mapping ({str: Any}Dict[str, Any]) – The hardware configuration dictionary for this specific device. This is one of the inner dictionaries of the overall hardware config.

compile(repetitions=1)[source]

Performs the compilation.

Parameters

repetitions (intint (default: 1)) – Amount of times to repeat execution of the schedule.

Return type

{str: Any} | NoneOptional[Dict[str, Any]]

Returns

The part of the compiled instructions relevant for this instrument.

construct_instrument_compilers()[source]

Constructs the compilers for the modules inside the cluster.

Return type

{str: QbloxBaseModule}Dict[str, QbloxBaseModule]

Returns

A dictionary with the name of the instrument as key and the value its compiler.

distribute_data()[source]

Distributes the pulses and acquisitions assigned to the cluster over the individual module compilers.

Return type

NoneNone

prepare()[source]

Prepares the instrument compiler for compilation by assigning the data.

Return type

NoneNone

compiler_classes: Dict[str, type] = {'QCM': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QcmModule'>, 'QCM_RF': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QcmRfModule'>, 'QRM': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QrmModule'>, 'QRM_RF': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QrmRfModule'>}

References to the individual module compiler classes that can be used by the cluster.

supports_acquisition: bool = True

Specifies that the Cluster supports performing acquisitions.

class LocalOscillator(parent, name, total_play_time, hw_mapping)[source]

Implementation of an InstrumentCompiler that compiles for a generic LO. The main difference between this class and the other compiler classes is that it doesn’t take pulses and acquisitions.

__init__(parent, name, total_play_time, hw_mapping)[source]

Constructor for a local oscillator compiler.

Parameters
  • parent (CompilerContainerCompilerContainer) – Reference to the parent container object.

  • name (strstr) – QCoDeS name of the device it compiles for.

  • total_play_time (floatfloat) – Total time execution of the schedule should go on for. This parameter is used to ensure that the different devices, potentially with different clock rates, can work in a synchronized way when performing multiple executions of the schedule.

  • hw_mapping ({str: Any}Dict[str, Any]) – The hardware mapping dict for this instrument.

compile(repetitions=1)[source]

Compiles the program for the LO InstrumentCoordinator component.

Parameters

repetitions (intint (default: 1)) – Number of times execution the schedule is repeated.

Return type

{str: Any} | NoneOptional[Dict[str, Any]]

Returns

Dictionary containing all the information the InstrumentCoordinator component needs to set the parameters appropriately.

property frequency

Getter for the frequency.

Return type

floatfloat

Returns

The current frequency.

class QcmModule(parent, name, total_play_time, hw_mapping)[source]

QCM specific implementation of the qblox compiler.

class QcmRfModule(parent, name, total_play_time, hw_mapping)[source]

QCM-RF specific implementation of the qblox compiler.

class QrmModule(parent, name, total_play_time, hw_mapping)[source]

QRM specific implementation of the qblox compiler.

class QrmRfModule(parent, name, total_play_time, hw_mapping)[source]

QRM-RF specific implementation of the qblox compiler.

COMPILER_MAPPING: Dict[str, type] = {'Cluster': <class 'quantify_scheduler.backends.qblox.instrument_compilers.Cluster'>, 'LocalOscillator': <class 'quantify_scheduler.backends.qblox.instrument_compilers.LocalOscillator'>, 'Pulsar_QCM': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QcmModule'>, 'Pulsar_QCM_RF': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QcmRfModule'>, 'Pulsar_QRM': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QrmModule'>, 'Pulsar_QRM_RF': <class 'quantify_scheduler.backends.qblox.instrument_compilers.QrmRfModule'>}

Maps the names in the hardware config to their appropriate compiler classes.

non_generic

Module for handling special pulses that get special treatment in the backend.

check_reserved_pulse_id(pulse)[source]

Checks whether the function should be evaluated generically or has special treatment.

Parameters

pulse (OpInfoOpInfo) – The pulse to check.

Return type

str | NoneOptional[str]

Returns

A str with a special identifier representing which pulse behavior to use

generate_reserved_waveform_data(reserved_pulse_id, data_dict, sampling_rate)[source]

Generates the waveform data for the pulses that get special treatment.

Parameters
  • reserved_pulse_id (strstr) – The id returned by check_reserved_pulse_id.

  • data_dict (dictdict) – The pulse.data dict.

  • sampling_rate (floatfloat) – Sampling rate of the device.

Return type

ndarrayndarray

q1asm_instructions

Module that holds all the string literals that are valid instructions that can be executed by the sequencer in Qblox hardware.

qasm_program

QASM program class for Qblox backend.

class QASMProgram(parent)[source]

Class that holds the compiled Q1ASM program that is to be executed by the sequencer.

Apart from this the class holds some convenience functions that auto generate certain instructions with parameters, as well as update the elapsed time.

auto_acquire(acquisition, idx0, idx1)[source]

Automatically adds an acquisition. Keeps track of the time since the last acquisition was started to prevent FIFO errors.

Parameters
  • acquisition (OpInfoOpInfo) – The acquisition to start.

  • idx0 (intint) – Index of the waveform in the weights dict to use as weights for path0.

  • idx1 (intint) – Index of the waveform in the weights dict to use as weights for path1.

Return type

NoneNone

auto_play_pulse(pulse, idx0, idx1)[source]

Generates the instructions to play a pulse and updates the timing. Automatically takes care of custom pulse behavior.

Parameters
  • pulse (OpInfoOpInfo) – The pulse to play.

  • idx0 (intint) – Index in the waveforms_dict corresponding to the waveform for the I channel.

  • idx1 (intint) – Index in the waveforms_dict corresponding to the waveform for the Q channel.

Return type

NoneNone

auto_wait(wait_time)[source]

Automatically emits a correct wait command. If the wait time is longer than allowed by the sequencer it correctly breaks it up into multiple wait instructions. If the number of wait instructions is too high (>4), a loop will be used.

Parameters

wait_time (intint) – Time to wait in ns.

Raises

ValueError – If wait_time <= 0.

Return type

NoneNone

emit(*args, **kwargs)[source]

Wrapper around the get_instruction_as_list which adds it to this program.

Parameters
  • args – All arguments to pass to get_instruction_as_list.

  • **kwargs – All keyword arguments to pass to get_instruction_as_list.

Return type

NoneNone

static get_instruction_as_list(instruction, *args, label=None, comment=None)[source]

Takes an instruction with arguments, label and comment and turns it into the list required by the class.

Parameters
  • instruction (strstr) – The instruction to use. This should be one specified in PulsarInstructions or the assembler will raise an exception.

  • args (int | strUnion[int, str]) – Arguments to be passed.

  • label (str | NoneOptional[str] (default: None)) – Adds a label to the line. Used for jumps and loops.

  • comment (str | NoneOptional[str] (default: None)) – Optionally add a comment to the instruction.

Return type

List[Union[str, int]]List[Union[str, int]]

Returns

List that contains all the passed information in the valid format for the program.

Raises

SyntaxError – More arguments passed than the sequencer allows.

loop(label, repetitions=1)[source]

Defines a context manager that can be used to generate a loop in the QASM program.

Parameters
  • register – The register to use for the loop iterator.

  • label (strstr) – The label to use for the jump.

  • repetitions (intint (default: 1)) – The amount of iterations to perform.

Examples

This adds a loop to the program that loops 10 times over a wait of 100 ns.

import inspect, json
from quantify_scheduler import Schedule
from quantify_scheduler.backends.qblox.qasm_program import QASMProgram
from quantify_scheduler.schemas.examples import utils
from quantify_scheduler.backends.qblox import (
    instrument_compilers, compiler_container
)

HARDWARE_MAPPING = utils.load_json_example_scheme(
    "qblox_test_mapping.json"
)

sched = Schedule("example")
container = compiler_container.CompilerContainer(sched)
qcm = instrument_compilers.QcmModule(
    container,
    "qcm0",
    total_play_time=10,
    hw_mapping=HARDWARE_MAPPING["qcm0"]
)
qasm = QASMProgram(qcm.sequencers["seq0"])

with qasm.loop(label='repeat', repetitions=10):
    qasm.auto_wait(100)

qasm.instructions
[['', 'move', '10,R0', '# iterator for loop with label repeat'],
 ['repeat:', '', '', ''],
 ['', 'wait', '100', ''],
 ['', 'loop', 'R0,@repeat', '']]
play_staircase(pulse, idx0, idx1)[source]

Generates a staircase through offset instructions.

Parameters
Return type

NoneNone

play_stitched_pulse(pulse, idx0, idx1)[source]

Stitches multiple square pulses together to form one long square pulse.

Parameters
  • pulse (OpInfoOpInfo) – The pulse to play.

  • idx0 (intint) – Index in the waveforms_dict corresponding to the waveform for the I channel.

  • idx1 (intint) – Index in the waveforms_dict corresponding to the waveform for the Q channel.

Return type

NoneNone

set_marker(marker_setting='0000')[source]

Sets the marker from a string representing a binary number. Each digit corresponds to a marker e.g. ‘0010’ sets the second marker to True.

Parameters

marker_setting (str | intUnion[str, int] (default: '0000')) – The string representing a binary number.

Return type

NoneNone

temp_register(amount=1)[source]

Context manager for using a register temporarily. Frees up the register afterwards.

Parameters

amount (intint (default: 1)) – The amount of registers to temporarily use.

Yields

Either a single register or a list of registers.

Return type

List[str] | strUnion[List[str], str]

update_runtime_settings(operation)[source]

Adds the commands needed to correctly set the QASMRuntimeSettings.

Parameters

operation (OpInfoOpInfo) – The pulse to prepare the settings for.

Notes

Currently only the AWG gain is set correctly, as that is the only one actually used currently by the backend. Will be expanded in the future.

wait_till_start_operation(operation)[source]

Waits until the start of a pulse or acquisition.

Parameters

operation (OpInfoOpInfo) – The pulse or acquisition that we want to wait for.

Raises

ValueError – If wait time < 0.

Return type

NoneNone

wait_till_start_then_acquire(acquisition, idx0, idx1)[source]

Waits until the start of the acquisition, then starts the acquisition.

Parameters
  • acquisition (OpInfoOpInfo) – The pulse to perform.

  • idx0 (intint) – Index corresponding to the I channel of the acquisition weights in the acq dict.

  • idx1 (intint) – Index corresponding to the Q channel of the acquisition weights in the acq dict.

wait_till_start_then_play(pulse, idx0, idx1)[source]

Waits until the start of the pulse, sets the QASMRuntimeSettings and plays the pulse.

Parameters
  • pulse (OpInfoOpInfo) – The pulse to play.

  • idx0 (intint) – Index corresponding to the I channel of the pulse in the awg dict.

  • idx1 (intint) – Index corresponding to the Q channel of the pulse in the awg dict.

Return type

NoneNone

elapsed_time: int

The time elapsed after finishing the program in its current form. This is used to keep track of the overall timing and necessary waits.

instructions: List[list]

A list containing the instructions added to the program. The instructions added are in turn a list of the instruction string with arguments.

parent

A reference to the sequencer for which we are compiling this program.

time_last_acquisition_triggered: Optional[int]

Time on which the last acquisition was triggered. Is None if no previous acquisition was triggered.

zhinst

zhinst_backend

Backend for Zurich Instruments.

class ZIAcquisitionConfig(n_acquisitions, resolvers)[source]

Zurich Instruments acquisition configuration.

Parameters
  • n_acquisitions (int) – the number of distinct acquisitions in this experiment.

  • resolvers (Dict[int, Callable]) – resolvers used to retrieve the results from the right UHFQA nodes. See also resolvers

class ZIDeviceConfig(name, settings_builder, acq_config)[source]

Zurich Instruments device configuration.

Parameters
apply_waveform_corrections(output, waveform, start_and_duration_in_seconds, instrument_info, is_pulse)[source]

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

Parameters
Return type

Tuple[int, int, ndarray]Tuple[int, int, ndarray]

Returns

compile_backend(schedule, hardware_cfg)[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 (ScheduleSchedule) – The schedule to be compiled.

  • hardware_cfg ({str: Any}Dict[str, Any]) – Hardware configuration, defines the compilation step from the pulse-level to a hardware backend.

Return type

CompiledScheduleCompiledSchedule

Returns

A collection containing the compiled backend configuration for each device.

Raises

NotImplementedError – Thrown when using unsupported ZI Instruments.

construct_waveform_table(timing_table, operations_dict, device_dict)[source]

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

Parameters
Return type

{str: ndarray}Dict[str, ndarray]

Returns

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

ensure_no_operations_overlap(timing_table)[source]

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

Parameters

timing_table (DataFrameDataFrame) – 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.

helpers

Helpers for Zurich Instruments.

get_directory(awg)[source]

Returns the LabOne directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type

PathPath

Returns

The path of this directory.

get_readout_channel_bitmask(readout_channels_count)[source]

Returns a bitmask to enable readout channels. The bitmask can be used to turn on QA for induvidual channels in startQAResult.

Parameters

readout_channels_count (intint) – The amount of readout channels to enable. Maximum readout channels for UHFQA is 10.

Return type

strstr

Returns

The channel bitmask.

get_sampling_rates(base_sampling_rate)[source]

Returns the allowed sampling rate values. See zhinst User manuals, section /DEV…./AWGS/n/TIME

Parameters

base_sampling_rate (floatfloat) – The Instruments base sampling rate.

Returns

The node value and corresponding sampling rate. e.g. {0: 2400000, 1:1200000, …} for the HDAWG.

Return type

Dict[int, int]

get_src_directory(awg)[source]

Returns the source directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type

PathPath

Returns

The path to the source directory.

get_value(instrument, node)[source]

Gets the value of a ZI node.

Parameters
Return type

strstr

Returns

The node value.

get_waveform_table(pulse_ids, pulseid_pulseinfo_dict)[source]

Returns a dictionary that contains the locations of pulses in the AWG waveform table.

Parameters
Return type

{int: int}Dict[int, int]

Returns

The waveform table dictionary.

get_waves_directory(awg)[source]

Returns the waves directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type

PathPath

Returns

The path to the waves directory.

set_and_compile_awg_seqc(instrument, awg_index, node, value)[source]

Uploads and compiles the AWG sequencer program.

Parameters
set_awg_value(instrument, awg_index, node, value)[source]

Sets the value of a AWG module node.

Parameters
Return type

NoneNone

set_commandtable_data(instrument, awg_index, json_data)[source]

Sets the commandtable JSON for an AWG.

Parameters
Return type

NoneNone

set_value(instrument, node, value)[source]

Sets the value of a ZI node.

Parameters
Return type

NoneNone

set_values(instrument, value)[source]

Sets the value of a ZI node.

Parameters
Return type

NoneNone

set_vector(instrument, node, value)[source]

Sets the vector value of a ZI node.

Parameters
Return type

NoneNone

set_wave_vector(instrument, awg_index, wave_index, vector)[source]

Sets the command table wave vector for an awg of an instrument.

Parameters
Return type

NoneNone

write_seqc_file(awg, contents, filename)[source]

Writes the contents of to the source directory of LabOne.

Parameters
  • awg (AWGAWG) – The HDAWG AWG instance.

  • contents (strstr) – The content to write.

  • filename (strstr) – The name of the file.

Return type

PathPath

Returns

Returns the path which was written.

resolvers

monitor_acquisition_resolver(uhfqa, monitor_nodes)[source]

Returns complex value of UHFQA Monitor nodes.

This acquisition resolver corresponds to measuring a time trace of the input on the I channel (input 1) and Q channel (input 2).

Parameters
Return type

ndarrayndarray

result_acquisition_resolver(uhfqa, result_nodes)[source]

Returns complex value of UHFQA Result nodes.

Note that it needs two nodes to return a complex valued result. For optimal weights one can ignore the imaginary part.

Parameters
Return type

ndarrayndarray

seqc_il_generator

class SeqcILGenerator[source]

The Intermediate Sequencer Language Generator.

This class acts a an assembler for the seqc programs which can be executed on the ZI AWG(s).

__init__()[source]

Creates a new instance of SeqcILGenerator.

assign_get_user_reg(name, index)[source]

Assign the getUserReg function to a variable by name with a specific index.

Parameters
  • name (strstr) – The variable name.

  • index (intint) – The register index.

Return type

NoneNone

assign_placeholder(name, size)[source]

Assign a placeholder to a variable by name with a specific size.

Parameters
  • name (strstr) – The variable name.

  • size (intint) – The size of the placeholder.

Return type

NoneNone

assign_var(name, value)[source]

Assign a value to a variable by name.

This method requires the variable to be declared before allowing a new value to be assigned to it.

Translates to: ` wave w0; wave w0 = "dev1234_awg0_0"; # <-- `

Parameters
Return type

NoneNone

declare_var(name, value=None)[source]

Creates a new variable of type var with a name and optionally its value.

Parameters
  • name (strstr) – The variable name.

  • value (Optional[str]) – The variable value. (optional)

Return type

NoneNone

declare_wave(name, value=None)[source]

Creates a new variable of type wave with a name and optionally its value.

Parameters
  • name (strstr) – The variable name.

  • value (str | NoneOptional[str] (default: None)) – The variable value. (optional)

Return type

NoneNone

emit_assign_wave_index(*args, index)[source]

Emit assignWaveIndex to the program which assigns a wave variable to an index in the waveform table (just like a pointer).

Parameters

index (intint) – The waveform table index.

Return type

NoneNone

emit_begin_repeat(repetitions=1)[source]

Emit repeat loop to the program.

Parameters

repetitions (int | strUnion[int, str] (default: 1)) – The repeat condition, by default 1

Return type

NoneNone

emit_begin_while(predicate='true')[source]

Emit while loop to the program.

Parameters

predicate (strstr (default: 'true')) – The while condition, by default “true”

Return type

NoneNone

emit_blankline()[source]

Emits a blank line to the program.

This is typically used to create a visual separation for readability.

Return type

NoneNone

emit_comment(text)[source]

Emit a comment to the program.

Parameters

text (strstr) –

Return type

NoneNone

emit_end_repeat()[source]

Emit ending the repeat loop.

Return type

NoneNone

emit_end_while()[source]

Emit ending the while loop.

Return type

NoneNone

emit_execute_table_entry(index, comment='')[source]

Emit executeTableEntry to the program. Executes a command table waveform.

::note executeTableEntry is not blocking so if you want to await the wave use waitWave directly after it.

Parameters

index (intint) – The wave index to execute.

Return type

NoneNone

emit_play_wave(*names, comment='')[source]

Emit playWave to the program.

Parameters
  • names (strstr) – The wave names to be played. This should refer to the wave variable name as defined in the seqc, or the wave index in the commandtable to be played.

  • comment (strstr (default: '')) – The inline comment to be emitted in the seqc.

Examples

An example for the use of the playWave instruction from the LabOne Programming Manual.

Ensure that the “wave_file” variable (the name argument) corresponds to a filename that was declared using the declareWave

//Definition inline with playWave
playWave("wave_file");
//Assign first to a wave data type, then use
wave w = "wave_file";
playWave(w)
Return type

NoneNone

emit_set_trigger(index, comment='')[source]

Emit setTrigger to the program.

Parameters

index (int | strUnion[int, str]) – The number or string of a trigger to set.

Return type

NoneNone

emit_start_qa(comment='')[source]

Starts the Quantum Analysis Result and Input units by setting and clearing appropriate AWG trigger output signals. The choice of whether to start one or the other or both units can be controlled using the command argument. An bitmask may be used to select explicitly which of the ten possible qubit results should be read. If no qubit results are enabled, then the Quantum Analysis Result unit will not be triggered. An optional value may be used to set the normal trigger outputs of the AWG together with starting the Quantum Analysis Result and input units. If the value is not used, then the trigger signals will be cleared.

Parameter

  • monitor: Enable for QA monitor, default: false

  • result_address: Set address associated with result, default: 0x0

  • trigger: Trigger value, default: 0x0

  • weighted_integrator_mask: Integration unit enable mask, default: QA_INT_ALL

Return type

NoneNone

emit_start_qa_monitor()[source]

Starts the Quantum Analysis Monitor unit by setting and clearing appropriate AWG trigger output signals.

Return type

NoneNone

emit_start_qa_result(bitmask=None, trigger=None)[source]

Starts the Quantum Analysis Result unit by setting and clearing appropriate AWG trigger output signals.

// Start Quantum Analysis Result unit for
// channel=1 on trigger=AWG_INTEGRATION_TRIGGER
startQAResult(0b0000000001, AWG_INTEGRATION_TRIGGER);

// Reset and clear triggers
startQAResult();
Parameters
  • bitmask (str | NoneOptional[str] (default: None)) – The bitmake to select explicitly which of the ten possible qubit results should be read, by default “”

  • trigger (str | NoneOptional[str] (default: None)) – The trigger to start the Quantum Analysis Result unit. If no trigger is specified it will clear the triggers, by default “”

Return type

NoneNone

emit_wait(cycles, comment='')[source]

Emits a wait instruction to the sequencer program.

Parameters

cycles (intint) – The number of cycles to wait.

Return type

NoneNone

emit_wait_dig_trigger(index=0, comment='')[source]

Emit waitDigTrigger to the program.

Parameters

index (intint (default: 0)) – The trigger to wait on, by default 0

Return type

NoneNone

emit_wait_wave(comment='')[source]

Emit waitWave to the program.

Return type

NoneNone

generate()[source]

Returns the generated seqc program.

This program can be run on ZI AWG(s).

Returns

The seqc program.

Return type

str

class SeqcInstructions(value)[source]

The sequencer enum type.

add_csv_waveform_variables(seqc_gen, device_serial, awg_index, commandtable_map)[source]

Adds wave variables in form of a CSV filename to the seqc file.

Parameters
add_execute_table_entry(seqc_gen, index, device_type, comment='')[source]

Adds an executeTableEntry instruction to seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

Raises

AttributeError – Raised when the DeviceType not equals HDAWG.

add_play_wave(seqc_gen, *variable, device_type, comment='')[source]

Adds a playWave instruction to the seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

add_set_trigger(seqc_gen, value, device_type, comment='')[source]

Adds a setTrigger instruction to the seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

add_start_qa(seqc_gen, device_type, comment='')[source]

Adds a startQA instruction to the seqc program. See emit_start_qa() for more details.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

add_wait(seqc_gen, delay, device_type, comment='')[source]

Add a wait instruction to the SeqcILGenerator with the specified delay.

Parameters
Returns

The number of clocks waited.

Return type

int

Raises

ValueError

declare_csv_waveform_variables(seqc_gen, device_name, waveform_indices, awg_index=0)[source]

Declares waveforms and links them to filenames of .csv files.

e.g. wave w0 = `uhfqa1234_awg0_wave0

settings

Settings builder for Zurich Instruments.

class ZISerializeSettings(name, _serial, _type)[source]

Serialization data container to decouple filenames from instrument names during the serialization.

class ZISetting(node, value, apply_fn)[source]

Zurich Instruments Settings record type.

apply(instrument)[source]

Applies settings to the Instrument.

Parameters

instrument (ZIBaseInstrumentZIBaseInstrument) –

as_dict()[source]

Returns the key-value pair as a dictionary.

Return type

{str: Any}Dict[str, Any]

Returns

class ZISettings(daq_settings, awg_settings)[source]

Zurich Instruments settings result class.

__init__(daq_settings, awg_settings)[source]

Create a new instance of ZISettings which is a collection of AWG and DAQ settings for a Zurich Instruments device.

Parameters
apply(instrument)[source]

Apply all settings to the instrument.

Return type

NoneNone

as_dict()[source]

Returns the ZISettings as a dictionary.

Return type

{str: Any}Dict[str, Any]

Returns

classmethod deserialize(settings_path)[source]

Deserializes the JSON settings for Zurich Instruments in to the ZISettingsBuilder.

Parameters

settings_path (PathPath) – The path to the parent JSON file.

Return type

ZISettingsBuilderZISettingsBuilder

Returns

The ZISettingsBuilder containing all the deserialized settings.

Raises

ValueError – If the settings_path does not end with ‘_settings.json’.

serialize(root, options)[source]

Serializes the ZISerializeSettings to file storage. The parent ‘{options.name}_settings.json’ file contains references to all child files.

While settings are stored in JSON the waveforms are stored in CSV.

Parameters
Return type

PathPath

Returns

The path to the parent JSON file.

property awg_indexes

Returns a list of enabled AWG indexes.

Return type

List[int]List[int]

class ZISettingsBuilder[source]

The Zurich Instruments Settings builder class.

This class provides an API for settings that are configured in the zhinst backend. The ZISettings class is the resulting set that holds settings.

This class exist because configuring these settings requires logic in how the settings are configured using the zurich instruments API.

Tip

Build the settings using build() and then view them as a dictionary using ZISettings.as_dict() to see what settings will be configured.

__init__()[source]

Creates a new instance of ZISettingsBuilder

build()[source]

Builds the ZISettings class.

Return type

ZISettingsZISettings

Returns

with_awg_time(awg_index, clock_rate_index)[source]

Adds the Instruments clock rate frequency setting.

See ZI instrument user manual

/DEV…./AWGS/n/TIME

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_commandtable_data(awg_index, json_data)[source]

Adds the Instruments CommandTable json vector setting to the awg by index.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_compiler_sourcestring(awg_index, seqc)[source]

Adds the sequencer compiler sourcestring setting for the Instruments awg by index.

Parameters
  • awg_index (intint) –

  • seqc (strstr) –

  • waveforms_dict

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_csv_wave_vector(awg_index, wave_index, vector)[source]

Adds the Instruments waveform vector setting by index for an awg by index.

This equivalent to with_wave_vector only it does not upload the setting to the node, because for loading waveforms using a CSV file this is not required.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_defaults(defaults)[source]

Adds the Instruments default settings.

Parameters

defaults (List[Tuple[str, Union[str, int]]]List[Tuple[str, Union[str, int]]]) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_gain(awg_index, gain)[source]

Adds the gain settings for the Instruments awg by index.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_delay(delay)[source]

Adds the Instruments QAS delay.

Parameters

delay (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_length(n_samples)[source]

Adds the Instruments QAS Monitor integration length setting.

Parameters

n_samples (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_mode(mode)[source]

Adds the Instruments QAS Monitor integration mode setting.

Parameters

mode (QasIntegrationModeQasIntegrationMode) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_weights_imag(channels, imag)[source]

Adds the Instruments QAS Monitor integration imaginary weights setting.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

Raises

ValueError – If a channel used is larger than 9.

with_qas_integration_weights_real(channels, real)[source]

Adds the Instruments QAS Monitor integration real weights setting.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

Raises

ValueError – If a channel used is larger than 9.

with_qas_monitor_averages(n_averages)[source]

Adds the Instruments QAS Monitor averages setting.

Parameters

n_averages (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_enable(enabled)[source]

Adds the Instruments QAS Monitor enable setting.

Parameters

enabled (boolbool) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_length(n_samples)[source]

Adds the Instruments QAS Monitor length setting.

Parameters

n_samples (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_reset(value)[source]

Adds the Instruments QAS Monitor reset setting.

Parameters

value (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_averages(n_averages)[source]

Adds the Instruments QAS Monitor result averages setting.

Parameters

n_averages (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_enable(enabled)[source]

Adds the Instruments QAS Monitor result enable setting.

Parameters

enabled (boolbool) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_length(n_samples)[source]

Adds the Instruments QAS Monitor result length setting.

Parameters

n_samples (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_mode(mode)[source]

Adds the Instruments QAS Monitor result mode setting.

Parameters

mode (QasResultModeQasResultMode) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_reset(value)[source]

Adds the Instruments QAS Result reset setting.

Parameters

value (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_source(mode)[source]

Adds the Instruments QAS Monitor result source setting.

Parameters

mode (QasResultSourceQasResultSource) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_rotations(channels, value)[source]

Adds the Instruments QAS rotation setting.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_sigout_offset(channel_index, offset_in_millivolts)[source]

Adds the channel sigout offset setting in volts.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_sigouts(awg_index, outputs)[source]

Adds the channel sigouts setting for the Instruments awg by index.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_system_channelgrouping(channelgrouping)[source]

Adds the Instruments channelgrouping setting.

Parameters

channelgrouping (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_wave_vector(awg_index, wave_index, vector)[source]

Adds the Instruments waveform vector setting by index for an awg by index.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

types

common

Common python dataclasses for multiple backends.

class LocalOscillator(unique_name, instrument_name, generic_icc_name=None, frequency=None, power=None, parameters=None)[source]

The backend LocalOscillator record type.

Parameters
  • unique_name (str) – The unique name identifying the combination of instrument and channel/parameters.

  • instrument_name (str) – The QCodes name of the LocalOscillator.

  • generic_icc_name (Optional[str]) – The name of the GenericInstrumentCoordinatorComponent attached to this device.

  • frequency (Optional[dict]) – A dict which tells the generic icc what parameter maps to the local oscillator (LO) frequency in Hz.

  • power (Optional[dict]) – A dict which tells the generic icc what parameter maps to the local oscillator (LO) power in dBm.

  • parameters (Optional[dict]) – A dict which allows setting of channel specific parameters of the device. Cannot be used together with frequency and power.

class MixerCorrections(amp_ratio=1.0, phase_error=0.0, dc_offset_I=0.0, dc_offset_Q=0.0)[source]

The mixer corrections record type.

Parameters
  • amp_ratio (float) – The amplitude ratio between the real and imaginary paths for correcting the imbalance in the IQ mixer. (default = 1.0)

  • phase_error (float) – The phase shift error used to compensate for quadrature errors. (default = .0)

  • dc_offset_I (float) – The DC offset off the real(I) path for lo feed-through compensation in Volts(V). (default = .0)

  • dc_offset_Q (float) – The DC offset off the imaginary(Q) path for lo feed-through compensation in Volts(V). (default = .0)

class Modulation(type=<ModulationModeType.NONE: 'none'>, interm_freq=0.0, phase_shift=0.0)[source]

The backend Modulation record type.

Parameters
  • type (quantify_scheduler.enums.ModulationModeType) –

    The modulation mode type select. Allows to choose between. (default = ModulationModeType.NONE)

    1. no modulation. (‘none’)

    2. Software premodulation applied in the numerical waveforms. (‘premod’)

    3. Hardware real-time modulation. (‘modulate’)

  • interm_freq (float) – The inter-modulation frequency (IF) in Hz. (default = 0.0).

  • phase_shift (float) – The IQ modulation phase shift in Degrees. (default = 0.0).

qblox

Python dataclasses for compilation to Qblox hardware.

class BaseModuleSettings(scope_mode_sequencer=None, offset_ch0_path0=None, offset_ch0_path1=None, offset_ch1_path0=None, offset_ch1_path1=None)[source]

Shared settings between all the Qblox modules.

offset_ch0_path0: Optional[float] = None

The DC offset on the path 0 of channel 0.

offset_ch0_path1: Optional[float] = None

The DC offset on the path 1 of channel 0.

offset_ch1_path0: Optional[float] = None

The DC offset on path 0 of channel 1.

offset_ch1_path1: Optional[float] = None

The DC offset on path 1 of channel 1.

scope_mode_sequencer: Optional[str] = None

The name of the sequencer that triggers scope mode Acquisitions. Only a single sequencer can perform trace acquisition. This setting gets set as a QCoDeS parameter on the driver as well as used for internal checks. Having multiple sequencers perform trace acquisition will result in an exception being raised.

class BasebandModuleSettings(scope_mode_sequencer=None, offset_ch0_path0=None, offset_ch0_path1=None, offset_ch1_path0=None, offset_ch1_path1=None)[source]

Settings for a baseband module.

Class exists to ensure that the cluster baseband modules don’t need special treatment in the rest of the code.

classmethod extract_settings_from_mapping(mapping, **kwargs)[source]

Factory method that takes all the settings defined in the mapping and generates a BasebandModuleSettings object from it.

Parameters
  • mapping ({str: Any}Dict[str, Any]) – The mapping dict to extract the settings from

  • **kwargs – Additional keyword arguments passed to the constructor. Can be used to override parts of the mapping dict.

Return type

BasebandModuleSettingsBasebandModuleSettings

class BoundedParameter(min_val, max_val, units)[source]

Specifies a certain parameter with a fixed max and min in a certain unit.

max_val: float

Max value allowed.

min_val: float

Min value allowed.

units: str

Units in which the parameter is specified.

class LOSettings(power, lo_freq)[source]

Dataclass containing all the settings for a generic LO instrument.

classmethod from_mapping(mapping)[source]

Factory method for the LOSettings from a mapping dict.

Parameters

mapping ({str: Any}Dict[str, Any]) – The part of the mapping dict relevant for this instrument.

Return type

LOSettingsLOSettings

Returns

Instantiated LOSettings from the mapping dict.

lo_freq: Optional[float]

The frequency to set the LO to.

power: float

Power of the LO source.

class MarkerConfiguration(start, end)[source]

Specifies the marker configuration set during the execution of the sequencer program.

end: int

Setting set in the footer at the end of the program.

start: int

The setting set in the header at the start of the program. Should set all the marker outputs high and turn on the output switches.

class OpInfo(name, data, timing, uuid=None, pulse_settings=None, bin_idx_register=None)[source]

Data structure containing all the information describing a pulse or acquisition needed to play it.

bin_idx_register: Optional[str] = None

The register used to keep track of the bin index, only not None for append mode acquisitions.

data: dict

The pulse/acquisition info taken from the data property of the pulse/acquisition in the schedule.

property duration

The duration of the pulse/acquisition.

Return type

floatfloat

Returns

The duration of the pulse/acquisition.

property is_acquisition

Returns true if this is an acquisition, false if it’s a pulse.

Returns

Is this an acquisition?

name: str

Name of the operation that this pulse/acquisition is part of.

pulse_settings: Optional[quantify_scheduler.backends.types.qblox.QASMRuntimeSettings] = None

Settings that are to be set by the sequencer before playing this pulse/acquisition. This is used for parameterized behavior e.g. setting a gain parameter to change the pulse amplitude, instead of changing the waveform. This allows to reuse the same waveform multiple times despite a difference in amplitude.

timing: float

The start time of this pulse/acquisition. Note that this is a combination of the start time “t_abs” of the schedule operation, and the t0 of the pulse/acquisition which specifies a time relative to “t_abs”.

uuid: Optional[str] = None

A unique identifier for this pulse/acquisition.

class PulsarRFSettings(scope_mode_sequencer=None, offset_ch0_path0=None, offset_ch0_path1=None, offset_ch1_path0=None, offset_ch1_path1=None, ref='internal', lo0_freq=None, lo1_freq=None)[source]

Settings specific for a Pulsar RF. Effectively, combines the Pulsar specific settings with the RF specific settings.

classmethod extract_settings_from_mapping(mapping, **kwargs)[source]

Factory method that takes all the settings defined in the mapping and generates a PulsarRFSettings object from it.

Parameters
  • mapping ({str: Any}Dict[str, Any]) – The mapping dict to extract the settings from

  • **kwargs – Additional keyword arguments passed to the constructor. Can be used to override parts of the mapping dict.

Return type

PulsarRFSettingsPulsarRFSettings

class PulsarSettings(scope_mode_sequencer=None, offset_ch0_path0=None, offset_ch0_path1=None, offset_ch1_path0=None, offset_ch1_path1=None, ref='internal')[source]

Global settings for the Pulsar to be set in the InstrumentCoordinator component. This is kept separate from the settings that can be set on a per sequencer basis, which are specified in SequencerSettings.

classmethod extract_settings_from_mapping(mapping, **kwargs)[source]

Factory method that takes all the settings defined in the mapping and generates a PulsarSettings object from it.

Parameters
  • mapping ({str: Any}Dict[str, Any]) – The mapping dict to extract the settings from

  • **kwargs – Additional keyword arguments passed to the constructor. Can be used to override parts of the mapping dict.

Return type

PulsarSettingsPulsarSettings

ref: str = 'internal'

The reference source. Should either be "internal" or "external", will raise an exception in the instrument coordinator component otherwise.

class QASMRuntimeSettings(awg_gain_0, awg_gain_1, awg_offset_0=0.0, awg_offset_1=0.0)[source]

Settings that can be changed dynamically by the sequencer during execution of the schedule. This is in contrast to the relatively static SequencerSettings.

awg_gain_0: float

Gain set to the AWG output path 0. Value should be in the range -1.0 < param < 1.0. Else an exception will be raised during compilation.

awg_gain_1: float

Gain set to the AWG output path 1. Value should be in the range -1.0 < param < 1.0. Else an exception will be raised during compilation.

awg_offset_0: float = 0.0

Offset applied to the AWG output path 0. Value should be in the range -1.0 < param < 1.0. Else an exception will be raised during compilation.

awg_offset_1: float = 0.0

Offset applied to the AWG output path 1. Value should be in the range -1.0 < param < 1.0. Else an exception will be raised during compilation.

class RFModuleSettings(scope_mode_sequencer=None, offset_ch0_path0=None, offset_ch0_path1=None, offset_ch1_path0=None, offset_ch1_path1=None, lo0_freq=None, lo1_freq=None)[source]

Global settings for the module to be set in the InstrumentCoordinator component. This is kept separate from the settings that can be set on a per sequencer basis, which are specified in SequencerSettings.

classmethod extract_settings_from_mapping(mapping, **kwargs)[source]

Factory method that takes all the settings defined in the mapping and generates an RFModuleSettings object from it.

Parameters
  • mapping ({str: Any}Dict[str, Any]) – The mapping dict to extract the settings from

  • **kwargs – Additional keyword arguments passed to the constructor. Can be used to override parts of the mapping dict.

Return type

RFModuleSettingsRFModuleSettings

lo0_freq: Optional[float] = None

The frequency of Output 0 (O0) LO. If left None, the parameter will not be set.

lo1_freq: Optional[float] = None

The frequency of Output 1 (O1) LO. If left None, the parameter will not be set.

class SequencerSettings(nco_en, sync_en, connected_outputs, modulation_freq=None, mixer_corr_phase_offset_degree=0.0, mixer_corr_gain_ratio=1.0, integration_length_acq=None)[source]

Sequencer level settings.

In the drivers these settings are typically recognized by parameter names of the form "sequencer_{index}_{setting}". These settings are set once at the start and will remain unchanged after. Meaning that these correspond to the “slow” QCoDeS parameters and not settings that are changed dynamically by the sequencer.

classmethod initialize_from_config_dict(seq_settings, connected_outputs)[source]

Instantiates an instance of this class, with initial parameters determined from the sequencer configuration dictionary.

Parameters

seq_settings ({str: Any}Dict[str, Any]) – The sequencer configuration dict.

Return type

SequencerSettingsSequencerSettings

Returns

The class with initial values.

connected_outputs: Union[Tuple[int], Tuple[int, int]]

Specifies which physical outputs this sequencer produces waveform data for.

integration_length_acq: Optional[int] = None

Integration length for acquisitions. Must be a multiple of 4 ns.

mixer_corr_gain_ratio: float = 1.0

The gain ratio to apply in order to correct for imbalances between the I and Q paths of the mixer.

mixer_corr_phase_offset_degree: float = 0.0

The phase shift to apply between the I and Q channels, to correct for quadrature errors.

modulation_freq: float = None

Specifies the frequency of the modulation.

nco_en: bool

Specifies whether the NCO will be used or not.

sync_en: bool

Enables party-line synchronization.

class StaticHardwareProperties(max_sequencers, max_awg_output_voltage, marker_configuration, mixer_dc_offset_range)[source]

Specifies the fixed hardware properties needed in the backend.

marker_configuration: quantify_scheduler.backends.types.qblox.MarkerConfiguration

The marker configuration to use.

max_awg_output_voltage: float

Maximum output voltage of the awg.

max_sequencers: int

The amount of sequencers available.

mixer_dc_offset_range: quantify_scheduler.backends.types.qblox.BoundedParameter

Specifies the range over which the dc offsets can be set that are used for mixer calibration.

zhinst

Python dataclasses for quantify-scheduler json-schemas.

class Acquisition(waveform_id, abs_time, clock_cycle_start, duration)[source]

This instruction indicates that an acquisition is to be triggered in the UHFQA. If a waveform_id is specified, this waveform will be used as the integration weight.

class CommandTable(table)[source]

The CommandTable definition for ZI HDAWG.

class CommandTableEntry(index, waveform)[source]

The definition of a single CommandTable entry.

class CommandTableEntryValue(value)[source]

A CommandTable entry definition with a value.

class CommandTableHeader(version='0.2', partial=False)[source]

The CommandTable header definition.

class CommandTableWaveform(index, length)[source]

The command table waveform properties.

class Device(name, type, ref, channel_0, channel_1=None, channel_2=None, channel_3=None, clock_select=0, channelgrouping=0, mode=<InstrumentOperationMode.OPERATING: 'operate'>, device_type=<DeviceType.NONE: 'none'>)[source]

The device definition class for zhinst devices.

This class maps to the zhinst backend JSON “devices” properties defined in the hardware mapping.

Parameters
class DeviceType(value)[source]

Enum of device types.

class Instruction(waveform_id, abs_time, clock_cycle_start, duration)[source]

Sequence base instruction record type.

static default()[source]

Returns a default Instruction instance.

Returns

Return type

Instruction

class InstrumentInfo(sample_rate, num_samples_per_clock, granularity, mode=<InstrumentOperationMode.OPERATING: 'operate'>)[source]

Instrument information record type.

class Output(port, clock, mode, modulation, local_oscillator, clock_frequency=None, gain1=0, gain2=0, line_trigger_delay=-1, latency=0.0, triggers=<factory>, markers=<factory>, mixer_corrections=None)[source]

The definition class for zhinst channel properties.

This class maps to the zhinst backend JSON “channel” properties defined in the hardware mapping.

Parameters
  • port (str) – The port resource.

  • clock (str) – The Clock resource.

  • clock_frequency (Optional[float]) – The frequency for the clock resource (AKA RF/signal frequency).

  • mode (quantify_scheduler.enums.SignalModeType) – The output mode type.

  • modulation (quantify_scheduler.backends.types.common.Modulation) – The modulation settings.

  • local_oscillator (str) – The LocalOscillator name.

  • gain1 (int) – The output1 IQ modulation gain. Accepted value between -1 and + 1. (default = 1.0)

  • gain2 (int) – The output2 IQ modulation gain. Accepted value between -1 and + 1. (default = 1.0)

  • line_trigger_delay (float) – The ZI Instrument output triggers. (default = -1.0)

  • latency (float) – The specified channel latency in seconds. (default = 0.)

  • triggers (List[int]) – The ZI Instrument input triggers. (default = [])

  • markers (List[Union[str, int]]) – The ZI Instrument output triggers. (default = [])

  • mixer_corrections (Optional[quantify_scheduler.backends.types.common.MixerCorrections]) – The output mixer corrections.

class QasIntegrationMode(value)[source]

Operation mode of all weighted integration units.

NORMAL: Normal mode. The integration weights are given by the user-programmed filter memory.

SPECTROSCOPY: Spectroscopy mode. The integration weights are generated by a digital oscillator. This mode offers enhanced frequency resolution.

class QasResultMode(value)[source]

UHFQA QAS result mode.

class QasResultSource(value)[source]

UHFQA QAS result source.

class Wave(waveform_id, abs_time, clock_cycle_start, duration)[source]

This instruction indicates that a waveform should be played.

class WaveformDestination(value)[source]

The waveform destination enum type.

device_under_test

Module containing instruments that represent quantum devices and elements on those devices.

The elements and their components are intended to generate valid device configuration files for compilation from the quantum-circuit layer to the quantum-device layer description.

quantum_device

Module containing the QuantumDevice object.

class QuantumDevice(name)[source]

The QuantumDevice directly represents the device under test (DUT) and contains a description of the connectivity to the control hardware as well as parameters specifying quantities like cross talk, attenuation and calibrated cable-delays. The QuantumDevice also contains references to individual DeviceElements, representations of elements on a device (e.g, a transmon qubit) containing the (calibrated) control-pulse parameters.

This object can be used to generate configuration files for the compilation step from the gate-level to the pulse level description. These configuration files should be compatible with the qcompile() function.

add_component(component)[source]

Adds a component to the components collection.

Parameters

component (InstrumentInstrument) – The component to add.

Raises
  • ValueError – If a component with a duplicated name is added to the collection.

  • TypeError – If component is not an instance of the base component.

Return type

NoneNone

generate_device_config()[source]

Generates a valid device config for the quantify-scheduler making use of the quantify_scheduler.compilation.add_pulse_information_transmon() function.

Return type

{str: Any}Dict[str, Any]

generate_hardware_config()[source]

Generates a valid hardware configuration describing the quantum device.

Return type

{str: Any}Dict[str, Any]

Returns

  • The hardware configuration file used for compiling from the quantum-device

  • layer to a hardware backend.

The hardware config should be valid input for the quantify_scheduler.compilation.qcompile() function.

get_component(name)[source]

Returns a component by name.

Parameters

name (strstr) – The component name.

Return type

InstrumentInstrument

Returns

The component.

Raises

KeyError – If key name is not present in self.components.

remove_component(name)[source]

Removes a component by name.

Parameters

name (strstr) – The component name.

Return type

NoneNone

transmon_element

class TransmonElement(name, **kwargs)[source]

A device element representing a single transmon coupled to a readout resonator.

This object can be used to generate configuration files compatible with the add_pulse_information_transmon() function.

__init__(name, **kwargs)[source]

Initializes the parent class and adds Parameter s / ManualParameter s / InstrumentRefParameter s to it.

The list of all parameters and their latest (cached) value can be listed as follows:

from quantify_scheduler.device_under_test import transmon_element
q0 = transmon_element.TransmonElement("q0")

q0.print_readable_snapshot()
q0:
	parameter              value
--------------------------------------------------------------------------------
IDN                     :	None 
acquisition             :	SSBIntegrationComplex 
device_cfg_backend      :	quantify_scheduler.compilation.add_pulse_informatio...
fl_port                 :	q0:fl 
freq_01                 :	None (Hz)
freq_12                 :	None (Hz)
init_duration           :	0.0002 (s)
instrument_coordinator  :	None 
mw_01_clock             :	q0.01 
mw_12_clock             :	q0.12 
mw_amp180               :	None (V)
mw_ef_amp180            :	None (V)
mw_motzoi               :	0 
mw_port                 :	q0:mw 
mw_pulse_duration       :	2e-08 (s)
ro_acq_delay            :	0 (s)
ro_acq_integration_time :	1e-06 (s)
ro_acq_weight_type      :	SSB 
ro_clock                :	q0.ro 
ro_freq                 :	None (Hz)
ro_port                 :	q0:res 
ro_pulse_amp            :	0.5 (V)
ro_pulse_delay          :	3e-07 (s)
ro_pulse_duration       :	3e-07 (s)
ro_pulse_type           :	square 
spec_pulse_amp          :	0.5 (V)
spec_pulse_clock        :	q0.01 
spec_pulse_duration     :	8e-06 (s)
spec_pulse_frequency    :	4.715e+09 (Hz)
Parameters

name (strstr) – The name of the transmon element.

generate_config()[source]

Generates part of the device configuration specific to a single qubit.

This method is intended to be used when this object is part of a device object containing multiple elements.

Return type

{str: {str: {str: Any}}}Dict[str, Dict[str, Dict[str, Any]]]

generate_device_config()[source]

Generates a valid device config for the quantify-scheduler making use of the quantify_scheduler.compilation.add_pulse_information_transmon() function.

This enables the settings of this qubit to be used in isolation.

Return type

{str: Any}Dict[str, Any]

helpers

Module containing helpers for quantify scheduler.

inspect

Python inspect helper functions.

get_classes(*modules)[source]

Returns a dictionary of class names by class types of the modules given as arguments.

from quantify_scheduler.helpers import inspect
from my_module import foo

class_dict: Dict[str, type] = inspect.get_classes(foo)
print(class_dict)
// { 'Bar': my_module.foo.Bar }
Parameters

modules (modulemodule) – Variable length of modules.

Return type

{str: Type[Any]}Dict[str, Type[Any]]

Returns

A dictionary containing the class names by class reference.

schedule

Schedule helper functions.

extract_acquisition_metadata_from_schedule(schedule)[source]

Extracts acquisition metadata from a schedule.

This function operates under certain assumptions with respect to the schedule.

  • The acquisition_metadata should be sufficient to initialize the xarray dataset (described in quantify-core !212) that executing the schedule will result in.

  • All measurements in the schedule use the same acquisition protocol.

  • The used acquisition index channel combinations for each measurement are unique.

  • The used acquisition indices for each channel are the same.

  • When BinMode is APPEND The number of data points per acquisition index assumed to be given by the schedule’s repetition property. This implies no support for feedback (conditional measurements).

Parameters

schedule (ScheduleBaseScheduleBase) – schedule containing measurements from which acquisition metadata can be extracted.

Return type

AcquisitionMetadataAcquisitionMetadata

Returns

The acquisition metadata provides a summary of the acquisition protocol, bin-mode, return-type and acquisition indices of the acquisitions in the schedule.

Raises

AssertionError – If not all acquisition protocols in a schedule are the same. If not all acquisitions use the same bin_mode. If the return type of the acquisitions is different.

get_acq_info_by_uuid(schedule)[source]

Returns a lookup dictionary of unique identifiers of acquisition information.

Parameters

schedule (CompiledScheduleCompiledSchedule) – The schedule.

Return type

{int: {str: Any}}Dict[int, Dict[str, Any]]

get_acq_uuid(acq_info)[source]

Returns an unique identifier for a acquisition protocol.

Parameters

acq_info ({str: Any}Dict[str, Any]) – The acquisition information dictionary.

Return type

intint

Returns

The uuid hash.

get_operation_end(schedule, timeslot_index)[source]

Returns the end of an operation in seconds.

Parameters
Return type

floatfloat

Returns

The Operation end time in Seconds.

get_operation_start(schedule, timeslot_index)[source]

Returns the start of an operation in seconds.

Parameters
Return type

floatfloat

Returns

The Operation start time in Seconds.

get_port_timeline(schedule)[source]

Returns a new dictionary containing the timeline of pulses, readout- and acquisition pulses of a port.

Using iterators on this collection enables sorting.

print(port_timeline_dict)
# { {'q0:mw', {0, [123456789]}},
# ... }

# Sorted items.
print(port_timeline_dict.items())
Parameters

schedule (CompiledScheduleCompiledSchedule) – The schedule.

Return type

{str: {int: List[int]}}Dict[str, Dict[int, List[int]]]

get_pulse_info_by_uuid(schedule)[source]

Returns a lookup dictionary of pulses with its hash as unique identifiers.

Parameters

schedule (CompiledScheduleCompiledSchedule) – The schedule.

Return type

{int: {str: Any}}Dict[int, Dict[str, Any]]

get_pulse_uuid(pulse_info, excludes=None)[source]

Returns an unique identifier for a pulse.

Parameters

pulse_info ({str: Any}Dict[str, Any]) – The pulse information dictionary.

Return type

intint

Returns

The uuid hash.

get_schedule_time_offset(schedule, port_timeline_dict)[source]

Returns the start time in seconds of the first pulse in the CompiledSchedule. The “None” port containing the Reset Operation will be ignored.

Parameters
Return type

floatfloat

Returns

The operation t0 in seconds.

get_total_duration(schedule)[source]

Returns the total schedule duration in seconds.

Parameters

schedule (CompiledScheduleCompiledSchedule) – The schedule.

Return type

floatfloat

Returns

Duration in seconds.

time

Python time wrapper functions. These function help to make time dependent modules testable.

get_time()[source]

Return the time in seconds since the epoch as a floating point number.

Acts as a wrapper around time.time() in order to make it testable. Mocking time.time() can conflicts with the internal python ticker thread.

Return type

floatfloat

Returns

Time since epoch

sleep(seconds)[source]

Delay execution for a given number of seconds. The argument may be a floating point number for subsecond precision.

Parameters

seconds (floatfloat) – The amount of time to wait.

Return type

NoneNone

waveforms

class GetWaveformPartial(*args, **kwargs)[source]

Protocol type definition class for the get_waveform partial function.

apply_mixer_skewness_corrections(waveform, amplitude_ratio, phase_shift)[source]

Takes a waveform and applies a correction for amplitude imbalances and phase errors when using an IQ mixer from previously calibrated values.

Phase correction is done using:

\[Re(z_{corrected}) (t) = Re(z (t)) + Im(z (t)) \tan(\phi) Im(z_{corrected}) (t) = Im(z (t)) / \cos(\phi)\]

The amplitude correction is achieved by rescaling the waveforms back to their original amplitudes and multiplying or dividing the I and Q signals respectively by the square root of the amplitude ratio.

Parameters
  • waveform (ndarrayndarray) – The complex valued waveform on which the correction will be applied.

  • amplitude_ratio (floatfloat) – The ratio between the amplitudes of I and Q that is used to correct for amplitude imbalances between the different paths in the IQ mixer.

  • phase_shift (floatfloat) – The phase error (in deg) used to correct the phase between I and Q.

Return type

ndarrayndarray

Returns

The complex valued waveform with the applied phase and amplitude corrections.

area_pulse(pulse, sampling_rate)[source]

Calculates the area of a single pulse.

The sampled area is calculated, which means that the area calculatd is based on the sampled waveform. This can differ slighly from the ideal area of the parameterized pulse.

The duration used for calculation is the duration of the pulse. This duration is equal to the duration of the sampled waveform for pulse durations that are integer multiples of the 1/sampling_rate.

Parameters
  • pulse ({str: Any}Dict[str, Any]) – The dictionary with information of the pulse

  • sampling_rate (floatfloat) – Sampling rate for the pulse

Return type

floatfloat

Returns

The area defined by the pulse

area_pulses(pulses, sampling_rate)[source]

Calculates the area of a set of pulses.

For details of the calculation see area_pulse.

Parameters
Return type

floatfloat

Returns

The area formed by all the pulses

exec_custom_waveform_function(wf_func, t, pulse_info)[source]

Load and import an ambiguous waveform function from a module by string.

The parameters of the dynamically loaded wf_func are extracted using inspect.signature() while the values are extracted from the pulse_info dictionary.

Parameters
  • wf_func (strstr) – The custom waveform function path.

  • t (ndarrayndarray) – The linear timespace.

  • pulse_info (dictdict) – The dictionary containing pulse information.

Return type

ndarrayndarray

Returns

Returns the computed waveform.

exec_waveform_function(wf_func, t, pulse_info)[source]

Returns the result of the pulse’s waveform function.

If the wf_func is defined outside quantify-scheduler then the wf_func is dynamically loaded and executed using exec_custom_waveform_function().

Parameters
  • wf_func (strstr) – The custom waveform function path.

  • t (ndarrayndarray) – The linear timespace.

  • pulse_info (dictdict) – The dictionary containing pulse information.

Return type

ndarrayndarray

Returns

Returns the computed waveform.

exec_waveform_partial(pulse_id, pulseid_waveformfn_dict, sampling_rate)[source]

Returns the result of the partial waveform function.

Parameters
Return type

ndarrayndarray

Returns

The waveform array.

get_waveform(pulse_info, sampling_rate)[source]

Returns the waveform of a pulse_info dictionary.

Parameters
  • pulse_info ({str: Any}Dict[str, Any]) – The pulse_info dictionary.

  • sampling_rate (floatfloat) – The sample rate of the waveform.

Return type

ndarrayndarray

Returns

The waveform.

get_waveform_by_pulseid(schedule)[source]

Returns a lookup dictionary of pulse_id and respectively its partial waveform function.

The keys are pulse info ids while the values are partial functions. Executing the waveform will return a numpy.ndarray.

Parameters

schedule (ScheduleSchedule) – The schedule.

Return type

{int: GetWaveformPartial}Dict[int, GetWaveformPartial]

get_waveform_size(waveform, granularity)[source]

Returns the number of samples required to respect the granularity.

Parameters
Return type

intint

modulate_waveform(t, envelope, freq, t0=0)[source]

Generates a (single sideband) modulated waveform from a given envelope by multiplying it with a complex exponential.

\[z_{mod} (t) = z (t) \cdot e^{2\pi i f (t+t_0)}\]

The signs are chosen such that the frequencies follow the relation RF = LO + IF for LO, IF > 0.

Parameters
  • t (ndarrayndarray) – A numpy array with time values

  • envelope (ndarrayndarray) – The complex-valued envelope of the modulated waveform

  • freq (floatfloat) – The frequency of the modulation

  • t0 (floatfloat (default: 0)) – Time offset for the modulation

Return type

ndarrayndarray

Returns

The modulated waveform

normalize_waveform_data(data)[source]

Rescales the waveform data so that the maximum amplitude is abs(amp) == 1.

Parameters

data (ndarrayndarray) – The waveform data to rescale.

Return type

Tuple[ndarray, float, float]Tuple[ndarray, float, float]

Returns

  • rescaled_data – The rescaled data.

  • amp_real – The original amplitude of the real part.

  • amp_imag – The original amplitude of the imaginary part.

resize_waveform(waveform, granularity)[source]

Returns the waveform in a size that is a modulo of the given granularity.

Parameters
  • waveform (ndarrayndarray) – The waveform array.

  • granularity (intint) – The waveform granularity.

Return type

ndarrayndarray

Returns

The resized waveform with a length equal to mod(len(waveform), granularity) == 0.

resize_waveforms(waveforms_dict, granularity)[source]

Resizes the waveforms to a multiple of the given granularity.

Parameters
Return type

NoneNone

shift_waveform(waveform, start_in_seconds, sampling_rate, resolution)[source]

Returns the waveform shifted with a number of samples to compensate for rounding errors that cause misalignment of the waveform in the clock time domain.

Note: when using this method be sure that the pulse starts at a round(start_in_sequencer_count).

waveform = np.ones(32)
sampling_rate = int(2.4e9)
resolution: int = 8

t0: float = 16e-9
#                 4.8 = 16e-9 / (8 / 2.4e9)
start_in_sequencer_count = (t0 // (resolution / sampling_rate))

start_waveform_at_sequener_count(start_in_sequencer_count, waveform)
Parameters
Return type

Tuple[int, ndarray]Tuple[int, ndarray]

instrument_coordinator

Import alias

Maps to

quantify_scheduler.instrument_coordinator.InstrumentCoordinator

InstrumentCoordinator

quantify_scheduler.instrument_coordinator.ZIInstrumentCoordinator

ZIInstrumentCoordinator

instrument_coordinator

Module containing the main InstrumentCoordinator Component.

class InstrumentCoordinator(name)[source]

Bases: qcodes.instrument.base.Instrument

The InstrumentCoordinator serves as the central interface of the hardware abstraction layer. It provides a standardized interface to execute Schedules on control hardware.

The InstrumentCoordinator has two main functionalities exposed to the user, the ability to configure its components representing physical instruments, and the ability to execute experiments.

add_component(component)[source]

Adds a component to the components collection.

Parameters

component (InstrumentCoordinatorComponentBaseInstrumentCoordinatorComponentBase) – The component to add.

Raises
  • ValueError – If a component with a duplicated name is added to the collection.

  • TypeError – If component is not an instance of the base component.

Return type

NoneNone

get_component(name)[source]

Returns the InstrumentCoordinator component by name.

Parameters

name (strstr) – The component name.

Return type

InstrumentCoordinatorComponentBaseInstrumentCoordinatorComponentBase

Returns

The component.

Raises

KeyError – If key name is not present in self.components.

prepare(compiled_schedule)[source]

Prepares each component for execution of a schedule.

It attempts to configure all instrument coordinator components for which compiled instructions, typically consisting of a combination of sequence programs, waveforms and other instrument settings, are available in the compiled schedule.

Parameters

compiled_schedule (CompiledScheduleCompiledSchedule) – A schedule containing the information required to execute the program.

Raises
  • KeyError – If the compiled schedule contains instructions for a component absent in the instrument coordinator.

  • TypeError – If the schedule provided is not a valid CompiledSchedule.

Return type

NoneNone

remove_component(name)[source]

Removes a component by name.

Parameters

name (strstr) – The component name.

Return type

NoneNone

retrieve_acquisition()[source]

Retrieves the latest acquisition results of the components with acquisition capabilities.

Return type

{Tuple[int, int]: Any}Dict[Tuple[int, int], Any]

Returns

The acquisition data per component.

start()[source]

Start all of the components.

The components are started in the order in which they were added.

Return type

NoneNone

stop()[source]

Stops all components.

The components are stopped in the order in which they were added.

Return type

NoneNone

wait_done(timeout_sec=10)[source]

Awaits each component until it has stopped running or until it has exceeded the amount of time to run.

The timeout in seconds specifies the allowed amount of time to run before it times out.

Parameters

timeout_sec (intint (default: 10)) – The maximum amount of time in seconds before a timeout.

Return type

NoneNone

property is_running

Returns if any of the InstrumentCoordinator components is running.

Return type

boolbool

Returns

The InstrumentCoordinator’s running state.

property last_schedule

Returns the last schedule used to prepare the instrument coordinator.

This feature is intended to aid users in debugging.

Return type

CompiledScheduleCompiledSchedule

class ZIInstrumentCoordinator(name)[source]

Bases: quantify_scheduler.instrument_coordinator.instrument_coordinator.InstrumentCoordinator

This class is a hack and extension to the InstrumentCoordinator, which is introduced to support the quirks when using the ZI backend during the acquisition of results.

retrieve_acquisition()[source]

Retrieves the latest acquisition results of the components with acquisition capabilities.

Returns

The acquisition data per component.

components

Import alias

Maps to

quantify_scheduler.instrument_coordinator.components.InstrumentCoordinatorComponentBase

InstrumentCoordinatorComponentBase

base

Module containing the InstrumentCoordinator interface.

class InstrumentCoordinatorComponentBase(instrument, **kwargs)[source]

Bases: qcodes.instrument.base.Instrument

The InstrumentCoordinator component abstract interface.

__init__(instrument, **kwargs)[source]

Instantiates the InstrumentCoordinatorComponentBase base class.

close()[source]

Makes sure the instances reference is released so that garbage collector can claim the object

Return type

NoneNone

abstract prepare(options)[source]

Initializes the InstrumentCoordinator Component with parameters.

Return type

NoneNone

abstract retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type

AnyAny

abstract start()[source]

Starts the InstrumentCoordinator Component.

Return type

NoneNone

abstract stop()[source]

Stops the InstrumentCoordinator Component.

Return type

NoneNone

abstract wait_done(timeout_sec=10)[source]

Waits until the InstrumentCoordinator component has stopped running or until it has exceeded the amount of time to run.

The maximum amount of time, in seconds, before it times out is set via the timeout_sec parameter.

Parameters

timeout_sec (intint (default: 10)) – The maximum amount of time in seconds before a timeout.

Return type

NoneNone

property instrument

Returns the instrument referenced by instrument_ref.

Return type

InstrumentBaseInstrumentBase

abstract property is_running

Returns if the InstrumentCoordinator component is running.

The property is_running is evaluated each time it is accessed. Example:

while my_instrument_coordinator_component.is_running:
    print('running')
Return type

boolbool

Returns

The components’ running state.

generic

Module containing a Generic InstrumentCoordinator Component.

class GenericInstrumentCoordinatorComponent(name='generic')[source]

Bases: quantify_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase

A Generic class which can be used for interaction with the InstrumentCoordinator.

The GenericInstrumentCoordinatorComponent should be able to accept any type of qcodes instrument. The component is meant to serve as an interface for simple access to instruments such as the local oscillator, or current source which needs to only set parameters. For now this component is not being used in any of the hardware backends’ compilation step. This will be fixed in the next official release.

prepare(params_config)[source]

params_config has keys which should correspond to parameter names of the instrument and the corresponding values to be set. Always ensure that the key to the params_config is in the format ‘instrument_name.parameter_name’ For example,

params_config = {
                 "lo_mw_q0.frequency": 6e9,
                 "lo_mw_q0.power": 13, "lo_mw_q0.status": True,
                 "lo_ro_q0.frequency": 8.3e9, "lo_ro_q0.power": 16,
                 "lo_ro_q0.status": True,
                 "lo_spec_q0.status": False,
                }
Return type

NoneNone

retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type

AnyAny

start()[source]

Starts the InstrumentCoordinator Component.

Return type

NoneNone

stop()[source]

Stops the InstrumentCoordinator Component.

Return type

NoneNone

wait_done(timeout_sec=10)[source]

Waits until the InstrumentCoordinator component has stopped running or until it has exceeded the amount of time to run.

The maximum amount of time, in seconds, before it times out is set via the timeout_sec parameter.

Parameters

timeout_sec (intint (default: 10)) – The maximum amount of time in seconds before a timeout.

Return type

NoneNone

property instrument

Overwrite the instrument method. There is no instrument for the GenericInstrumentCoordinatorComponent class.

property is_running

The is_running state refers to a state whether an instrument is capable of running in a program. Not to be confused with the on/off state of an instrument.

Return type

boolbool

qblox

Module containing Qblox InstrumentCoordinator Components.

class AcquisitionIndexing(acq_channel, acq_index)

Bases: tuple

Named tuple to clarify how the indexing of acquisitions works inside the _QRMAcquisitionManager.

acq_channel

Alias for field number 0

acq_index

Alias for field number 1

class ClusterComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase

Class that represents an instrument coordinator component for a Qblox cluster.

__init__(instrument, **kwargs)[source]

Create a new instance of the ClusterComponent.

Parameters
  • instrument (InstrumentInstrument) – Reference to the cluster driver object.

  • **kwargs – Keyword arguments passed to the parent class.

add_modules(*modules)[source]

Add modules to the cluster.

Parameters

*modules – The QCoDeS drivers of the modules to add.

Return type

NoneNone

prepare(options)[source]

Prepares the cluster component for execution of a schedule.

Parameters

options ({str: dict}Dict[str, dict]) – The compiled instructions to configure the cluster to.

Return type

NoneNone

retrieve_acquisition()[source]

Retrieves all the data from the instruments.

Return type

{Tuple[int, int]: Any} | NoneOptional[Dict[Tuple[int, int], Any]]

Returns

The acquired data or None if no acquisitions have been performed.

start()[source]

Starts all the modules in the cluster.

Return type

NoneNone

stop()[source]

Stops all the modules in the cluster.

Return type

NoneNone

wait_done(timeout_sec=10)[source]

Blocks until all the components are done executing their programs.

Parameters

timeout_sec (intint (default: 10)) – The time in seconds until the instrument is considered to have timed out.

Return type

NoneNone

property is_running

Returns true if any of the modules are currently running.

Return type

boolbool

class PulsarInstrumentCoordinatorComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase

Qblox Pulsar InstrumentCoordinator component base class.

__init__(instrument, **kwargs)[source]

Create a new instance of PulsarInstrumentCoordinatorComponent base class.

start()[source]

Starts execution of the schedule.

Return type

NoneNone

stop()[source]

Stops all execution.

Return type

NoneNone

wait_done(timeout_sec=10)[source]

Blocks the instrument until all the sequencers are done running.

Parameters

timeout_sec (intint (default: 10)) – The timeout in seconds. N.B. the instrument takes the timeout in minutes (int), therefore it is rounded down to whole minutes with a minimum of 1.

Return type

NoneNone

property is_running

Finds if any of the sequencers is currently running.

Return type

boolbool

Returns

True if any of the sequencers reports the “RUNNING” status.

class PulsarQCMComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox.PulsarInstrumentCoordinatorComponent

Pulsar QCM specific InstrumentCoordinator component.

__init__(instrument, **kwargs)[source]

Create a new instance of PulsarQCMComponent.

prepare(options)[source]

Uploads the waveforms and programs to the sequencers and configures all the settings required. Keep in mind that values set directly through the driver may be overridden (e.g. the offsets will be set according to the specified mixer calibration parameters).

Parameters

options ({str: dict}Dict[str, dict]) – Program to upload to the sequencers. The key is a sequencer, e.g., "seq0", or "settings", the value is the global settings dict or a sequencer-specific configuration.

Return type

NoneNone

retrieve_acquisition()[source]

Retrieves the previous acquisition.

Return type

NoneNone

Returns

QCM returns None since the QCM has no acquisition.

property instrument

Returns the instrument referenced by instrument_ref.

Return type

pulsar_qcm_qcodespulsar_qcm_qcodes

class PulsarQCMRFComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox.PulsarQCMComponent

Pulsar QCM-RF specific InstrumentCoordinator component.

class PulsarQRMComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox.PulsarInstrumentCoordinatorComponent

Pulsar QRM specific InstrumentCoordinator component.

__init__(instrument, **kwargs)[source]

Create a new instance of PulsarQRMComponent.

prepare(options)[source]

Uploads the waveforms and programs to the sequencers and configures all the settings required. Keep in mind that values set directly through the driver may be overridden (e.g. the offsets will be set according to the specified mixer calibration parameters).

Parameters

options ({str: dict}Dict[str, dict]) – Program to upload to the sequencers. The key is a sequencer, e.g., "seq0", or "settings", the value is the global settings dict or a sequencer-specific configuration.

Return type

NoneNone

retrieve_acquisition()[source]

Retrieves the latest acquisition results.

Return type

{Tuple[int, int]: Any} | NoneOptional[Dict[Tuple[int, int], Any]]

Returns

The acquired data.

property instrument

Returns the instrument referenced by instrument_ref.

Return type

pulsar_qrm_qcodespulsar_qrm_qcodes

class PulsarQRMRFComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox.PulsarQRMComponent

Pulsar QRM-RF specific InstrumentCoordinator component.

ClusterModule

Type that combines all the possible modules for a cluster.

alias of Union[quantify_scheduler.instrument_coordinator.components.qblox.PulsarQCMComponent, quantify_scheduler.instrument_coordinator.components.qblox.PulsarQRMComponent, quantify_scheduler.instrument_coordinator.components.qblox.PulsarQRMRFComponent, quantify_scheduler.instrument_coordinator.components.qblox.PulsarQCMRFComponent]

zhinst

Module containing Zurich Instruments InstrumentCoordinator Components.

class HDAWGInstrumentCoordinatorComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.zhinst.ZIInstrumentCoordinatorComponent

Zurich Instruments HDAWG InstrumentCoordinator Component class.

__init__(instrument, **kwargs)[source]

Create a new instance of HDAWGInstrumentCoordinatorComponent.

get_awg(index)[source]

Returns the AWG by index.

Parameters

index (intint) – The awg index.

Return type

AWGAWG

Returns

The HDAWG AWG instance.

retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type

AnyAny

start()[source]

Starts all HDAWG AWG(s) in reversed order by index.

Return type

NoneNone

stop()[source]

Stops all HDAWG AWG(s) in order by index.

Return type

NoneNone

wait_done(timeout_sec=10)[source]

Waits until the InstrumentCoordinator component has stopped running or until it has exceeded the amount of time to run.

The maximum amount of time, in seconds, before it times out is set via the timeout_sec parameter.

Parameters

timeout_sec (intint (default: 10)) – The maximum amount of time in seconds before a timeout.

Return type

NoneNone

property instrument

Returns the instrument referenced by instrument_ref.

Return type

HDAWGHDAWG

property is_running

Returns if the InstrumentCoordinator component is running.

The property is_running is evaluated each time it is accessed. Example:

while my_instrument_coordinator_component.is_running:
    print('running')
Return type

boolbool

Returns

The components’ running state.

class UHFQAInstrumentCoordinatorComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.zhinst.ZIInstrumentCoordinatorComponent

Zurich Instruments UHFQA InstrumentCoordinator Component class.

__init__(instrument, **kwargs)[source]

Create a new instance of UHFQAInstrumentCoordinatorComponent.

prepare(zi_device_config)[source]

Prepares the component with configurations required to arm the instrument.

After this step is complete, the waveform file is uploaded to the LabOne WebServer.

Parameters

zi_device_config (ZIDeviceConfigZIDeviceConfig) – The ZI instrument configuration. See the link for details of the configuration format.

Return type

boolbool

Returns

A boolean indicating if the ZI component was configured in this call.

retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type

{int: ndarray}Dict[int, ndarray]

start()[source]

Starts the InstrumentCoordinator Component.

Return type

NoneNone

stop()[source]

Stops the InstrumentCoordinator Component.

Return type

NoneNone

wait_done(timeout_sec=10)[source]

Waits until the InstrumentCoordinator component has stopped running or until it has exceeded the amount of time to run.

The maximum amount of time, in seconds, before it times out is set via the timeout_sec parameter.

Parameters

timeout_sec (intint (default: 10)) – The maximum amount of time in seconds before a timeout.

Return type

NoneNone

property instrument

Returns the instrument referenced by instrument_ref.

Return type

UHFQAUHFQA

property is_running

Returns if the InstrumentCoordinator component is running.

The property is_running is evaluated each time it is accessed. Example:

while my_instrument_coordinator_component.is_running:
    print('running')
Return type

boolbool

Returns

The components’ running state.

class ZIInstrumentCoordinatorComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase

Zurich Instruments InstrumentCoordinator component base class.

__init__(instrument, **kwargs)[source]

Create a new instance of ZIInstrumentCoordinatorComponent.

prepare(zi_device_config)[source]

Prepare the InstrumentCoordinator component with configuration required to arm the instrument.

The preparation is skipped when the new zi_device_config is the same as that from the previous time prepare was called. This saves significant time overhead.

Parameters

zi_device_config (ZIDeviceConfigZIDeviceConfig) – The ZI instrument configuration. See the link for details of the configuration format.

Return type

boolbool

Returns

A boolean indicating if the ZI component was configured in this call.

retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type

AnyAny

property is_running

Returns if the InstrumentCoordinator component is running.

The property is_running is evaluated each time it is accessed. Example:

while my_instrument_coordinator_component.is_running:
    print('running')
Return type

boolbool

Returns

The components’ running state.

convert_to_instrument_coordinator_format(acquisition_results, n_acquisitions)[source]

Converts the acquisition results format of the UHFQA component to the format required by InstrumentCoordinator. Converts from Dict[int, np.ndarray] to Dict[Tuple[int, int], Any].

operations

Module containing the standard library of commonly used operations as well as the Operation class.

Tip

Quantify scheduler can trivially be extended by creating custom operations. Take a look at e.g., the pulse library for examples on how to implement custom pulses.

acquisition_library

Standard acquisition protocols for use with the quantify_scheduler.

class AcquisitionOperation(name, data=None)[source]

This class is used to help differentiate an acquisition operation from the regular operations. This enables us to use plot_acquisition_operations() to highlight acquisition pulses in the pulse diagrams.

class NumericalWeightedIntegrationComplex(weights_a, weights_b, t, port, clock, interpolation='linear', acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, phase=0, t0=0, data=None)[source]

Implements a WeightedIntegratedComplex class using parameterized waveforms and interpolation as the integration weights.

__init__(weights_a, weights_b, t, port, clock, interpolation='linear', acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, phase=0, t0=0, data=None)[source]

Creates a new instance of NumericalWeightedIntegrationComplex. NumericalWeightedIntegrationComplex inherits from WeightedIntegratedComplex that uses parameterized waveforms and interpolation as integration weights.

Weights are applied as:

\[\widetilde{A} = \int ( \mathrm{Re}(S(t))\cdot \mathrm{Re}(W_A(t)) + \mathrm{Im}(S(t))\cdot \mathrm{Im}(W_A(t)) ) \mathrm{d}t\]
\[\widetilde{B} = \int ( \mathrm{Re}(S(t))\cdot \mathrm{Re}(W_B(t)) + \mathrm{Im}(S(t))\cdot \mathrm{Im}(W_B(t)) ) \mathrm{d}t\]
Parameters
  • weights_a (List[complex] | ndarrayUnion[List[complex], ndarray]) – The list of complex values used as weights \(A(t)\) on the incoming complex signal.

  • weights_b (List[complex] | ndarrayUnion[List[complex], ndarray]) – The list of complex values used as weights \(B(t)\) on the incoming complex signal.

  • t (List[float] | ndarrayUnion[List[float], ndarray]) – The time values of each weight.

  • port (strstr) – The acquisition port.

  • clock (strstr) – The clock used to demodulate the acquisition.

  • interpolation (strstr (default: 'linear')) – The type of interpolation to use, by default “linear”. This argument is passed to interp1d.

  • acq_channel (intint (default: 0)) – The data channel in which the acquisition is stored, by default 0. Describes the “where” information of the measurement, which typically corresponds to a qubit idx.

  • acq_index (intint (default: 0)) – The data register in which the acquisition is stored, by default 0. Describes the “when” information of the measurement, used to label or tag individual measurements in a large circuit. Typically corresponds to the setpoints of a schedule (e.g., tau in a T1 experiment).

  • bin_mode (BinMode | strUnion[BinMode, str] (default: <BinMode.APPEND: 'append'>)) – Describes what is done when data is written to a register that already contains a value. Options are “append” which appends the result to the list or “average” which stores the weighted average value of the new result and the old register value, by default BinMode.APPEND

  • phase (floatfloat (default: 0)) – The phase of the pulse and acquisition in degrees, by default 0

  • t0 (floatfloat (default: 0)) – The acquisition start time in seconds, by default 0

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class SSBIntegrationComplex(port, clock, duration, acq_channel=0, acq_index=0, bin_mode=<BinMode.AVERAGE: 'average'>, phase=0, t0=0, data=None)[source]

This class implements a SingleSideBand Integration acquisition protocol with complex results.

__init__(port, clock, duration, acq_channel=0, acq_index=0, bin_mode=<BinMode.AVERAGE: 'average'>, phase=0, t0=0, data=None)[source]

Creates a new instance of SSBIntegrationComplex. Single Sideband Integration acquisition protocol with complex results.

A weighted integrated acquisition on a complex signal using a square window for the acquisition weights.

The signal is demodulated using the specified clock, and the square window then effectively specifies an integration window.

Parameters
  • port (strstr) – The acquisition port.

  • clock (strstr) – The clock used to demodulate the acquisition.

  • duration (floatfloat) – The acquisition duration in seconds.

  • acq_channel (intint (default: 0)) – The data channel in which the acquisition is stored, by default 0. Describes the “where” information of the measurement, which typically corresponds to a qubit idx.

  • acq_index (intint (default: 0)) – The data register in which the acquisition is stored, by default 0. Describes the “when” information of the measurement, used to label or tag individual measurements in a large circuit. Typically corresponds to the setpoints of a schedule (e.g., tau in a T1 experiment).

  • bin_mode (BinMode | strUnion[BinMode, str] (default: <BinMode.AVERAGE: 'average'>)) – Describes what is done when data is written to a register that already contains a value. Options are “append” which appends the result to the list or “average” which stores the weighted average value of the new result and the old register value, by default BinMode.APPEND

  • phase (floatfloat (default: 0)) – The phase of the pulse and acquisition in degrees, by default 0

  • t0 (floatfloat (default: 0)) – The acquisition start time in seconds, by default 0

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class Trace(duration, port, clock, acq_channel=0, acq_index=0, bin_mode=<BinMode.AVERAGE: 'average'>, t0=0, data=None)[source]

The Trace acquisition protocol measures a signal s(t).

__init__(duration, port, clock, acq_channel=0, acq_index=0, bin_mode=<BinMode.AVERAGE: 'average'>, t0=0, data=None)[source]

Creates a new instance of Trace. The Trace acquisition protocol measures a signal s(t).

Only processing performed is rescaling and adding units based on a calibrated scale. Values are returned as a raw trace (numpy array of float datatype). Length of this array depends on the sampling rate of the acquisition device.

Parameters
  • port (strstr) – The acquisition port.

  • clock (strstr) – The clock used to demodulate the acquisition.

  • duration (floatfloat) – The acquisition duration in seconds.

  • acq_channel (intint (default: 0)) – The data channel in which the acquisition is stored, is by default 0. Describes the “where” information of the measurement, which typically corresponds to a qubit idx.

  • acq_index (intint (default: 0)) – The data register in which the acquisition is stored, by default 0. Describes the “when” information of the measurement, used to label or tag individual measurements in a large circuit. Typically corresponds to the setpoints of a schedule (e.g., tau in a T1 experiment).

  • bin_mode (BinMode | strUnion[BinMode, str] (default: <BinMode.AVERAGE: 'average'>)) – Describes what is done when data is written to a register that already contains a value. Options are “append” which appends the result to the list or “average” which stores the weighted average value of the new result and the old register value, by default BinMode.APPEND

  • t0 (floatfloat (default: 0)) – The acquisition start time in seconds, by default 0

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class WeightedIntegratedComplex(waveform_a, waveform_b, port, clock, duration, acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, phase=0, t0=0, data=None)[source]

Weighted integration acquisition protocol on a complex signal in a custom complex window.

__init__(waveform_a, waveform_b, port, clock, duration, acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, phase=0, t0=0, data=None)[source]

Creates a new instance of WeightedIntegratedComplex. Weighted integration acquisition protocol on a complex signal in a custom complex window.

A weighted integrated acquisition on a complex signal using custom complex windows.

Weights are applied as:

\[\widetilde{A} = \int ( \mathrm{Re}(S(t))\cdot \mathrm{Re}(W_A(t)) + \mathrm{Im}(S(t))\cdot \mathrm{Im}(W_A(t)) ) \mathrm{d}t\]
\[\widetilde{B} = \int ( \mathrm{Re}(S(t))\cdot \mathrm{Re}(W_B(t)) + \mathrm{Im}(S(t))\cdot \mathrm{Im}(W_B(t)) ) \mathrm{d}t\]
Parameters
  • waveform_a ({str: Any}Dict[str, Any]) – The complex waveform used as integration weights \(A(t)\).

  • waveform_b ({str: Any}Dict[str, Any]) – The complex waveform used as integration weights \(B(t)\).

  • port (strstr) – The acquisition port.

  • clock (strstr) – The clock used to demodulate the acquisition.

  • duration (floatfloat) – The acquisition duration in seconds.

  • acq_channel (intint (default: 0)) – The data channel in which the acquisition is stored, by default 0. Describes the “where” information of the measurement, which typically corresponds to a qubit idx.

  • acq_index (intint (default: 0)) – The data register in which the acquisition is stored, by default 0. Describes the “when” information of the measurement, used to label or tag individual measurements in a large circuit. Typically corresponds to the setpoints of a schedule (e.g., tau in a T1 experiment).

  • bin_mode (BinMode | strUnion[BinMode, str] (default: <BinMode.APPEND: 'append'>)) – Describes what is done when data is written to a register that already contains a value. Options are “append” which appends the result to the list or “average” which stores the weighted average value of the new result and the old register value, by default BinMode.APPEND

  • phase (floatfloat (default: 0)) – The phase of the pulse and acquisition in degrees, by default 0

  • t0 (floatfloat (default: 0)) – The acquisition start time in seconds, by default 0

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

Raises

NotImplementedError

gate_library

Standard gateset for use with the quantify_scheduler.

class CNOT(qC, qT, data=None)[source]

Conditional-NOT gate, a common entangling gate.

Performs an X gate on the target qubit qT conditional on the state of the control qubit qC.

This operation can be represented by the following unitary:

\[\begin{split}\mathrm{CNOT} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{bmatrix}\end{split}\]
__init__(qC, qT, data=None)[source]

Create a new instance of the two-qubit CNOT or Controlled-NOT gate.

The CNOT gate performs an X gate on the target qubit(qT) conditional on the state of the control qubit(qC).

Parameters
  • qC (strstr) – The control qubit.

  • qT (strstr) – The target qubit

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class CZ(qC, qT, data=None)[source]

Conditional-phase gate, a common entangling gate.

Performs a Z gate on the target qubit qT conditional on the state of the control qubit qC.

This operation can be represented by the following unitary:

\[\begin{split}\mathrm{CZ} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \\ \end{bmatrix}\end{split}\]
__init__(qC, qT, data=None)[source]

Create a new instance of the two-qubit CZ or conditional-phase gate.

The CZ gate performs an Z gate on the target qubit(qT) conditional on the state of the control qubit(qC).

Parameters
  • qC (strstr) – The control qubit.

  • qT (strstr) – The target qubit

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class Measure(*qubits, acq_channel=None, acq_index=None, bin_mode=None, data=None)[source]

A projective measurement in the Z-basis.

Note

Strictly speaking this is not a gate as it can not be described by a unitary.

__init__(*qubits, acq_channel=None, acq_index=None, bin_mode=None, data=None)[source]

Gate level description for a measurement.

The measurement is compiled according to the type of acquisition specified in the device configuration.

Parameters
  • qubits (strstr) – The qubits you want to measure

  • acq_channel (Tuple[int, …] | int | NoneUnion[Tuple[int, …], int, None] (default: None)) – Acquisition channel on which the measurement is performed

  • acq_index (Tuple[int, …] | int | NoneUnion[Tuple[int, …], int, None] (default: None)) – Index of the register where the measurement is stored.

  • bin_mode (BinMode | NoneOptional[BinMode] (default: None)) – The binning mode that is to be used. If not None, it will overwrite the binning mode used for Measurements in the quantum-circuit to quantum-device compilation step.

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class Reset(*qubits, data=None)[source]

Reset a qubit to the \(|0\rangle\) state.

The Reset gate is an idle operation that is used to initialize one or more qubits.

Note

Strictly speaking this is not a gate as it can not be described by a unitary.

Examples

The operation can be used in several ways:

from quantify_scheduler.operations.gate_library import Reset

reset_1 = Reset("q0")
reset_2 = Reset("q1", "q2")
reset_3 = Reset(*[f"q{i}" for i in range(3, 6)])
__init__(*qubits, data=None)[source]

Create a new instance of Reset operation that is used to initialize one or more qubits.

Parameters
  • qubits (strstr) – The qubit(s) to reset. NB one or more qubits can be specified, e.g., Reset("q0"), Reset("q0", "q1", "q2"), etc..

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None. Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class Rxy(theta, phi, qubit, data=None)[source]

A single qubit rotation around an axis in the equator of the Bloch sphere.

This operation can be represented by the following unitary:

\[\begin{split}\mathsf {R}_{xy} \left(\theta, \varphi\right) = \begin{bmatrix} \textrm {cos}(\theta /2) & -ie^{-i\varphi }\textrm {sin}(\theta /2) \\ -ie^{i\varphi }\textrm {sin}(\theta /2) & \textrm {cos}(\theta /2) \end{bmatrix}\end{split}\]
__init__(theta, phi, qubit, data=None)[source]

A single qubit rotation around an axis in the equator of the Bloch sphere.

Parameters
  • theta (floatfloat) – rotation angle in degrees

  • phi (floatfloat) – phase of the rotation axis

  • qubit (strstr) – the target qubit

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class X(qubit, data=None)[source]

A single qubit rotation of 180 degrees around the X-axis.

This operation can be represented by the following unitary:

\[\begin{split}X = \sigma_x = \begin{bmatrix} 0 & 1 \\ 1 & 0 \\ \end{bmatrix}\end{split}\]
__init__(qubit, data=None)[source]
Parameters
  • qubit (strstr) – the target qubit

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class X90(qubit, data=None)[source]

A single qubit rotation of 90 degrees around the X-axis.

__init__(qubit, data=None)[source]

Create a new instance of X90.

Parameters
  • qubit (strstr) – The target qubit.

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class Y(qubit, data=None)[source]

A single qubit rotation of 180 degrees around the Y-axis.

\[\begin{split}\mathsf Y = \sigma_y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}\end{split}\]
__init__(qubit, data=None)[source]

Create a new instance of Y.

The Y gate corresponds to a rotation of 180 degrees around the y-axis in the single-qubit Bloch sphere.

Parameters
  • qubit (strstr) – The target qubit.

  • data (dict | NoneOptional[dict] (default: None)) – The operation’s dictionary, by default None Note: if the data parameter is not None all other parameters are overwritten using the contents of data.

class Y90(qubit, data=None)[source]

A single qubit rotation of 90 degrees around the Y-axis.

__init__(qubit, data=None)[source]

Create a new instance of Y90.

The Y gate corresponds to a rotation of 90 degrees around the y-axis in the single-qubit Bloch sphere.

Parameters