quantify_scheduler

backends

qblox

compiler_abc

Compiler base and utility classes for Qblox backend.

class quantify_scheduler.backends.qblox.compiler_abc.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 quantify_scheduler.backends.qblox.compiler_abc.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 quantify_scheduler.backends.qblox.compiler_abc.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 quantify_scheduler.backends.qblox.compiler_abc.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]

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.

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 quantify_scheduler.backends.qblox.compiler_abc.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]

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.

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 quantify_scheduler.backends.qblox.compiler_abc.Sequencer(parent, name, portclock, static_hw_properties, connected_outputs, seq_settings, lo_name=None)[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)[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.

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, index 0 and 2 correspond to path0 of output 1 and output 2 respectively, and 1 and 3 to path1 of those outputs.

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 quantify_scheduler.backends.qblox.compiler_container.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.

quantify_scheduler.backends.qblox.constants.GRID_TIME = 4

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

quantify_scheduler.backends.qblox.constants.IMMEDIATE_SZ_GAIN = 65535

Size of gain instruction immediates in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.IMMEDIATE_SZ_OFFSET = 65535

Size of offset instruction immediates in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.IMMEDIATE_SZ_WAIT = 65535

Size of wait instruction immediates in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.MAX_MIXER_AMP_RATIO = 2.0

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

quantify_scheduler.backends.qblox.constants.MAX_MIXER_PHASE_ERROR_DEG = 45

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

quantify_scheduler.backends.qblox.constants.MIN_MIXER_AMP_RATIO = 0.5

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

quantify_scheduler.backends.qblox.constants.MIN_MIXER_PHASE_ERROR_DEG = -45

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

quantify_scheduler.backends.qblox.constants.MIN_TIME_BETWEEN_ACQUISITIONS = 1000

Minimum time between two acquisitions to prevent FIFO errors.

quantify_scheduler.backends.qblox.constants.NUMBER_OF_REGISTERS: int = 64

Number of registers available in the Qblox sequencers.

quantify_scheduler.backends.qblox.constants.NUMBER_OF_SEQUENCERS_QCM = 6

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

quantify_scheduler.backends.qblox.constants.NUMBER_OF_SEQUENCERS_QRM = 6

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

quantify_scheduler.backends.qblox.constants.PULSE_STITCHING_DURATION = 1e-06

Duration of the individual pulses when pulse stitching is used.

quantify_scheduler.backends.qblox.constants.REGISTER_SIZE = 4294967295

Size of registers in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.SAMPLING_RATE = 1000000000

Sampling rate of the Qblox control/readout instruments.

helpers

Helper functions for Qblox backend.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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}}
    

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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.

quantify_scheduler.backends.qblox.helpers.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 quantify_scheduler.backends.qblox.instrument_compilers.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 quantify_scheduler.backends.qblox.instrument_compilers.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 quantify_scheduler.backends.qblox.instrument_compilers.QcmModule(parent, name, total_play_time, hw_mapping)[source]

QCM specific implementation of the qblox compiler.

class quantify_scheduler.backends.qblox.instrument_compilers.QcmRfModule(parent, name, total_play_time, hw_mapping)[source]

QCM-RF specific implementation of the qblox compiler.

class quantify_scheduler.backends.qblox.instrument_compilers.QrmModule(parent, name, total_play_time, hw_mapping)[source]

QRM specific implementation of the qblox compiler.

class quantify_scheduler.backends.qblox.instrument_compilers.QrmRfModule(parent, name, total_play_time, hw_mapping)[source]

QRM-RF specific implementation of the qblox compiler.

quantify_scheduler.backends.qblox.instrument_compilers.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.

quantify_scheduler.backends.qblox.non_generic.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

quantify_scheduler.backends.qblox.non_generic.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 quantify_scheduler.backends.qblox.qasm_program.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.types 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.

types

common

Common python dataclasses for multiple backends.

class quantify_scheduler.backends.types.common.LocalOscillator(name, frequency)[source]

The backend LocalOssilator record type.

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

  • frequency (Optional[float]) – The local oscillator (LO) frequency in Hz.

