# quantify_scheduler¶

Import alias

Maps to

quantify_scheduler.schedules.schedule.Schedule

Schedule

quantify_scheduler.operations.operation.Operation

Operation

quantify_scheduler.schedules.schedule.CompiledSchedule

CompiledSchedule

quantify_scheduler.Resource

Resource

## backends¶

### circuit_to_device¶

Compilation backend for quantum-circuit to quantum-device layer.

exception ConfigKeyError(kind, missing, allowed)[source]

Custom exception for when a key is missing in a configuration file.

class DeviceCompilationConfig(**data)[source]

A datastructure containing the information required to compile a schedule to the representation at the quantum-device layer.

Parameters
class OperationCompilationConfig(**data)[source]

A datastructure containing the information required to compile an individual operation to the representation at the device level.

Parameters
• factory_func (Union[Callable, str]) – A callable designating a factory function used to create the representation of the operation at the quantum-device level.

• factory_kwargs (Dict[str, Any]) – a dictionary containing the keyword arguments and corresponding values to use when creating the operation by evaluating the factory function.

• gate_info_factory_kwargs (Optional[List[str]]) – A list of keyword arguments of the factory function for which the value must be retrieved from the gate_info of the operation.

compile_circuit_to_device(schedule, device_cfg)[source]

Adds the information required to represent operations on the quantum-device abstraction layer to operations that contain information on how to be represented on the quantum-circuit layer.

Parameters
Return type

### qblox_backend¶

Compiler backend for Qblox hardware.

generate_port_clock_to_device_map(mapping)[source]

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

Note

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

Parameters

mapping () – The hardware mapping config.

Return type
Returns

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

hardware_compile(schedule, hardware_cfg)[source]

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

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

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

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

• hardware_cfg () – The hardware configuration of the setup.

Return type
Returns

The compiled schedule.

#### compiler_abc¶

Compiler base and utility classes for Qblox backend.

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

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

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

Constructor for a ControlDeviceCompiler object.

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

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

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

• hw_mapping () – 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
add_pulse(port, clock, pulse_info)[source]

Assigns a certain pulse to this device.

Parameters
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
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
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
Returns

The maximum amount of sequencers

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

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

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

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

Constructor for an InstrumentCompiler object.

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

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

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