class quantify_scheduler.backends.types.common.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 quantify_scheduler.backends.types.common.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. Premodulation (‘premod’)

    3. IQ 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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.qblox.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 quantify_scheduler.backends.types.zhinst.CommandTable(table)[source]

The CommandTable definition for ZI HDAWG.

class quantify_scheduler.backends.types.zhinst.CommandTableEntry(index, waveform)[source]

The definition of a single CommandTable entry.

class quantify_scheduler.backends.types.zhinst.CommandTableEntryValue(value)[source]

A CommandTable entry definition with a value.

class quantify_scheduler.backends.types.zhinst.CommandTableHeader(version='0.2', partial=False)[source]

The CommandTable header definition.

class quantify_scheduler.backends.types.zhinst.CommandTableWaveform(index, length)[source]

The command table waveform properties.

class quantify_scheduler.backends.types.zhinst.Device(name, type, ref, channel_0, channel_1=None, channel_2=None, channel_3=None, clock_select=0, channelgrouping=0, last_seq_wait_clocks=2000, 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 quantify_scheduler.backends.types.zhinst.DeviceType(value)[source]

Enum of device types.

class quantify_scheduler.backends.types.zhinst.Instruction(uuid, abs_time, timeslot_index, start_in_seconds, start_in_clocks, duration_in_seconds, duration_in_clocks)[source]

Sequence base instruction record type.

static default()[source]

Returns a default Instruction instance.

Returns

Return type

Instruction

class quantify_scheduler.backends.types.zhinst.InstrumentInfo(clock_rate, resolution, granularity, mode=<InstrumentOperationMode.OPERATING: 'operate'>)[source]

Instrument information record type.

class quantify_scheduler.backends.types.zhinst.Measure(uuid, abs_time, timeslot_index, start_in_seconds, start_in_clocks, duration_in_seconds, duration_in_clocks, weights_i, weights_q)[source]

Sequence measurement instruction record type.

Note that a measurement like this always uses two weights in the UHFQA.

class quantify_scheduler.backends.types.zhinst.Output(port, clock, mode, modulation, local_oscillator, clock_frequency=None, gain1=0, gain2=0, line_trigger_delay=-1, 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)

  • 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 quantify_scheduler.backends.types.zhinst.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 quantify_scheduler.backends.types.zhinst.QasResultMode(value)[source]

UHFQA QAS result mode.

class quantify_scheduler.backends.types.zhinst.QasResultSource(value)[source]

UHFQA QAS result source.

class quantify_scheduler.backends.types.zhinst.Wave(uuid, abs_time, timeslot_index, start_in_seconds, start_in_clocks, duration_in_seconds, duration_in_clocks, waveform, n_samples, n_samples_scaled)[source]

Sequence waveform instruction record type.

class quantify_scheduler.backends.types.zhinst.WaveformDestination(value)[source]

The waveform destination enum type.

zhinst

helpers

Helpers for Zurich Instruments.

quantify_scheduler.backends.zhinst.helpers.get_clock_rates(base_clock)[source]

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

Parameters

base_clock (floatfloat) – The Instruments base clock rate.

Returns

The node and clock rate values.

Return type

Dict[int, int]

quantify_scheduler.backends.zhinst.helpers.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.

quantify_scheduler.backends.zhinst.helpers.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.

quantify_scheduler.backends.zhinst.helpers.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.

quantify_scheduler.backends.zhinst.helpers.get_value(instrument, node)[source]

Gets the value of a ZI node.

Parameters
Return type

strstr

Returns

The node value.

quantify_scheduler.backends.zhinst.helpers.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.

quantify_scheduler.backends.zhinst.helpers.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.

quantify_scheduler.backends.zhinst.helpers.set_and_compile_awg_seqc(instrument, awg_index, node, value)[source]

Uploads and compiles the AWG sequencer program.

Parameters
quantify_scheduler.backends.zhinst.helpers.set_awg_value(instrument, awg_index, node, value)[source]

Sets the value of a AWG module node.

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.set_commandtable_data(instrument, awg_index, json_data)[source]

Sets the commandtable JSON for an AWG.

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.set_value(instrument, node, value)[source]

Sets the value of a ZI node.

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.set_values(instrument, value)[source]

Sets the value of a ZI node.

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.set_vector(instrument, node, value)[source]

Sets the vector value of a ZI node.

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.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

quantify_scheduler.backends.zhinst.helpers.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

quantify_scheduler.backends.zhinst.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

quantify_scheduler.backends.zhinst.resolvers.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 quantify_scheduler.backends.zhinst.seqc_il_generator.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

name – The variable name.

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_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 quantify_scheduler.backends.zhinst.seqc_il_generator.SeqcInfo(cached_schedule, output, low_res_clock)[source]

The Sequencer information class containing durations, offsets, pulses and clocks.

to_clocks(seconds)[source]

Returns the converted value in clocks.

Parameters

seconds (float) –

Returns

Return type

int

property line_trigger_delay_in_clocks

Returns the configured line delay when using triggers in clocks.

Returns

Return type

int

property line_trigger_delay_in_seconds

Returns the configured line delay when using triggers in seconds.

Returns

Return type

float

property schedule_duration_in_clocks

Returns the total schedule duration in clocks.

Returns

Return type

int

property schedule_duration_in_seconds

Returns the total schedule duration in seconds.

Returns

Return type

float

property schedule_offset_in_clocks

Returns the schedule start offset in clocks. The offset is determined by the Reset Operation.

Returns

Return type

int

property schedule_offset_in_seconds

Returns the schedule start offset in seconds. The offset is determined by the Reset Operation.

Returns

Return type

float

property timeline_end_in_clocks

Returns the port timeline start in clocks.

Returns

Return type

float

property timeline_end_in_seconds

Returns the port timeline end in seconds.

Returns

Return type

float

property timeline_start_in_clocks

Returns the port timeline start in clocks.

Returns

Return type

float

property timeline_start_in_seconds

Returns the port timeline start in seconds.

Returns

Return type

float

class quantify_scheduler.backends.zhinst.seqc_il_generator.SeqcInstructions(value)[source]

The sequencer enum type.

quantify_scheduler.backends.zhinst.seqc_il_generator.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
quantify_scheduler.backends.zhinst.seqc_il_generator.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.

quantify_scheduler.backends.zhinst.seqc_il_generator.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

quantify_scheduler.backends.zhinst.seqc_il_generator.add_seqc_info(seqc_gen, seqc_info)[source]

Add Sequence Information to the SeqcILGenerator using comments.

Parameters
quantify_scheduler.backends.zhinst.seqc_il_generator.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

quantify_scheduler.backends.zhinst.seqc_il_generator.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

settings

Settings builder for Zurich Instruments.

class quantify_scheduler.backends.zhinst.settings.ZISerializeSettings(name, _serial, _type)[source]

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

class quantify_scheduler.backends.zhinst.settings.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 quantify_scheduler.backends.zhinst.settings.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 quantify_scheduler.backends.zhinst.settings.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

qblox_backend

Compiler backend for Qblox hardware.

quantify_scheduler.backends.qblox_backend.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.

quantify_scheduler.backends.qblox_backend.hardware_compile(schedule, hardware_map)[source]

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

For every instrument in the hardware mapping, 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_map ({str: Any}Dict[str, Any]) – The hardware mapping of the setup.

Return type

{str: Any}Dict[str, Any]

Returns

The compiled program.

zhinst_backend

Backend for Zurich Instruments.

class quantify_scheduler.backends.zhinst_backend.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 quantify_scheduler.backends.zhinst_backend.ZIDeviceConfig(name, schedule, settings_builder, acq_config)[source]

Zurich Instruments device configuration.

Parameters
quantify_scheduler.backends.zhinst_backend.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

quantify_scheduler.backends.zhinst_backend.compile_backend(schedule, hardware_map)[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
Return type

{str: ZIDeviceConfig | float}Dict[str, Union[ZIDeviceConfig, float]]

Returns

A collection containing the compiled backend configuration for each device.

Raises

NotImplementedError – Thrown when using unsupported ZI Instruments.

quantify_scheduler.backends.zhinst_backend.get_execution_table(cached_schedule, instrument_info, output)[source]

Returns a timing critical execution table of Instructions.

Parameters
Raises

RuntimeError – Raised if encountered an unknown uuid.

Return type

List[Instruction]List[Instruction]

Returns

quantify_scheduler.backends.zhinst_backend.get_measure_instruction(uuid, timeslot_index, output, cached_schedule, instrument_info)[source]

Returns the measurement sequence instruction.

Parameters
Return type

MeasureMeasure

Returns

quantify_scheduler.backends.zhinst_backend.get_wave_instruction(uuid, timeslot_index, output, cached_schedule, instrument_info)[source]

Returns wave sequence instruction.

This function returns a record type class containing the waveform and timing critical information.

Parameters
Return type

WaveWave

Returns

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 quantify_scheduler.device_under_test.quantum_device.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 quantify_scheduler.device_under_test.transmon_element.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.

quantify_scheduler.helpers.inspect.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.

class quantify_scheduler.helpers.schedule.CachedSchedule(schedule)[source]

The CachedSchedule class wraps around the CompiledSchedule class and populates the lookup dictionaries that are used for compilation of the backends.

property acqid_acqinfo_dict

Returns the acquisition info lookup table.

Return type

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

property port_timeline_dict

Returns the timeline per port lookup dictionary.

Return type

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

property pulseid_pulseinfo_dict

Returns the pulse info lookup table.

Return type

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

property pulseid_waveformfn_dict

Returns waveform function lookup table.

Return type

{int: GetWaveformPartial}Dict[int, GetWaveformPartial]

property schedule

Returns schedule.

Return type

CompiledScheduleCompiledSchedule

property start_offset_in_seconds

Returns the schedule start offset in seconds. The start offset is determined by a Reset operation at the start of one of the ports.

Return type

floatfloat

property total_duration_in_seconds

Returns the schedule total duration in seconds.

Return type

floatfloat

quantify_scheduler.helpers.schedule.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.

quantify_scheduler.helpers.schedule.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]]

quantify_scheduler.helpers.schedule.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.

quantify_scheduler.helpers.schedule.get_operation_end(schedule, timeslot_index)[source]

Returns the end of an operation in seconds.

Parameters
Return type

floatfloat

Returns

The Operation start time in Seconds.

quantify_scheduler.helpers.schedule.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.

quantify_scheduler.helpers.schedule.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]]]

quantify_scheduler.helpers.schedule.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]]

quantify_scheduler.helpers.schedule.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.

quantify_scheduler.helpers.schedule.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.

quantify_scheduler.helpers.schedule.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.

quantify_scheduler.helpers.time.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

quantify_scheduler.helpers.time.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 quantify_scheduler.helpers.waveforms.GetWaveformPartial(*args, **kwargs)[source]

Protocol type definition class for the get_waveform partial function.

quantify_scheduler.helpers.waveforms.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.

quantify_scheduler.helpers.waveforms.area_pulse(pulse, sampling_rate)[source]

Calculates the area of a set of pulses.

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

  • sampling_rate (intint) – Sampling rate for the pulse

Return type

floatfloat

Returns

The area defined by the pulse

quantify_scheduler.helpers.waveforms.area_pulses(pulses, sampling_rate)[source]

Calculates the area of a set of pulses.

Parameters
Return type