• hw_mapping ( (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
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
class QbloxBaseModule(parent, name, total_play_time, hw_mapping)[source]

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

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

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

Constructor function.

Parameters
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
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
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
abstract property settings_type

Specifies the PulsarSettings class used by the instrument.

Return type
abstract property static_hw_properties

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

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

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

assign_frequencies(sequencer)[source]

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

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

Raises

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

update_settings()[source]

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

property settings_type

The settings type used by baseband-type devices.

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

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

assign_frequencies(sequencer)[source]

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

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

Raises

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

update_settings()[source]

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

property settings_type

The settings type used by RF-type devices

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

Class that performs the compilation steps on the sequencer level.

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

Constructor for the sequencer compiler.

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

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

• portclock () – Tuple 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 ( (default: None)) – The name of the local oscillator instrument connected to the same output via an IQ mixer. This is used for frequency calculations.

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

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

• repetitions ( (default: 1)) – Number of times to repeat execution of the schedule.

Return type
Returns

The generated QASM program.

update_settings()[source]

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

property connected_outputs

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

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

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

Return type
property frequency

The frequency used for modulation of the pulses.

Return type
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
Returns

Has data been assigned to this sequencer?

latency_correction_ns: int

Latency correction accounted for by delaying the start of the program.

property name

The name assigned to this specific sequencer.

Return type
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
Returns

The portclock.

qasm_hook_func: Optional[Callable]

Allows the user to inject custom Q1ASM code into the compilation, just prior to returning the final string.

property settings

Gives the current settings.

Return type
Returns

The settings set to this sequencer.

#### compiler_container¶

Contains the compiler container class.

class CompilerContainer(schedule)[source]

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

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

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

__init__(schedule)[source]

Constructor for the instrument container.

Parameters

schedule (ScheduleSchedule) – The schedule to be compiled.

add_instrument_compiler(name, instrument, mapping)[source]

Adds an instrument compiler to the container.

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

• instrument () – A reference to the compiler class. Can either be passed as string or a direct reference.

• mapping () – The hardware mapping dict for this specific instrument.

Return type
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
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
instrument_compilers

The compilers for the individual instruments.

resources

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

total_play_time

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

#### constants¶

Constants for compilation to Qblox hardware.

DOWNCONVERTER_FREQ: float = 4400000000.0

LO frequency used by the Qblox downconverter.

GENERIC_IC_COMPONENT_NAME: str = 'generic'

Default name for the generic instrument coordinator component.

GRID_TIME = 4

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

IMMEDIATE_MAX_WAIT_TIME = 65532

Max size of wait instruction immediates in Q1ASM programs. Max value allowed by assembler is 2**16-1, but this is the largest that is a multiple of 4 ns.

IMMEDIATE_SZ_GAIN = 65535

Size of gain instruction immediates in Q1ASM programs.

IMMEDIATE_SZ_OFFSET = 65535

Size of offset instruction immediates in Q1ASM programs.

MAX_MIXER_AMP_RATIO = 2.0

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

MAX_MIXER_PHASE_ERROR_DEG = 45

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

MIN_MIXER_AMP_RATIO = 0.5

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

MIN_MIXER_PHASE_ERROR_DEG = -45

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

MIN_TIME_BETWEEN_ACQUISITIONS = 1000

Minimum time between two acquisitions to prevent FIFO errors.

NCO_PHASE_DEG_STEP_COURSE = 0.9

The phase (in deg) corresponding to an increase of 1 in the course argument of the q1asm instructions related to the NCO phases.

NCO_PHASE_DEG_STEP_FINE = 0.00225

The phase (in deg) corresponding to an increase of 1 in the fine argument of the q1asm instructions related to the NCO phases.

NCO_PHASE_DEG_STEP_U_FINE = 3.6e-07

The phase (in deg) corresponding to an increase of 1 in the ultra-fine argument of the q1asm instructions related to the NCO phases.

NCO_PHASE_NUM_STEP_COURSE = 400

The maximum value of the course argument of the nco phase instructions.

NCO_PHASE_NUM_STEP_FINE = 400

The maximum value of the fine argument of the nco phase instructions.

NCO_PHASE_NUM_STEP_U_FINE = 6250

The maximum value of the ultra-fine argument of the nco phase instructions.

NUMBER_OF_REGISTERS: int = 64

Number of registers available in the Qblox sequencers.

NUMBER_OF_SEQUENCERS_QCM = 6

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

NUMBER_OF_SEQUENCERS_QRM = 6

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

PULSE_STITCHING_DURATION = 1e-06

Duration of the individual pulses when pulse stitching is used.

REGISTER_SIZE = 4294967295

Size of registers in Q1ASM programs.

SAMPLING_RATE = 1000000000

Sampling rate of the Qblox control/readout instruments.

#### helpers¶

Helper functions for Qblox backend.

add_to_wf_dict_if_unique(wf_dict, waveform)[source]

Adds a waveform to the waveform dictionary if it is not yet in there and returns the uuid and index. If it is already present it simply returns the uuid and index.

Parameters
Return type
Returns

• Dict[str, Any] – The (updated) wf_dict.

• str – The uuid of the waveform.

• int – The index.

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
Returns

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

find_inner_dicts_containing_key(d, key)[source]

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

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

Parameters
Return type
Returns

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

generate_uuid_from_wf_data(wf_data, decimals=12)[source]

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

Parameters
Return type
Returns

A unique identifier.

generate_waveform_data(data_dict, sampling_rate)[source]

Generates an array using the parameters specified in data_dict.

Parameters
Return type
Returns

The (possibly complex) values of the generated waveform.

generate_waveform_dict(waveforms_complex)[source]

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

Parameters

waveforms_complex () – Dictionary containing the complex waveforms. Keys correspond to a unique identifier, value is the complex waveform.

Return type
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.

import numpy as np
from quantify_scheduler.backends.qblox.helpers import generate_waveform_dict

complex_waveforms = {12345: np.array([1, 2])}
generate_waveform_dict(complex_waveforms)

# {'12345_I': {'data': [1, 2], 'index': 0},
# '12345_Q': {'data': [0, 0], 'index': 1}}

{'12345_I': {'data': [1, 2], 'index': 0},
'12345_Q': {'data': [0, 0], 'index': 1}}


generate_waveform_names_from_uuid(uuid)[source]

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

Parameters

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

Return type
Returns

• uuid_I – Name for the I waveform.

• uuid_Q – Name for the Q waveform.

get_nco_phase_arguments(phase_deg)[source]

Converts a phase in degrees to the int arguments the NCO phase instructions expect.

Parameters

phase_deg (floatfloat) – The phase in degrees

Return type
Returns

The three ints corresponding to the phase arguments (course, fine, ultra-fine).

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
Return type
Returns

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

output_mode_from_outputs(outputs)[source]

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

Modes:

• "real": only path0 is used

• "imag": only path1 is used

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

Parameters

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

Return type

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

Returns

The mode

Raises

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

output_name_to_outputs(name)[source]

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

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

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

Parameters

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

Return type
Returns

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

to_grid_time(time, grid_time_ns=4)[source]

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

Parameters
Return type
Returns

The integer valued nanosecond time.

#### instrument_compilers¶

Compiler classes for Qblox backend.

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

Compiler class for a Qblox cluster.

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

Constructor for a Cluster compiler object.

Parameters
compile(repetitions=1)[source]

Performs the compilation.

Parameters

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

Return type
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
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
prepare()[source]

Prepares the instrument compiler for compilation by assigning the data.

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

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

supports_acquisition: bool = True

Specifies that the Cluster supports performing acquisitions.

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

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

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

Constructor for a local oscillator compiler.

Parameters
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
Returns

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

property frequency

Getter for the frequency.

Return type
Returns

The current frequency.

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

QCM specific implementation of the qblox compiler.

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

QCM-RF specific implementation of the qblox compiler.

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

QRM specific implementation of the qblox compiler.

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

QRM-RF specific implementation of the qblox compiler.

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

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

#### q1asm_instructions¶

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

#### qasm_program¶

QASM program class for Qblox backend.

class QASMProgram(static_hw_properties, register_manager)[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.

__init__(static_hw_properties, register_manager)[source]

Instantiates the QASMProgram.

Parameters
auto_wait(wait_time, count_as_elapsed_time=True, comment=None)[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.

• count_as_elapsed_time (boolbool (default: True)) – If true, this wait time is taken into account when keeping track of timing. Otherwise, the wait instructions are added but this wait time is ignored in the timing calculations in the rest of the program.

• comment ( (default: None)) – Allows to override the default comment.

Raises

ValueError – If wait_time <= 0.

Return type
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
static expand_from_normalised_range(val, immediate_size, param=None, operation=None)[source]

Takes the value of a parameter in normalized form (abs(param) <= 1.0), and expands it to an integer in the appropriate range required by the sequencer.

Parameters
• val (floatfloat) – The value of the parameter to expand.

• immediate_size (intint) – The size of the immediate. Used to find the max int value.

• param ( (default: None)) – The name of the parameter, to make a possible exception message more descriptive.

• operation ( (default: None)) – The operation this value is expanded for, to make a possible exception message more descriptive.

Returns

The expanded value of the parameter.

Raises

ValueError – Parameter is not in the normalized range.

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 () – Arguments to be passed.

• label ( (default: None)) – Adds a label to the line. Used for jumps and loops.

• comment ( (default: None)) – Optionally add a comment to the instruction.

Return type
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
Yields

The register used as loop counter.

Examples

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

from quantify_scheduler.backends.qblox.qasm_program import QASMProgram
from quantify_scheduler.backends.qblox import register_manager, constants
from quantify_scheduler.backends.types.qblox import (
StaticHardwareProperties,
MarkerConfiguration,
BoundedParameter,
)

static_hardware_properties = static_hw_properties = StaticHardwareProperties(
instrument_type="QCM",
max_sequencers=constants.NUMBER_OF_SEQUENCERS_QCM,
max_awg_output_voltage=2.5,
marker_configuration=MarkerConfiguration(init=None, start=0b1111, end=0b0000),
mixer_dc_offset_range=BoundedParameter(min_val=-2.5, max_val=2.5, units="V"),
)
qasm = QASMProgram(static_hardware_properties, register_manager.RegisterManager())

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', '# auto generated wait (100 ns)'],
['', 'loop', 'R0,@repeat', '']]

set_gain_from_amplitude(voltage_path0, voltage_path1, operation)[source]

Sets the gain such that a 1.0 in waveform memory corresponds to the specified voltage. i.e. changes the full scale range.

Parameters
Raises

ValueError – Trying to set a voltage outside the max range of the instrument.

Return type
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 ( (default: '0000')) – The string representing a binary number.

Return type
temp_registers(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
verify_square_acquisition_duration(acquisition, duration)[source]

Verifies if the square acquisition is valid by checking constraints on the duration.

Parameters
Raises
• ValueError – When attempting to perform an acquisition of a duration that is not a multiple of 4 ns.

• ValueError – When using a different duration than previous acquisitions.

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

integration_length_acq: Optional[int]

Integration length to use for the square acquisition.

register_manager: quantify_scheduler.backends.qblox.register_manager.RegisterManager

The register manager that keeps track of the occupied/available registers.

static_hw_properties: quantify_scheduler.backends.types.qblox.StaticHardwareProperties

Dataclass holding the properties of the hardware that this program is to be played on.

time_last_acquisition_triggered: Optional[int]

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

#### register_manager¶

Utility class for dynamically allocating registers for Qblox sequencers.

class RegisterManager[source]

Utility class that keeps track of all the registers that are still available.

__init__()[source]

Instantiates the RegisterManager.

allocate_register()[source]

Allocates a register to be used within the q1asm program.

Return type
Returns

A register that can be used.

Raises

IndexError – When the RegisterManager runs out of registers to allocate.

free_register(register)[source]

Frees up a register to be reused.

Parameters

register (strstr) – The register to free up.

Raises
• ValueError – The value provided is not a valid register.

• RuntimeError – Attempting to free a register that is already free.

Return type
property available_registers

Getter for the available registers.

Return type
Returns

A set containing all the available registers.

#### operation_handling¶

##### base¶

Defines interfaces for operation handling strategies.

class IOperationStrategy[source]

Defines the interface operation strategies must adhere to.

abstract generate_data(wf_dict)[source]

Generates the waveform data and adds them to the wf_dict (if not already present). This is either the awg data, or the acquisition weights.

Parameters

wf_dict () – The dictionary to add the waveform to. N.B. the dictionary is modified in function.

abstract insert_qasm(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this pulse/acquisition.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

abstract property operation_info

Returns the pulse/acquisition information extracted from the schedule.

Return type
##### factory¶

Functions for producing operation handling strategies.

get_operation_strategy(operation, instruction_generated_pulses_enabled, output_mode)[source]

Determines and instantiates the correct strategy object.

Parameters
Return type
Returns

The instantiated strategy object.

##### pulses¶

Classes for handling pulses.

class GenericPulseStrategy(operation_info, output_mode)[source]

Default class for handling pulses. No assumptions are made with regards to the pulse shape and no optimizations are done.

__init__(operation_info, output_mode)[source]

Constructor for this strategy.

Parameters
generate_data(wf_dict)[source]

Generates the data and adds them to the wf_dict (if not already present).

If output_mode == “imag”, this moves the real-valued data to be produced on path1 instead of path0.

Parameters

wf_dict () – The dictionary to add the waveform to. N.B. the dictionary is modified in function.

Raises

ValueError – Data is complex (has an imaginary component), but the output_mode is not set to “complex”.

insert_qasm(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this pulse.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

class PulseStrategyPartial(operation_info, output_mode)[source]

Contains the logic shared between all the pulses.

__init__(operation_info, output_mode)[source]

Constructor.

Parameters
property operation_info

Property for retrieving the operation info.

Return type
class StaircasePulseStrategy(operation_info, output_mode)[source]

If this strategy is used, a staircase is generated through offset instructions, without using waveform memory.

generate_data(wf_dict)[source]

Returns None as no waveforms are generated in this strategy.

insert_qasm(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this pulse.

Steps are generated using offset instructions. Using output_mode “real” or “complex” will cause the signal to appear on path0, “imag” on path1.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

class StitchedSquarePulseStrategy(operation_info, output_mode)[source]

If this strategy is used, a (long) square pulse is generated by stitching shorter square pulses together.

__init__(operation_info, output_mode)[source]

Constructor for StitchedSquarePulseStrategy.

Parameters
generate_data(wf_dict)[source]

Produces the waveform data for the stitched square pulse. This will be of a fixed duration.

If the output mode is set to “complex”, path1 will play all zeros. Otherwise both paths will play ones, but the amplitude will be set to 0 on one of them.

Parameters

wf_dict () – The dictionary to add the waveform to. N.B. the dictionary is modified in function.

insert_qasm(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this pulse. If the pulse is at least twice the stitching duration, a loop will be used.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

##### acquisitions¶

Classes for handling acquisitions.

class AcquisitionStrategyPartial(operation_info)[source]

Contains the logic shared between all the acquisitions.

__init__(operation_info)[source]

Constructor of superclass.

abstract acquire_append(qasm_program)[source]

Adds the assembly to the program for a bin_mode==APPEND acquisition.

abstract acquire_average(qasm_program)[source]

Adds the assembly to the program for a bin_mode==AVERAGE acquisition.

insert_qasm(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this acquisition. This function calls either acquire_average or acquire_append, depending on the bin mode.

The acquire_average and acquire_append are to be implemented in the subclass.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

bin_idx_register: Optional[str]

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

property operation_info

Property for retrieving the operation info.

Return type
class SquareAcquisitionStrategy(operation_info)[source]

Performs a square acquisition (i.e. without acquisition weights).

acquire_append(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this acquisition, assuming append is used.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

acquire_average(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this acquisition, assuming averaging is used.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

generate_data(wf_dict)[source]

Returns None as no waveform is needed.

Return type
class WeightedAcquisitionStrategy(operation_info)[source]

Performs a weighted acquisition.

__init__(operation_info)[source]

Constructor for this strategy.

Parameters

operation_info (OpInfoOpInfo) – The operation info that corresponds to this acquisition.

acquire_append(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this acquisition, assuming append is used. Registers will be used for the weight indexes and the bin index.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

acquire_average(qasm_program)[source]

Add the assembly instructions for the Q1 sequence processor that corresponds to this acquisition, assuming averaging is used.

Parameters

qasm_program (QASMProgramQASMProgram) – The QASMProgram to add the assembly instructions to.

generate_data(wf_dict)[source]

Generates the waveform data for both acquisition weights.

Parameters

wf_dict () – The dictionary to add the waveform to. N.B. the dictionary is modified in function.

### zhinst_backend¶

Backend for Zurich Instruments.

class ZIAcquisitionConfig(n_acquisitions, resolvers, bin_mode)[source]

Zurich Instruments acquisition configuration.

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

Zurich Instruments device configuration.

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

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

Parameters
Return type
Returns

compile_backend(schedule, hardware_cfg)[source]

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

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

Parameters
Return type
Returns

A collection containing the compiled backend configuration for each device.

Raises

NotImplementedError – Thrown when using unsupported ZI Instruments.

construct_waveform_table(timing_table, operations_dict, device_dict)[source]

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

Parameters
Return type
Returns

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

ensure_no_operations_overlap(timing_table)[source]

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

Parameters

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

Raises

ValueError – If there is overlap between operations.

#### helpers¶

Helpers for Zurich Instruments.

get_directory(awg)[source]

Returns the LabOne directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type
Returns

The path of this directory.

get_readout_channel_bitmask(readout_channels_count)[source]

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

Parameters

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

Return type
Returns

get_sampling_rates(base_sampling_rate)[source]

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

Parameters

base_sampling_rate (floatfloat) – The Instruments base sampling rate.

Returns

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

Return type

Dict[int, int]

get_src_directory(awg)[source]

Returns the source directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type
Returns

The path to the source directory.

get_value(instrument, node)[source]

Gets the value of a ZI node.

Parameters
Return type
Returns

The node value.

get_waveform_table(pulse_ids, pulseid_pulseinfo_dict)[source]

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

Parameters
• pulse_ids () – The list of pulse ids.

• pulseid_pulseinfo_dict () – The info lookup dictionary.

Return type
Returns

The waveform table dictionary.

get_waves_directory(awg)[source]

Returns the waves directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type
Returns

The path to the waves directory.

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

Uploads and compiles the AWG sequencer program.

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

Sets the value of a AWG module node.

Parameters
Return type
set_commandtable_data(instrument, awg_index, json_data)[source]

Sets the commandtable JSON for an AWG.

Parameters
• instrument (ZIBaseInstrumentZIBaseInstrument) – The instrument

• awg_index (intint) – The awg index.

• json_data () – The json data.

Return type
set_value(instrument, node, value)[source]

Sets the value of a ZI node.

Parameters
• instrument (ZIBaseInstrumentZIBaseInstrument) – The instrument.

• path – The node path.

• value – The new node value.

Return type
set_values(instrument, value)[source]

Sets the value of a ZI node.

Parameters
• instrument (ZIBaseInstrumentZIBaseInstrument) – The instrument.

• value () – The dictionary with nodes and values.

Return type
set_vector(instrument, node, value)[source]

Sets the vector value of a ZI node.

Parameters
• instrument (ZIBaseInstrumentZIBaseInstrument) – The instrument.

• awg_index – The awg to configure.

• node (strstr) – The node path.

• value () – The new node vector value.

Return type
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
write_seqc_file(awg, contents, filename)[source]

Writes the contents of to the source directory of LabOne.

Parameters
Return type
Returns

Returns the path which was written.

#### resolvers¶

monitor_acquisition_resolver(uhfqa, monitor_nodes)[source]

Returns complex value of UHFQA Monitor nodes.

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

Parameters
• uhfqa (UHFQAUHFQA) –

• monitor_nodes () –

Return type
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
• uhfqa (UHFQAUHFQA) –

• result_nodes () –

Return type

#### seqc_il_generator¶

class SeqcILGenerator[source]

The Intermediate Sequencer Language Generator.

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

__init__()[source]

Creates a new instance of SeqcILGenerator.

assign_get_user_reg(name, index)[source]

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

Parameters
Return type
assign_placeholder(name, size)[source]

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

Parameters
Return type
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
declare_var(name, value=None)[source]

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

Parameters
Return type
declare_wave(name, value=None)[source]

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

Parameters
Return type
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
emit_begin_repeat(repetitions=1)[source]

Emit repeat loop to the program.

Parameters

repetitions ( (default: 1)) – The repeat condition, by default 1

Return type
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
emit_blankline()[source]

Emits a blank line to the program.

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

Return type
emit_comment(text)[source]

Emit a comment to the program.

Parameters

text (strstr) –

Return type
emit_end_repeat()[source]

Emit ending the repeat loop.

Return type
emit_end_while()[source]

Emit ending the while loop.

Return type
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
emit_play_wave(*names, comment='')[source]

Emit playWave to the program.

Parameters

Examples

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

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

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

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

Emit setTrigger to the program.

Parameters

index () – The number or string of a trigger to set.

Return type
emit_start_qa(comment='')[source]

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

Parameter

• monitor: Enable for QA monitor, default: false

• trigger: Trigger value, default: 0x0

Return type
emit_start_qa_monitor()[source]

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

Return type
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 ( (default: None)) – The bitmake to select explicitly which of the ten possible qubit results should be read, by default “”

• trigger ( (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
emit_wait(cycles, comment='')[source]

Emits a wait instruction to the sequencer program.

Parameters

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

Return type
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
emit_wait_wave(comment='')[source]

Emit waitWave to the program.

Return type
generate()[source]

Returns the generated seqc program.

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

Returns

The seqc program.

Return type

str

class SeqcInstructions(value)[source]

The sequencer enum type.

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

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

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

Adds an executeTableEntry instruction to seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

Raises

AttributeError – Raised when the DeviceType not equals HDAWG.

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

Adds a playWave instruction to the seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

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

Adds a setTrigger instruction to the seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

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

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

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

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

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

Parameters
Returns

The number of clocks waited.

Return type

int

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

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

e.g. wave w0 = uhfqa1234_awg0_wave0

#### settings¶

Settings builder for Zurich Instruments.

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

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

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

Zurich Instruments Settings record type.

apply(instrument)[source]

Applies settings to the Instrument.

Parameters

instrument (ZIBaseInstrumentZIBaseInstrument) –

as_dict()[source]

Returns the key-value pair as a dictionary.

Return type
Returns

class ZISettings(daq_settings, awg_settings)[source]

Zurich Instruments settings result class.

__init__(daq_settings, awg_settings)[source]

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

Parameters
• daq_settings () – The data acquisition node settings.

• awg_settings () – The AWG(s) node settings.

apply(instrument)[source]

Apply all settings to the instrument.

Return type
as_dict()[source]

Returns the ZISettings as a dictionary.

Return type
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
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
Returns

The path to the parent JSON file.

property awg_indexes

Returns a list of enabled AWG indexes.

Return type
class ZISettingsBuilder[source]

The Zurich Instruments Settings builder class.

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

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

Tip

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

__init__()[source]

Creates a new instance of ZISettingsBuilder

build()[source]

Builds the ZISettings class.

Return type
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
Returns

with_commandtable_data(awg_index, json_data)[source]

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

Parameters
Return type
Returns

with_compiler_sourcestring(awg_index, seqc)[source]

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

Parameters
Return type
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
Returns

with_defaults(defaults)[source]

Parameters
Return type
Returns

with_gain(awg_index, gain)[source]

Adds the gain settings for the Instruments awg by index.

Parameters
Return type
Returns

with_qas_delay(delay)[source]

Parameters

delay (intint) –

Return type
Returns

with_qas_integration_length(n_samples)[source]

Adds the Instruments QAS Monitor integration length setting.

Parameters

n_samples (intint) –

Return type
Returns

with_qas_integration_mode(mode)[source]

Adds the Instruments QAS Monitor integration mode setting.

Parameters
Return type
Returns

with_qas_integration_weights_imag(channels, imag)[source]

Adds the Instruments QAS Monitor integration imaginary weights setting.

Parameters
Return type
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
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
Returns

with_qas_monitor_enable(enabled)[source]

Adds the Instruments QAS Monitor enable setting.

Parameters

enabled (boolbool) –

Return type
Returns

with_qas_monitor_length(n_samples)[source]

Adds the Instruments QAS Monitor length setting.

Parameters

n_samples (intint) –

Return type
Returns

with_qas_monitor_reset(value)[source]

Adds the Instruments QAS Monitor reset setting.

Parameters

value (intint) –

Return type
Returns

with_qas_result_averages(n_averages)[source]

Adds the Instruments QAS Monitor result averages setting.

Parameters

n_averages (intint) –

Return type
Returns

with_qas_result_enable(enabled)[source]

Adds the Instruments QAS Monitor result enable setting.

Parameters

enabled (boolbool) –

Return type
Returns

with_qas_result_length(n_samples)[source]

Adds the Instruments QAS Monitor result length setting.

Parameters

n_samples (intint) –

Return type
Returns

with_qas_result_mode(mode)[source]

Adds the Instruments QAS Monitor result mode setting.

Parameters
Return type
Returns

with_qas_result_reset(value)[source]

Adds the Instruments QAS Result reset setting.

Parameters

value (intint) –

Return type
Returns

with_qas_result_source(mode)[source]

Adds the Instruments QAS Monitor result source setting.

Parameters
Return type
Returns

with_qas_rotations(channels, value)[source]

Adds the Instruments QAS rotation setting.

Parameters
• value () – Number of degrees or a complex value.

Return type
Returns

with_sigout_offset(channel_index, offset_in_millivolts)[source]

Adds the channel sigout offset setting in volts.

Parameters
Return type
Returns

with_sigouts(awg_index, outputs)[source]

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

Parameters
Return type
Returns

with_system_channelgrouping(channelgrouping)[source]

Parameters

channelgrouping (intint) –

Return type
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
Returns

### types¶

#### common¶

Common python dataclasses for multiple backends.

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

The backend LocalOscillator record type.

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

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

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

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

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

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

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

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

The mixer corrections record type.

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

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

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

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

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

The backend Modulation record type.

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

1. no modulation. (‘none’)

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

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

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

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

#### qblox¶

Python dataclasses for compilation to Qblox hardware.

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

Shared settings between all the Qblox modules.

offset_ch0_path0: Optional[float] = None

The DC offset on the path 0 of channel 0.

offset_ch0_path1: Optional[float] = None

The DC offset on the path 1 of channel 0.

offset_ch1_path0: Optional[float] = None

The DC offset on path 0 of channel 1.

offset_ch1_path1: Optional[float] = None

The DC offset on path 1 of channel 1.

scope_mode_sequencer: Optional[str] = None

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

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

Settings for a baseband module.

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

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

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

Parameters
• mapping () – 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
class BoundedParameter(min_val, max_val, units)[source]

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

max_val: float

Max value allowed.

min_val: float

Min value allowed.

units: str

Units in which the parameter is specified.

class LOSettings(power, frequency)[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. The required format is {“frequency”: {parameter_name: value}, “power”: {parameter_name: value}}. For convenience {“frequency”: value, “power”: value} is also allowed.

Parameters

mapping () – The part of the mapping dict relevant for this instrument.

Return type
Returns

Instantiated LOSettings from the mapping dict.

frequency: Dict[str, Optional[float]]

The frequency to set the LO to.

power: Dict[str, float]

Power of the LO source.

class MarkerConfiguration(init, start, end)[source]

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

end: Optional[int]

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

init: Optional[int]

Value to set in the header before the wait sync.

start: Optional[int]

The setting set in the header at the start of the program (after the wait sync).

class OpInfo(name, data, timing)[source]

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

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

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

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

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

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

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

Parameters
• mapping () – 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
class PulsarSettings(scope_mode_sequencer=None, offset_ch0_path0=None, offset_ch0_path1=None, offset_ch1_path0=None, offset_ch1_path1=None, ref='internal')[source]

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

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

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

Parameters
• mapping () – 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
ref: str = 'internal'

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

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

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

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

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

Parameters
• mapping () – 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
lo0_freq: Optional[float] = None

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

lo1_freq: Optional[float] = None

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

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

Sequencer level settings.

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

classmethod initialize_from_config_dict(seq_settings, connected_outputs)[source]

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

Parameters

seq_settings () – The sequencer configuration dict.

Return type
Returns

The class with initial values.

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

Specifies which physical outputs this sequencer produces waveform data for.

integration_length_acq: Optional[int] = None

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

mixer_corr_gain_ratio: float = 1.0

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

mixer_corr_phase_offset_degree: float = 0.0

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

modulation_freq: float = None

Specifies the frequency of the modulation.

nco_en: bool

Specifies whether the NCO will be used or not.

sync_en: bool

Enables party-line synchronization.

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

Specifies the fixed hardware properties needed in the backend.

instrument_type: str

The type of instrument.

marker_configuration: quantify_scheduler.backends.types.qblox.MarkerConfiguration

The marker configuration to use.

max_awg_output_voltage: float

Maximum output voltage of the awg.

max_sequencers: int

The amount of sequencers available.

mixer_dc_offset_range: quantify_scheduler.backends.types.qblox.BoundedParameter

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

#### zhinst¶

Python dataclasses for quantify-scheduler json-schemas.

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

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

class CommandTable(table)[source]

The CommandTable definition for ZI HDAWG.

class CommandTableEntry(index, waveform)[source]

The definition of a single CommandTable entry.

class CommandTableEntryValue(value)[source]

A CommandTable entry definition with a value.

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

class CommandTableWaveform(index, length)[source]

The command table waveform properties.

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

The device definition class for zhinst devices.

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

Parameters
class DeviceType(value)[source]

Enum of device types.

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

Sequence base instruction record type.

static default()[source]

Returns a default Instruction instance.

Returns

Return type

Instruction

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

Instrument information record type.

class Output(port, clock, mode, modulation, local_oscillator, clock_frequency=None, gain1=0, gain2=0, 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
class QasIntegrationMode(value)[source]

Operation mode of all weighted integration units.

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

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

class QasResultMode(value)[source]

UHFQA QAS result mode.

class QasResultSource(value)[source]

UHFQA QAS result source.

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

This instruction indicates that a waveform should be played.

class WaveformDestination(value)[source]

The waveform destination enum type.

## device_under_test¶

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

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

### quantum_device¶

Module containing the QuantumDevice object.

class QuantumDevice(name)[source]

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

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

add_component(component)[source]

Adds a component to the components collection.

Parameters

component (InstrumentInstrument) – The component to add.

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

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

Return type
generate_device_config()[source]

Generates a device config to compile from the quantum-circuit to the quantum-device layer.

Return type
generate_hardware_config()[source]

Generates a valid hardware configuration describing the quantum device.

Return type
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
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

### transmon_element¶

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

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

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

__init__(name, **kwargs)[source]

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

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

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


q0:
parameter              value
--------------------------------------------------------------------------------
IDN                     :	None
acquisition             :	SSBIntegrationComplex
fl_port                 :	q0:fl
freq_01                 :	nan (Hz)
freq_12                 :	nan (Hz)
init_duration           :	0.0002 (s)
instrument_coordinator  :	None
mw_01_clock             :	q0.01
mw_12_clock             :	q0.12
mw_amp180               :	nan (V)
mw_ef_amp180            :	nan (V)
mw_motzoi               :	0
mw_port                 :	q0:mw
mw_pulse_duration       :	2e-08 (s)
ro_acq_channel          :	0 (#)
ro_acq_delay            :	0 (s)
ro_acq_integration_time :	1e-06 (s)
ro_acq_weight_type      :	SSB
ro_clock                :	q0.ro
ro_freq                 :	nan (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           :	SquarePulse
spec_pulse_amp          :	0.5 (V)
spec_pulse_clock        :	q0.01
spec_pulse_duration     :	8e-06 (s)
spec_pulse_frequency    :	nan (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
generate_device_config()[source]

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

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

Return type

### waveforms¶

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

Protocol type definition class for the get_waveform partial function.

apply_mixer_skewness_corrections(waveform, amplitude_ratio, phase_shift)[source]

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

Phase correction is done using:

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

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

Parameters
Return type
Returns

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

area_pulse(pulse, sampling_rate)[source]

Calculates the area of a single pulse.

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

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

Parameters
Return type
Returns

The area defined by the pulse

area_pulses(pulses, sampling_rate)[source]

Calculates the area of a set of pulses.

For details of the calculation see area_pulse.

Parameters
Return type
Returns

The area formed by all the pulses

exec_custom_waveform_function(wf_func, t, pulse_info)[source]

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

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

Parameters
Return type
Returns

Returns the computed waveform.

exec_waveform_function(wf_func, t, pulse_info)[source]

Returns the result of the pulse’s waveform function.

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

Parameters
Return type
Returns

Returns the computed waveform.

exec_waveform_partial(pulse_id, pulseid_waveformfn_dict, sampling_rate)[source]

Returns the result of the partial waveform function.

Parameters
Return type
Returns

The waveform array.

get_waveform(pulse_info, sampling_rate)[source]

Returns the waveform of a pulse_info dictionary.

Parameters
Return type
Returns

The waveform.

get_waveform_by_pulseid(schedule)[source]

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

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

Parameters

schedule (ScheduleSchedule) – The schedule.

Return type
get_waveform_size(waveform, granularity)[source]

Returns the number of samples required to respect the granularity.

Parameters
Return type
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
Return type
Returns

The modulated waveform

normalize_waveform_data(data)[source]

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

Parameters

data (ndarrayndarray) – The waveform data to rescale.

Return type
Returns

• rescaled_data – The rescaled data.

• amp_real – The original amplitude of the real part.

• amp_imag – The original amplitude of the imaginary part.

resize_waveform(waveform, granularity)[source]

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

Parameters
Return type
Returns

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

resize_waveforms(waveforms_dict, granularity)[source]

Resizes the waveforms to a multiple of the given granularity.

Parameters
Return type
shift_waveform(waveform, start_in_seconds, sampling_rate, resolution)[source]

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

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

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

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

start_waveform_at_sequener_count(start_in_sequencer_count, waveform)

Parameters
Return type

## instrument_coordinator¶

Import alias

Maps to

quantify_scheduler.instrument_coordinator.InstrumentCoordinator

InstrumentCoordinator

quantify_scheduler.instrument_coordinator.ZIInstrumentCoordinator

ZIInstrumentCoordinator

### instrument_coordinator¶

Module containing the main InstrumentCoordinator Component.

class InstrumentCoordinator(name, add_default_generic_icc=True)[source]

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.

__init__(name, add_default_generic_icc=True)[source]

Instantiates a new instrument coordinator.

Parameters
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
get_component(name)[source]

Returns the InstrumentCoordinator component by name.

Parameters

name (strstr) – The component name.

Return type
Returns

The component.

Raises

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

prepare(compiled_schedule)[source]

Prepares each component for execution of a schedule.

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

Parameters

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

Raises
Return type
remove_component(name)[source]

Removes a component by name.

Parameters

name (strstr) – The component name.

Return type
retrieve_acquisition()[source]

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

Return type
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
stop(allow_failure=False)[source]

Stops all components.

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

Parameters

allow_failure – By default it is set to False. When set to True, the AttributeErrors raised by a component are demoted to warnings to allow other components to stop.

Return type
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
property is_running

Returns if any of the InstrumentCoordinator components is running.

Return type
Returns

The InstrumentCoordinator’s running state.

property last_schedule

Returns the last schedule used to prepare the instrument coordinator.

This feature is intended to aid users in debugging.

Return type
class ZIInstrumentCoordinator(*args, **kwargs)[source]

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

retrieve_acquisition()[source]

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

Returns

The acquisition data per component.

### components¶

Import alias

Maps to

quantify_scheduler.instrument_coordinator.components.InstrumentCoordinatorComponentBase

InstrumentCoordinatorComponentBase

#### base¶

Module containing the InstrumentCoordinator interface.

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

The InstrumentCoordinator component abstract interface.

__init__(instrument, **kwargs)[source]

Instantiates the InstrumentCoordinatorComponentBase base class.

close()[source]

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

Return type
abstract prepare(options)[source]

Initializes the InstrumentCoordinator Component with parameters.

Return type
abstract retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type
abstract start()[source]

Starts the InstrumentCoordinator Component.

Return type
abstract stop()[source]

Stops the InstrumentCoordinator Component.

Return type
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
property instrument

Returns the instrument referenced by instrument_ref.

Return type
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
Returns

The components’ running state.

instrument_to_component_name(instrument_name)[source]

Gives the name of the instrument coordinator component.

Parameters

instrument_name (strstr) – The name of the instrument.

Return type
Returns

The name of the instrument coordinator component.

#### generic¶

Module containing a Generic InstrumentCoordinator Component.

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

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

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

prepare(params_config)[source]

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

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

Return type
retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type
start()[source]

Starts the InstrumentCoordinator Component.

Return type
stop()[source]

Stops the InstrumentCoordinator Component.

Return type
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
property instrument

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

property is_running

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

Return type

#### qblox¶

Module containing Qblox InstrumentCoordinator Components.

class AcquisitionIndexing(acq_channel, acq_index)

Bases: tuple

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

acq_channel

Alias for field number 0

acq_index

Alias for field number 1

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

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

__init__(instrument, **kwargs)[source]

Create a new instance of the ClusterComponent.

Parameters
add_modules(*modules)[source]

Parameters

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

Return type
prepare(options)[source]

Prepares the cluster component for execution of a schedule.

Parameters

options () – The compiled instructions to configure the cluster to.

Return type
retrieve_acquisition()[source]

Retrieves all the data from the instruments.

Return type
Returns

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

start()[source]

Starts all the modules in the cluster.

Return type
stop()[source]

Stops all the modules in the cluster.

Return type
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
property is_running

Returns true if any of the modules are currently running.

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

Bases: quantify_scheduler.instrument_coordinator.components.qblox._QCMComponent

A component for a baseband Pulsar QCM.

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 () – 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
class PulsarQRMComponent(instrument, **kwargs)[source]

Bases: quantify_scheduler.instrument_coordinator.components.qblox._QRMComponent

A component for a baseband Pulsar QRM.

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 () – 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
class QbloxInstrumentCoordinatorComponentBase(instrument, **kwargs)[source]

Qblox InstrumentCoordinator component base class.

__init__(instrument, **kwargs)[source]

Create a new instance of QbloxInstrumentCoordinatorComponentBase base class.

start()[source]

Starts execution of the schedule.

Return type
stop()[source]

Stops all execution.

Return type
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
property is_running

Finds if any of the sequencers is currently running.

Return type
Returns

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

ClusterModule

Type that combines all the possible modules for a cluster.

alias of Union[quantify_scheduler.instrument_coordinator.components.qblox._QCMComponent, quantify_scheduler.instrument_coordinator.components.qblox._QRMComponent, quantify_scheduler.instrument_coordinator.components.qblox._QRMRFComponent, quantify_scheduler.instrument_coordinator.components.qblox._QCMRFComponent]

#### zhinst¶

Module containing Zurich Instruments InstrumentCoordinator Components.

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

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
start()[source]

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

Return type
stop()[source]

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

Return type
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
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
Returns

The components’ running state.

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

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
Returns

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

retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type
start()[source]

Starts the InstrumentCoordinator Component.

Return type
stop()[source]

Stops the InstrumentCoordinator Component.

Return type
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
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
Returns

The components’ running state.

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

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
Returns

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

retrieve_acquisition()[source]

Gets and returns acquisition data.

Return type
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
Returns

The components’ running state.

convert_to_instrument_coordinator_format(acquisition_results, n_acquisitions, bin_mode)[source]

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

## operations¶

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

Tip

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

### acquisition_library¶

Standard acquisition protocols for use with the quantify_scheduler.

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

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

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

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

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

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

Weights are applied as:

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

• weights_b () – The list of complex values used as weights $$B(t)$$ on the incoming complex signal.

• t () – The time values of each weight.

• port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Parameters
• port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

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

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

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

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

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

Parameters
• port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

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

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

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

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

Weights are applied as:

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

• waveform_b () – The complex waveform used as integration weights $$B(t)$$.

• port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

Raises

### gate_library¶

Standard gateset for use with the quantify_scheduler.

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

Conditional-NOT gate, a common entangling gate.

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

This operation can be represented by the following unitary:

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

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

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

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

Conditional-phase gate, a common entangling gate.

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

This operation can be represented by the following unitary:

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

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

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

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

A projective measurement in the Z-basis.

Note

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

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

Gate level description for a measurement.

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

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

• acq_channel ( (default: None)) – Acquisition channel on which the measurement is performed

• acq_index ( (default: None)) – Index of the register where the measurement is stored. If None specified, it will default if a tuple(0

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

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

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

Reset a qubit to the $$|0\rangle$$ state.

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

Note

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

Examples

The operation can be used in several ways:

from quantify_scheduler.operations.gate_library import Reset

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

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

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

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

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

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

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

This operation can be represented by the following unitary as defined in https://doi.org/10.1109/TQE.2020.2965810:

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