floatfloat

Returns

The area formed by all the pulses

quantify_scheduler.helpers.waveforms.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.

quantify_scheduler.helpers.waveforms.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.

quantify_scheduler.helpers.waveforms.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.

quantify_scheduler.helpers.waveforms.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 (intint) – The sample rate of the waveform.

Return type

ndarrayndarray

Returns

The waveform.

quantify_scheduler.helpers.waveforms.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]

quantify_scheduler.helpers.waveforms.get_waveform_size(waveform, granularity)[source]

Returns the number of samples required to respect the granularity.

Parameters
Return type

intint

quantify_scheduler.helpers.waveforms.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

quantify_scheduler.helpers.waveforms.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.

quantify_scheduler.helpers.waveforms.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.

quantify_scheduler.helpers.waveforms.resize_waveforms(waveforms_dict, granularity)[source]

Resizes the waveforms to a multiple of the given granularity.

Parameters
Return type

NoneNone

quantify_scheduler.helpers.waveforms.shift_waveform(waveform, start_in_seconds, clock_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_clocks).

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

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

start_waveform_at_clock(start_in_clocks, waveform)
Parameters
Return type

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

instrument_coordinator

class quantify_scheduler.instrument_coordinator.InstrumentCoordinator(name)

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.

last_schedule()[source]

Returns the last schedule used to prepare the instrument coordinator.

This feature is intended to aid users in debugging.

Return type

CompiledScheduleCompiledSchedule

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.

class quantify_scheduler.instrument_coordinator.ZIInstrumentCoordinator(name)

Bases: quantify_scheduler.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

class quantify_scheduler.instrument_coordinator.components.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

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.

base

Module containing the InstrumentCoordinator interface.

class quantify_scheduler.instrument_coordinator.components.base.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

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.

qblox

Module containing Qblox InstrumentCoordinator Components.

class quantify_scheduler.instrument_coordinator.components.qblox.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 quantify_scheduler.instrument_coordinator.components.qblox.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 quantify_scheduler.instrument_coordinator.components.qblox.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 quantify_scheduler.instrument_coordinator.components.qblox.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 quantify_scheduler.instrument_coordinator.components.qblox.PulsarQCMRFComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox.PulsarQCMComponent

Pulsar QCM-RF specific InstrumentCoordinator component.

class quantify_scheduler.instrument_coordinator.components.qblox.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 quantify_scheduler.instrument_coordinator.components.qblox.PulsarQRMRFComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox.PulsarQRMComponent

Pulsar QRM-RF specific InstrumentCoordinator component.

quantify_scheduler.instrument_coordinator.components.qblox.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 quantify_scheduler.instrument_coordinator.components.zhinst.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 quantify_scheduler.instrument_coordinator.components.zhinst.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 quantify_scheduler.instrument_coordinator.components.zhinst.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.

quantify_scheduler.instrument_coordinator.components.zhinst.convert_to_instrument_coordinator_format(acquisition_results)[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].

schedules

spectroscopy_schedules

Module containing schedules for common spectroscopy experiments.

quantify_scheduler.schedules.spectroscopy_schedules.heterodyne_spec_sched(pulse_amp, pulse_duration, frequency, acquisition_delay, integration_time, port, clock, init_duration=0.0002, repetitions=1)[source]

Generate a schedule for performing heterodyne spectroscopy.

Parameters
  • pulse_amp (floatfloat) – amplitude of the spectroscopy pulse in Volt.

  • pulse_duration (floatfloat) – duration of the spectroscopy pulse in seconds.

  • frequency (floatfloat) – frequency of the spectroscopy pulse and of the data acquisition in Hertz.

  • acquisition_delay (floatfloat) – start of the data acquisition with respect to the start of the spectroscopy pulse in seconds.

  • integration_time (floatfloat) – integration time of the data acquisition in seconds.

  • port (strstr) – location on the device where the pulse should be applied.

  • clock (strstr) – reference clock used to track the spectroscopy frequency.

  • init_duration (floatfloat (default: 0.0002)) – The relaxation time or dead time.

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

quantify_scheduler.schedules.spectroscopy_schedules.two_tone_spec_sched(spec_pulse_amp, spec_pulse_duration, spec_pulse_frequency, spec_pulse_port, spec_pulse_clock, ro_pulse_amp, ro_pulse_duration, ro_pulse_delay, ro_pulse_port, ro_pulse_clock, ro_pulse_frequency, ro_acquisition_delay, ro_integration_time, init_duration=0.0002, repetitions=1)[source]

Generate a schedule for performing two-tone spectroscopy.

Parameters
  • spec_pulse_amp (floatfloat) – amplitude of the spectroscopy pulse in Volt.

  • spec_pulse_duration (floatfloat) – duration of the spectroscopy pulse in seconds.

  • spec_pulse_frequency (floatfloat) – frequency of the spectroscopy pulse in Hertz.

  • spec_pulse_port (strstr) – location on the device where the spectroscopy pulse should be applied.

  • spec_pulse_clock (strstr) – reference clock used to track the spectroscopy frequency.

  • ro_pulse_amp (floatfloat) – amplitude of the readout (spectroscopy) pulse in Volt.

  • ro_pulse_duration (floatfloat) – duration of the readout (spectroscopy) pulse in seconds.

  • ro_pulse_delay (floatfloat) – time between the end of the spectroscopy pulse and the start of the readout (spectroscopy) pulse.

  • ro_pulse_port (strstr) – location on the device where the readout (spectroscopy) pulse should be applied.

  • ro_pulse_clock (strstr) – reference clock used to track the readout (spectroscopy) frequency.

  • ro_pulse_frequency (floatfloat) – frequency of the spectroscopy pulse and of the data acquisition in Hertz.

  • ro_acquisition_delay (floatfloat) – start of the data acquisition with respect to the start of the spectroscopy pulse in seconds.

  • ro_integration_time (floatfloat) – integration time of the data acquisition in seconds.

  • init_duration (floatfloat (default: 0.0002)) – The relaxation time or dead time.

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

timedomain_schedules

Module containing schedules for common time domain experiments such as a Rabi and T1 measurement.

quantify_scheduler.schedules.timedomain_schedules.allxy_sched(qubit, element_select_idx=array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]), repetitions=1)[source]

Generate a schedule for performing an AllXY experiment.

Schedule sequence

Reset – Rxy[0] – Rxy[1] – Measure

for a specific set of combinations of x90, x180, y90, y180 and idle rotations.

See section 2.3.2 of Reed [2013] for an explanation of the AllXY experiment and it’s applications in diagnosing errors in single-qubit control pulses.

Parameters
  • qubit (strstr) – the name of the qubit e.g., "q0" to perform the experiment on.

  • element_select_idx (ndarray | intUnion[ndarray, int] (default: array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,        17, 18, 19, 20]))) – the index of the particular element of the AllXY experiment to exectute.

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

Returns

An experiment schedule.

quantify_scheduler.schedules.timedomain_schedules.echo_sched(times, qubit, repetitions=1)[source]

Generate a schedule for performing an Echo experiment to measure the qubit echo-dephasing time \(T_2^{E}\).

Schedule sequence

Reset – pi/2 – Idle(tau/2) – pi – Idle(tau/2) – pi/2 – Measure

See section III.B.2. of Krantz et al. [2019] for an explanation of the Bloch-Redfield model of decoherence and the echo experiment.

Parameters
  • qubit (strstr) – the name of the qubit e.g., “q0” to perform the echo experiment on.

  • times (ndarray | floatUnion[ndarray, float]) – an array of wait times between the

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

Returns

An experiment schedule.

quantify_scheduler.schedules.timedomain_schedules.rabi_pulse_sched(mw_G_amp, mw_D_amp, mw_frequency, mw_clock, mw_port, mw_pulse_duration, ro_pulse_amp, ro_pulse_duration, ro_pulse_delay, ro_pulse_port, ro_pulse_clock, ro_pulse_frequency, ro_acquisition_delay, ro_integration_time, init_duration, repetitions=1)[source]

Generate a schedule for performing a Rabi experiment using a quantify_scheduler.waveforms.drag() pulse.

Note

This function allows specifying a Rabi experiment directly using the pulse-level abstraction. For most applications we recommend using rabi_sched() instead.

Parameters
  • mw_G_amp (floatfloat) – amplitude of the gaussian component of a DRAG pulse.

  • mw_D_amp (floatfloat) – amplitude of the derivative-of-gaussian component of a DRAG pulse.

  • mw_frequency (floatfloat) – frequency of the DRAG pulse.

  • mw_clock (strstr) – reference clock used to track the qubit 01 transition.

  • mw_port (strstr) – location on the device where the pulse should be applied.

  • mw_pulse_duration (floatfloat) – duration of the DRAG pulse. Corresponds to 4 sigma.

  • ro_pulse_amp (floatfloat) – amplitude of the readout pulse in Volt.

  • ro_pulse_duration (floatfloat) – duration of the readout pulse in seconds.

  • ro_pulse_delay (floatfloat) – time between the end of the spectroscopy pulse and the start of the readout pulse.

  • ro_pulse_port (strstr) – location on the device where the readout pulse should be applied.

  • ro_pulse_clock (strstr) – reference clock used to track the readout frequency.

  • ro_pulse_frequency (floatfloat) – frequency of the spectroscopy pulse and of the data acquisition in Hertz.

  • ro_acquisition_delay (floatfloat) – start of the data acquisition with respect to the start of the readout pulse in seconds.

  • ro_integration_time (floatfloat) – integration time of the data acquisition in seconds.

  • init_duration (floatfloat) – The relaxation time or dead time.

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

quantify_scheduler.schedules.timedomain_schedules.rabi_sched(pulse_amp, pulse_duration, frequency, qubit, port=None, clock=None, repetitions=1)[source]

Generate a schedule for performing a Rabi using a Gaussian pulse.

Schedule sequence

Reset – DRAG – Measure

Parameters
  • pulse_amp (ndarray | floatUnion[ndarray, float]) – amplitude of the Rabi pulse in V.

  • pulse_duration (ndarray | floatUnion[ndarray, float]) – duration of the Gaussian shaped Rabi pulse. Corresponds to 4 sigma.

  • frequency (floatfloat) – frequency of the qubit 01 transition.

  • qubit (strstr) – the qubit on which to perform a Rabi experiment.

  • port (str | NoneOptional[str] (default: None)) – location on the chip where the Rabi pulse should be applied. if set to None, will use the naming convention "<qubit>:mw" to infer the port.

  • clock (str | NoneOptional[str] (default: None)) – name of the location in frequency space where to apply the Rabi pulse. if set to None, will use the naming convention "<qubit>.01" to infer the clock.

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

quantify_scheduler.schedules.timedomain_schedules.ramsey_sched(times, qubit, artificial_detuning=0, repetitions=1)[source]

Generate a schedule for performing a Ramsey experiment to measure the dephasing time \(T_2^{\star}\).

Schedule sequence

Reset – pi/2 – Idle(tau) – pi/2 – Measure

See section III.B.2. of Krantz et al. [2019] for an explanation of the Bloch-Redfield model of decoherence and the Ramsey experiment.

Parameters
  • times (ndarray | floatUnion[ndarray, float]) – an array of wait times tau between the pi/2 pulses.

  • artificial_detuning (floatfloat (default: 0)) – frequency in Hz of the software emulated, or artificial qubit detuning, which is implemented by changing the phase of the second pi/2 (recovery) pulse. The artificial detuning changes the observed frequency of the Ramsey oscillation, which can be useful to distinguish a slow oscillation due to a small physical detuning from the decay of the dephasing noise.

  • qubit (strstr) – the name of the qubit e.g., "q0" to perform the Ramsey experiment on.

  • repetitions (intint (default: 1)) – The amount of times the Schedule will be repeated.

Return type

ScheduleSchedule

Returns

An experiment schedule.

quantify_scheduler.schedules.timedomain_schedules.readout_calibration_sched(qubit, prepared_states, repetitions=1)[source]

A schedule for readout calibration. Prepares a state and immediately performs a measurement.

Parameters
  • qubit (strstr) – the name of the qubit e.g., "q0" to perform the experiment on.

  • prepared_states (List[int]List[int]) – the states to prepare the qubit in before measuring as in integer corresponding to the ground (0), first-excited (1) or second-excited (2) state.

  • repetitions (intint (default: 1)) – The number of shots to acquire, sets the number of times the schedule will be repeated.

Return type

ScheduleSchedule

Returns

An experiment schedule.

Raises
quantify_scheduler.schedules.timedomain_schedules.t1_sched(times, qubit, repetitions=1)[source]

Generate a schedule for performing a \(T_1\) experiment to measure the qubit relaxation time.

Schedule sequence

Reset – pi – Idle(tau) – Measure

See section III.B.2. of Krantz et al. [2019] for an explanation of the Bloch-Redfield model of decoherence and the \(T_1\) experiment.

Parameters