quantify_scheduler

types

Module containing the core concepts of the scheduler.

class quantify_scheduler.types.Operation(name, data=None)[source]

A JSON compatible data structure that contains information on how to represent the operation on the quantum-circuit and/or the quantum-device layer. It also contains information on where the operation should be applied: the Resource s used.

An operation always has the following attributes:

  • duration (float): duration of the operation in seconds (can be 0).

  • hash (str): an auto generated unique identifier.

  • name (str): a readable identifier, does not have to be unique.

An Operation can contain information on several levels of abstraction. This information is used when different representations are required. Note that when initializing an operation not all of this information needs to be available as operations are typically modified during the compilation steps.

Tip

quantify_scheduler comes with a gate_library and a pulse_library , both containing common operations.

JSON schema of a valid Operation

JSON schema for a quantify sequencer operation.

type

object

properties

  • name

type

string

  • gate_info

type

object

properties

  • unitary

A unitary matrix describing the operation.

  • qubits

A list of strings indicating the qubits the gate acts on. Valid qubits are strings that appear in the device_config.json file.

type

array

  • tex

latex snippet for plotting

type

string

  • plot_func

reference to a function for plotting this operation. If not specified, defaults to using gate_box().

type

string / null

additionalProperties

True

  • pulse_info

A list containing the pulses that are part of the operation

type

array

items

Info to generate an individual pulse.

type

object

properties

  • port

A string specifying the port used by the pulse.

type

string / null

  • clock

A string specifying the clock used to modulate the pulse.

type

string

  • wf_func

reference to a function to generate the pulse of this operation.

type

string / null

  • t0

Starting time of the pulse with respect to the start of the operation in seconds.

type

number

  • duration

The duration of the pulse in seconds.

type

number

  • acquisition_info

A list containing the acquisitions that are part of the operation

type

array

items

Info to generate an individual acquisition.

type

object

properties

  • port

A string specifying the port used by the acquisition.

type

string

  • clock

A string specifying the clock used to demodulate the acquisition.

type

string

  • t0

Starting time of the pulse with respect to the start of the operation in seconds.

type

number

  • duration

The duration of the acquisition in seconds.

type

number

additionalProperties

True

  • logic_info

Not Implemented.

additionalProperties

False

Note

Two different Operations containing the same information generate the same hash and are considered identical.

add_acquisition(acquisition_operation)[source]

Adds acquisition_info of acquisition_operation Operation to this Operation.

Parameters

acquisition_operation (OperationOperation) – an operation containing acquisition_info.

Return type

NoneNone

add_gate_info(gate_operation)[source]

Updates self.data[‘gate_info’] with contents of gate_operation.

Parameters

gate_operation (OperationOperation) – an operation containing gate_info.

Return type

NoneNone

add_pulse(pulse_operation)[source]

Adds pulse_info of pulse_operation Operation to this Operation.

Parameters

pulse_operation (OperationOperation) – an operation containing pulse_info.

Return type

NoneNone

classmethod is_valid(operation)[source]

Checks if the operation is valid according to its schema.

Return type

boolbool

property duration

Determine the duration of the operation based on the pulses described in pulse_info.

If the operation contains no pulse info, it is assumed to be ideal and have zero duration.

Return type

floatfloat

property hash

A hash based on the contents of the Operation.

Return type

intint

property name

Return the name of the operation.

Return type

strstr

property valid_acquisition

An operation is a valid acquisition if it contains information on how to represent the operation as a acquisition on the pulse level.

Return type

boolbool

property valid_gate

An operation is a valid gate if it contains information on how to represent the operation on the gate level.

Return type

boolbool

property valid_pulse

An operation is a valid pulse if it contains information on how to represent the operation on the pulse level.

Return type

boolbool

class quantify_scheduler.types.Schedule(name, repetitions=1, data=None)[source]

A collection of Operation objects and timing constraints that define relations between the operations.

The Schedule data structure is based on a dictionary. This dictionary contains:

  • operation_dict - a hash table containing the unique Operation s added to the schedule.

  • timing_constraints - a list of all timing constraints added between operations.

The Schedule is a data structure that is at the core of the Quantify-scheduler. The Schedule contains information on when operations should be performed.

When adding an Operation to a Schedule using the add() method, it is possible to specify precisely when to perform this operation using timing constraints. However, at this point it is not required to specify how to represent this Operation on all layers. Instead, this information can be added later during compilation. This allows the user to effortlessly mix the gate- and pulse-level descriptions as required for many (calibration) experiments.

The Schedule contains information on the operations and timing_constraints. The operations is a dictionary of all unique operations used in the schedule and contain the information on what operation to apply where. The timing_constraints is a list of dictionaries describing timing constraints between operations, i.e. when to apply an operation.

JSON schema of a valid Schedule

JSON schema for a quantify schedule.

type

object

properties

  • name

Name of the schedule.

type

string

  • repetitions

The amount of times the schedule will be repeated.

type

integer

default

1

  • timing_constraints

A list containing timing constraints.

type

array

  • operation_dict

A dictionary of operations. Keys correspond to the hash attribute of operations.

type

object

  • resource_dict

A dictionary of resources.

type

object

additionalProperties

False

__init__(name, repetitions=1, data=None)[source]

Initialize a new instance of Schedule.

Parameters
  • name (strstr) – The name of the schedule

  • repetitions (intint (default: 1)) – The amount of times the schedule will be repeated, by default 1

  • data (dict | NoneOptional[dict] (default: None)) – A dictionary containing a pre-existing schedule., by default None

Raises

NotImplementedError

add(operation, rel_time=0, ref_op=None, ref_pt='end', ref_pt_new='start', label=None)[source]

Add an Operation to the schedule and specify timing constraints.

A timing constraint constrains the operation in time by specifying the time ("rel_time") between a reference operation and the added operation. The time can be specified with respect to the “start”, “center”, or “end” of the operations. The reference operation ("ref_op") is specified using its label property. See also timing_constraints.

Parameters
  • operation (OperationOperation) – The operation to add to the schedule

  • rel_time (floatfloat (default: 0)) – relative time between the reference operation and the added operation. the time is the time between the “ref_pt” in the reference operation and “ref_pt_new” of the operation that is added.

  • ref_op (str | NoneOptional[str] (default: None)) – label of the reference operation. If set to None, will default to the last added operation.

  • ref_pt ({‘start’, ‘center’, ‘end’}Literal[‘start’, ‘center’, ‘end’] (default: 'end')) – reference point in reference operation must be one of (‘start’, ‘center’, ‘end’).

  • ref_pt_new ({‘start’, ‘center’, ‘end’}Literal[‘start’, ‘center’, ‘end’] (default: 'start')) – reference point in added operation must be one of (‘start’, ‘center’, ‘end’).

  • label (str | NoneOptional[str] (default: None)) – a unique string that can be used as an identifier when adding operations. if set to None, a random hash will be generated instead.

Return type

strstr

Returns

returns the (unique) label of the last added operation.

add_resource(resource)[source]

Add a resource such as a channel or qubit to the schedule.

Return type

NoneNone

add_resources(resources_list)[source]

Add wrapper for adding multiple resources

Return type

NoneNone

classmethod from_json(data)[source]

Converts the JSON data to a Schedule.

Parameters

data (strstr) – The JSON data.

Return type

ScheduleSchedule

Returns

The Schedule object.

classmethod is_valid(schedule)[source]

Checks the schedule validity according to its schema.

Return type

boolbool

to_json()[source]

Converts the Schedule data structure to a JSON string.

Return type

strstr

Returns

The json string result.

property name

Returns the name of the schedule.

Return type

strstr

property operations

A dictionary of all unique operations used in the schedule. This specifies information on what operation to apply where.

The keys correspond to the hash and values are instances of Operation.

Return type

{str: Operation}Dict[str, Operation]

property repetitions

Returns the amount of times this Schedule will be repeated.

Return type

intint

Returns

The repetitions count.

property resources

A dictionary containing resources. Keys are names (str), values are instances of Resource.

Return type

{str: Resource}Dict[str, Resource]

property timing_constraints

A list of dictionaries describing timing constraints between operations.

A timing constraint constrains the operation in time by specifying the time ("rel_time") between a reference operation and the added operation. The time can be specified with respect to a reference point ("ref_pt"') on the reference operation (:code:”ref_op”) and a reference point on the next added operation (:code:”ref_pt_new”’). A reference point can be either the “start”, “center”, or “end” of an operations. The reference operation ("ref_op") is specified using its label property.

Each item in the list represents a timing constraint and is a dictionary with the following keys:

['label', 'rel_time', 'ref_op', 'ref_pt_new', 'ref_pt', 'operation_repr']

The label is used as a unique identifier that can be used as a reference for other operations, the operation_repr refers to the string representation of a operation in operations.

Note

timing constraints are not intended to be modified directly. Instead use the add()

Return type

List[Dict[str, Any]]List[Dict[str, Any]]

enums

Enums for quantify-scheduler.

class quantify_scheduler.enums.BinMode(value)[source]

The acquisition protocol bin mode enum type.

Used to set the bin type to append or average respectively.

BinMode APPEND uses a list where every new result will be appended to the list.

BinMode AVERAGE incrementally stores the weighted average result.

class quantify_scheduler.enums.InstrumentOperationMode(value)[source]

The InstrumentOperationMode enum defines in what operational mode an instrument is in.

OPERATING mode sets the Instrument in its default operation mode. CALIBRATING mode sets the Instrument in calibration mode in which for example the numeric pulses generated by a backend for an AWG are set to np.ones.

class quantify_scheduler.enums.ModulationModeType(value)[source]

The modulation mode enum type.

Used to set the modulation type to None, premodulation or hardware modulation respectively.

class quantify_scheduler.enums.ReferenceSourceType(value)[source]

The reference source enum type.

Used to set the source trigger type to internal or external respectively.

class quantify_scheduler.enums.SignalModeType(value)[source]

The signal output enum type.

Used to set the output signal type to a modulated or real respectively.

gate_library

Standard gateset for use with the quantify_scheduler.

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

Conditional-NOT gate, a common entangling gate.

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

This operation can be represented by the following unitary:

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

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

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

Parameters
  • qC (strstr) – The control qubit.

  • qT (strstr) – The target qubit

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

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

Conditional-phase gate, a common entangling gate.

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

This operation can be represented by the following unitary:

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

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

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

Parameters
  • qC (strstr) – The control qubit.

  • qT (strstr) – The target qubit

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

class quantify_scheduler.gate_library.Measure(*qubits, acq_channel=None, acq_index=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, data=None)[source]

Gate level description for a measurement.

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

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

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

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

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

class quantify_scheduler.gate_library.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.gate_library import Reset

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

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

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

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

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

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

This operation can be represented by the following unitary:

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

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

Parameters
  • theta (floatfloat) – rotation angle in degrees

  • phi (floatfloat) – phase of the rotation axis

  • qubit (strstr) – the target qubit

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

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

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

This operation can be represented by the following unitary:

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

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

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

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

__init__(qubit, data=None)[source]

Create a new instance of X90.

Parameters
  • qubit (strstr) – The target qubit.

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

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

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

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

Create a new instance of Y.

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

Parameters
  • qubit (strstr) – The target qubit.

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

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

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

__init__(qubit, data=None)[source]

Create a new instance of Y90.

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

Parameters
  • qubit (strstr) – The target qubit.

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

pulse_library

Standard pulses for use with the quantify_scheduler.

class quantify_scheduler.pulse_library.ChirpPulse(amp, duration, port, clock, start_freq, end_freq, t0=0)[source]

A linear chirp signal. A sinusoidal signal that ramps up in frequency.

__init__(amp, duration, port, clock, start_freq, end_freq, t0=0)[source]

Constructor for a chirp pulse.

Parameters
  • amp (floatfloat) – Amplitude of the envelope.

  • duration (floatfloat) – Duration of the pulse.

  • port (strstr) – The port of the pulse.

  • clock (strstr) – Clock used to modulate the pulse.

  • start_freq (floatfloat) – Start frequency of the Chirp. Note that this is the frequency at which the waveform is calculated, this may differ from the clock frequency.

  • end_freq (floatfloat) – End frequency of the Chirp.

  • t0 (floatfloat (default: 0)) – Shift of the start time with respect to the start of the operation.

class quantify_scheduler.pulse_library.DRAGPulse(G_amp, D_amp, phase, clock, duration, port, t0=0, data=None)[source]

DRAG pulse intended for single qubit gates in transmon based systems.

A DRAG pulse is a gaussian pulse with a derivative component added to the out-of-phase channel to reduce unwanted excitations of the \(|1\rangle - |2\rangle\) transition.

The waveform is generated using waveforms.drag() .

References

  1. Gambetta, J. M., Motzoi, F., Merkel, S. T. & Wilhelm, F. K. Analytic control methods for high-fidelity unitary operations in a weakly nonlinear oscillator. Phys. Rev. A 83, 012308 (2011).

  1. F. Motzoi, J. M. Gambetta, P. Rebentrost, and F. K. Wilhelm Phys. Rev. Lett. 103, 110501 (2009).

__init__(G_amp, D_amp, phase, clock, duration, port, t0=0, data=None)[source]

Create a new instance of DRAGPulse.

Parameters
  • G_amp (floatfloat) – Amplitude of the Gaussian envelope.

  • D_amp (floatfloat) – Amplitude of the derivative component, the DRAG-pulse parameter.

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

  • phase (floatfloat) – Phase of the pulse in degrees.

  • clock (strstr) – Clock used to modulate the pulse.

  • port (strstr) – Port of the pulse, must be capable of carrying a complex waveform.

  • t0 (floatfloat (default: 0)) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.

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

class quantify_scheduler.pulse_library.IdlePulse(duration, data=None)[source]

The IdlePulse Operation is a placeholder for a specified duration of time.

__init__(duration, data=None)[source]

Create a new instance of IdlePulse.

The IdlePulse Operation is a placeholder for a specified duration of time.

Parameters
  • duration (floatfloat) – The duration of idle time in seconds.

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

class quantify_scheduler.pulse_library.RampPulse(amp, duration, port, clock='cl0.baseband', t0=0, data=None)[source]

The RampPulse Operation is a real-valued pulse that ramps from zero to the specified amplitude during the duration of the pulse.

__init__(amp, duration, port, clock='cl0.baseband', t0=0, data=None)[source]

Create a new instance of RampPulse.

The RampPulse Operation is a real-valued pulse that ramps from zero to the specified amplitude during the duration of the pulse.

Parameters
  • amp (floatfloat) – Final amplitude of the ramp envelope function.

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

  • port (strstr) – Port of the pulse.

  • clock (strstr (default: 'cl0.baseband')) – Clock used to modulate the pulse, by default a BasebandClock is used.

  • t0 (floatfloat (default: 0)) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.

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

class quantify_scheduler.pulse_library.SoftSquarePulse(amp, duration, port, clock, t0=0, data=None)[source]

The SoftSquarePulse Operation is a real valued square pulse convolved with a Hann window for smoothing.

__init__(amp, duration, port, clock, t0=0, data=None)[source]

Create a new instance of SoftSquarePulse.

The SoftSquarePulse Operation is a real valued square pulse convolved with a Hann window for smoothing.

Parameters
  • amp (floatfloat) – Amplitude of the envelope.

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

  • port (strstr) – Port of the pulse, must be capable of playing a complex waveform.

  • clock (strstr) – Clock used to modulate the pulse.

  • t0 (floatfloat (default: 0)) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.

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

class quantify_scheduler.pulse_library.SquarePulse(amp, duration, port, clock, phase=0, t0=0, data=None)[source]

The SquarePulse Operation is a real-valued pulse with the specified amplitude during the pulse.

__init__(amp, duration, port, clock, phase=0, t0=0, data=None)[source]

Create a new instance of SquarePulse.

The SquarePulse Operation is a real-valued pulse with the specified amplitude during the pulse.

Parameters
  • amp (floatfloat) – Amplitude of the envelope.

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

  • port (strstr) – Port of the pulse, must be capable of playing a complex waveform.

  • clock (strstr) – Clock used to modulate the pulse.

  • phase (floatfloat (default: 0)) – Phase of the pulse in degrees.

  • t0 (floatfloat (default: 0)) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.

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

class quantify_scheduler.pulse_library.StaircasePulse(start_amp, final_amp, num_steps, duration, port, clock='cl0.baseband', t0=0)[source]

A real valued staircase pulse, which reaches it’s final amplitude in discrete steps. In between it will maintain a plateau.

__init__(start_amp, final_amp, num_steps, duration, port, clock='cl0.baseband', t0=0)[source]

Constructor for a staircase.

Parameters
  • start_amp (floatfloat) – Starting amplitude of the staircase envelope function.

  • final_amp (floatfloat) – Final amplitude of the staircase envelope function.

  • num_steps (intint) – The number of plateaus.

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

  • port (strstr) – Port of the pulse.

  • clock (strstr (default: 'cl0.baseband')) – Clock used to modulate the pulse.

  • t0 (floatfloat (default: 0)) – Time in seconds when to start the pulses relative to the start time of the Operation in the Schedule.

quantify_scheduler.pulse_library.decompose_long_square_pulse(duration, duration_max, single_duration=False, **kwargs)[source]

Generates a list of square pulses equivalent to a (very) long square pulse.

Intended to be used for waveform-memory-limited devices. Effectively, only two square pulses, at most, will be needed: a main one of duration duration_max and a second one for potential mismatch between N duration_max and overall duration.

Parameters
  • duration (floatfloat) – Duration of the long pulse in seconds.

  • duration_max (floatfloat) – Maximum duration of square pulses to be generated in seconds.

  • single_duration (boolbool (default: False)) – If True, only square pulses of duration duration_max will be generated. If False, a square pulse of duration < duration_max might be generated if necessary.

  • **kwargs – Other keyword arguments to be passed to the SquarePulse.

Return type

listlist

Returns

A list of :class`SquarePulse` s equivalent to the desired long pulse.

acquisition_library

Standard acquisition protocols for use with the quantify_scheduler.

class quantify_scheduler.acquisition_library.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]
__init__(weights_a, weights_b, t, port, clock, interpolation='linear', acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, phase=0, t0=0, data=None)[source]

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

Weights are applied as:

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

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

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

  • port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

class quantify_scheduler.acquisition_library.SSBIntegrationComplex(port, clock, duration, acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, phase=0, t0=0, data=None)[source]
__init__(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 SSBIntegrationComplex. Single Sideband Integration acquisition protocol with complex results.

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

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

Parameters
  • port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

class quantify_scheduler.acquisition_library.Trace(duration, port, acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, t0=0, data=None)[source]

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

__init__(duration, port, acq_channel=0, acq_index=0, bin_mode=<BinMode.APPEND: 'append'>, 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.

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

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

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

  • bin_mode (BinMode | strUnion[BinMode, str] (default: <BinMode.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

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

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

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

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

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

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

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

Weights are applied as:

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

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

  • port (strstr) – The acquisition port.

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

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

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

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

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

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

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

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

Raises

NotImplementedError

resources

Common resources for use with the quantify_scheduler.

class quantify_scheduler.resources.BasebandClockResource(name, data=None)[source]

Global identity for a virtual baseband clock

__init__(name, data=None)[source]

A clock resource for pulses that operate at baseband.

Baseband signals are assumed to be real-valued and will not be modulated.

Parameters

name (strstr) – the name of this clock

class quantify_scheduler.resources.ClockResource(name, freq, phase=0, data=None)[source]

The ClockResource corresponds to a physical clock used to modulate pulses.

__init__(name, freq, phase=0, data=None)[source]

A clock resource used to modulate pulses.

Parameters
  • name (strstr) – the name of this clock

  • freq (floatfloat) – the frequency of the clock in Hz

  • phase (floatfloat (default: 0)) – the starting phase of the clock in deg

class quantify_scheduler.resources.Resource(name, data=None)[source]

A resource corresponds to a physical resource such as a port or a clock.

JSON schema for a quantify resource.

type

object

properties

  • name

Name of the resource.

type

string

  • type

Type of the resource, this property can be used by compilation steps.

type

string

additionalProperties

True

__init__(name, data=None)[source]

Create a new instance of Resource.

A resource corresponds to a physical resource such as a port or a clock.

Parameters
  • name (strstr) – The resource name.

  • data (dict | NoneOptional[dict] (default: None)) – The resource data dictionary, by default None

classmethod is_valid(operation)[source]

Validates the Resource against the schemas/resource.json jsonschema.

Parameters

operation

Raises
Returns

If the validation was successfull.

Return type

bool

property name

Returns the name of the Resource.

Return type

strstr

Returns

waveforms

Contains function to generate most basic waveforms.

These functions are intended to be used to generate waveforms defined in the pulse_library. Examples of waveforms that are too advanced are flux pulses that require knowledge of the flux sensitivity and interaction strengths and qubit frequencies.

quantify_scheduler.waveforms.chirp(t, amp, start_freq, end_freq)[source]

Produces a linear chirp signal. The frequency is determined according to the relation:

The waveform is produced simply by multiplying with a complex exponential.

Parameters
  • t (ndarrayndarray) – Times at which to evaluate the function.

  • amp (floatfloat) – Amplitude of the envelope.

  • start_freq (floatfloat) – Start frequency of the Chirp.

  • end_freq (floatfloat) – End frequency of the Chirp.

Return type

ndarrayndarray

Returns

The complex waveform.

quantify_scheduler.waveforms.drag(t, G_amp, D_amp, duration, nr_sigma=3, phase=0, subtract_offset='average')[source]

Generates a DRAG pulse consisting of a Gaussian \(G\) as the I- and a Derivative \(D\) as the Q-component.

All inputs are in s and Hz. phases are in degree.

\(G(t) = G_{amp} e^{-(t-\mu)^2/(2\sigma^2)}\).

\(D(t) = -D_{amp} \frac{(t-\mu)}{\sigma} G(t)\).

Parameters
  • t (ndarrayndarray) – Times at which to evaluate the function.

  • G_amp (floatfloat) – Amplitude of the Gaussian envelope.

  • D_amp (floatfloat) – Amplitude of the derivative component, the DRAG-pulse parameter.

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

  • nr_sigma (intint (default: 3)) – After how many sigma the Gaussian is cut off.

  • phase (floatfloat (default: 0)) – Phase of the pulse in degrees.

  • subtract_offset (strstr (default: 'average')) –

    Instruction on how to subtract the offset in order to avoid jumps in the waveform due to the cut-off.

    • ’average’: subtract the average of the first and last point.

    • ’first’: subtract the value of the waveform at the first sample.

    • ’last’: subtract the value of the waveform at the last sample.

    • ’none’, None: don’t subtract any offset.

Return type

ndarrayndarray

Returns

complex waveform

References

  1. Gambetta, J. M., Motzoi, F., Merkel, S. T. & Wilhelm, F. K. Analytic control methods for high-fidelity unitary operations in a weakly nonlinear oscillator. Phys. Rev. A 83, 012308 (2011).

  2. F. Motzoi, J. M. Gambetta, P. Rebentrost, and F. K. Wilhelm Phys. Rev. Lett. 103, 110501 (2009).

quantify_scheduler.waveforms.modulate_wave(t, wave, freq_mod)[source]

Apply single sideband (SSB) modulation to a waveform.

The frequency convention we adhere to is:

freq_base + freq_mod = freq_signal

Parameters
  • t (ndarrayndarray) – Times at which to determine the modulation.

  • wave (ndarrayndarray) – Complex waveform, real component corresponds to I, imaginary component to Q.

  • freq_mod (floatfloat) – Modulation frequency in Hz.

Return type

ndarrayndarray

Returns

modulated waveform.

Note

Pulse modulation is generally not included when specifying waveform envelopes as there are many hardware backends include this capability.

quantify_scheduler.waveforms.rotate_wave(wave, phase)[source]

Rotate a wave in the complex plane.

Parameters
  • wave (ndarrayndarray) – Complex waveform, real component corresponds to I, imaginary component to Q.

  • phase (floatfloat) – Rotation angle in degrees.

Return type

ndarrayndarray

Returns

Rotated complex waveform.

quantify_scheduler.waveforms.soft_square(t, amp)[source]

A softened square pulse.

Parameters
  • t

  • amp

quantify_scheduler.waveforms.staircase(t, start_amp, final_amp, num_steps)[source]

Ramps from zero to a finite value in discrete steps.

Parameters
Return type

ndarrayndarray

Returns

The real valued waveform.

schedules

spectroscopy_schedules

Module containing schedules for common spectroscopy experiments.

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

Generate a schedule for performing heterodyne spectroscopy.

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

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

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

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

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

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

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

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

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

Return type

ScheduleSchedule

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

Generate a schedule for performing two-tone spectroscopy.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Return type

ScheduleSchedule

timedomain_schedules

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

quantify_scheduler.schedules.timedomain_schedules.allxy_sched(qubit, element_select_idx='All', repetitions=1)[source]

Generate a schedule for performing an AllXY experiment.

Schedule sequence

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

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

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

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

  • element_select_idx ({‘All’} | intUnion[Literal[‘All’], int] (default: 'All')) – the index of the particular element of the AllXY experiment to exectute - or "All" for all elemements of the sequence.

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

Return type

ScheduleSchedule

Returns

An experiment schedule.

References

  1. Reed “Entanglement and Quantum Error Correction with Superconducting Qubits.” Yale University (2013).

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

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

Schedule sequence

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

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

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

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

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

Return type

ScheduleSchedule

Returns

An experiment schedule.

References

  1. Krantz et al. “A Quantum Engineer’s Guide to Superconducting Qubits.” Applied Physics Reviews (2019).

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

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

Note

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Return type

ScheduleSchedule

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

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

Schedule sequence

Reset – DRAG – Measure

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

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

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

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

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

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

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

Return type

ScheduleSchedule

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

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

Schedule sequence

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

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

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

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

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

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

Return type

ScheduleSchedule

Returns

An experiment schedule.

References

  1. Krantz et al. “A Quantum Engineer’s Guide to Superconducting Qubits.”Applied Physics Reviews (2019).

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

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

Schedule sequence

Reset – pi – Idle(tau) – Measure

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

Parameters
  • times (ndarray | floatUnion[ndarray, float]) – an array of wait times tau between the pi-pulse and the measurement.

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

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

Return type

ScheduleSchedule

Returns

An experiment schedule.

References

  1. Krantz et al. “A Quantum Engineer’s Guide to Superconducting Qubits.” Applied Physics Reviews (2019).

trace_schedules

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

Generate a schedule to perform raw trace acquisition.

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

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

  • pulse_delay (floatfloat) – The pulse delay in seconds.

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

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

  • integration_time (floatfloat) – The time in seconds to integrate.

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

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

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

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

Return type

ScheduleSchedule

Returns

The Raw Trace acquisition Schedule.

quantify_scheduler.schedules.trace_schedules.two_tone_trace_schedule(qubit_pulse_amp, qubit_pulse_duration, qubit_pulse_frequency, qubit_pulse_port, qubit_pulse_clock, ro_pulse_amp, ro_pulse_duration, ro_pulse_delay, ro_pulse_port, ro_pulse_clock, ro_pulse_frequency, ro_acquisition_delay, ro_integration_time, init_duration=0.0002, repetitions=1)[source]

Generate a schedule for performing a two-tone raw trace acquisition.

Parameters
  • qubit_pulse_amp (floatfloat) – The amplitude of the pulse in Volt.

  • qubit_pulse_duration (floatfloat) – The duration of the pulse in seconds.

  • qubit_pulse_frequency (floatfloat) – The pulse frequency in Hertz.

  • qubit_pulse_port (strstr) – The location on the device where the qubit pulse should be applied.

  • spec_pulse_clock – The reference clock used to track the pulse frequency.

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

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

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

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

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

  • ro_pulse_frequency (floatfloat) – The readout pulse frequency in Hertz.

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

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

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

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

Return type

ScheduleSchedule

Returns

The Two-tone Trace acquisition Schedule.

device_elements

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.

class quantify_scheduler.device_elements.transmon_element.TransmonElement(name, **kwargs)[source]

Bases: qcodes.instrument.base.Instrument

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_elements import transmon_element
q0 = transmon_element.TransmonElement("q0")

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

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

generate_config()[source]

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

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

Return type

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

generate_device_config()[source]

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

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

Return type

{str: Any}Dict[str, Any]

compilation

Compiler for the quantify_scheduler.

quantify_scheduler.compilation.add_pulse_information_transmon(schedule, device_cfg)[source]

Adds pulse information specified in the device config to the schedule.

Parameters
  • schedule (ScheduleSchedule) – The schedule for which to add pulse information.

  • device_cfg (dictdict) – A dictionary specifying the required pulse information.

Return type

ScheduleSchedule

Returns

a new schedule object where the pulse information has been added.

Supported operations

The following gate type operations are supported by this compilation step.

Configuration specification

JSON schema for a transmon based device configuration.

type

object

properties

  • backend

Specifies the function used for compiling from gate-level to pulse-level description. A valid specification is a period separated string e.g., ‘quantify_scheduler.compilation.add_pulse_information_transmon’.

type

string

  • qubits

A dictionary with qubit names (str) as keys e.g., ‘q0’. The items contain the informtation to compile gates on individual qubits to pulses acting on ports and clocks using the specified backend.

type

object

  • edges

A dictionary with pairs of qubit names separated by a dash (str) as keys e.g., ‘q0-q1’. The items contain the informtation to compile gates on pairs of qubits to pulses acting on ports and clocks using the specified backend.

type

object

additionalProperties

False

quantify_scheduler.compilation.determine_absolute_timing(schedule, time_unit='physical')[source]

Determines the absolute timing of a schedule based on the timing constraints.

This function determines absolute timings for every operation in the timing_constraints. It does this by:

  1. iterating over all and elements in the timing_constraints.

  2. determining the absolute time of the reference operation.

  3. determining the start of the operation based on the rel_time and duration of operations.

Parameters
  • schedule (ScheduleSchedule) – The schedule for which to determine timings.

  • time_unit ({‘physical’, ‘ideal’}Literal[‘physical’, ‘ideal’] (default: 'physical')) – Whether to use physical units to determine the absolute time or ideal time. When time_unit == 'physical' the duration attribute is used. When time_unit == 'ideal' the duration attribute is ignored and treated as if it is 1.

Return type

ScheduleSchedule

Returns

a new schedule object where the absolute time for each operation has been determined.

quantify_scheduler.compilation.device_compile(schedule, device_cfg)[source]

Add pulse information to operations based on device config file.

Parameters
  • schedule (ScheduleSchedule) – To be compiled.

  • device_cfg (dictdict) – Device specific configuration, defines the compilation step from the gate-level to the pulse level description.

Return type

ScheduleSchedule

Returns

The updated schedule.

quantify_scheduler.compilation.qcompile(schedule, device_cfg, hardware_mapping=None, **kwargs)[source]

Compile and assemble a schedule into deployables.

Parameters
  • schedule (ScheduleSchedule) – To be compiled.

  • device_cfg (dictdict) – Device specific configuration, defines the compilation step from the gate-level to the pulse level description.

  • hardware_mapping (dict | NoneOptional[dict] (default: None)) – Hardware mapping, defines the compilation step from the pulse-level to a hardware backend.

Return type

ScheduleSchedule

Returns

The prepared schedule if no backend is provided, otherwise whatever object returned by the backend

Configuration specification

JSON schema for a transmon based device configuration.

type

object

properties

  • backend

Specifies the function used for compiling from gate-level to pulse-level description. A valid specification is a period separated string e.g., ‘quantify_scheduler.compilation.add_pulse_information_transmon’.

type

string

  • qubits

A dictionary with qubit names (str) as keys e.g., ‘q0’. The items contain the informtation to compile gates on individual qubits to pulses acting on ports and clocks using the specified backend.

type

object

  • edges

A dictionary with pairs of qubit names separated by a dash (str) as keys e.g., ‘q0-q1’. The items contain the informtation to compile gates on pairs of qubits to pulses acting on ports and clocks using the specified backend.

type

object

additionalProperties

False

Todo

Add a schema for the hardware mapping.

quantify_scheduler.compilation.validate_config(config, scheme_fn)[source]

Validate a configuration using a schema.

Parameters
  • config (dictdict) – The configuration to validate

  • scheme_fn (strstr) – The name of a json schema in the quantify_scheduler.schemas folder.

Return type

boolbool

Returns

True if valid

frontends

Frontends for the quantify_scheduler.

quantify_scheduler.frontends.openql_sequencer_frontend(filename)[source]

Reads an OpenQL cQASM file and converts

gettables

Module containing Gettables for use with quantify-scheduler.

Warning

The gettable module is expected to change significantly as the acquisition protocols (#36 and #80) get fully supported by the scheduler. Currently different Gettables are required for different acquisition modes. The intent is to have one generic ScheduleGettable. Expect breaking changes.

class quantify_scheduler.gettables.ScheduleVectorAcqGettable(device, schedule_function, schedule_kwargs, device_cfg, hardware_cfg, instr_coord, acq_instr, real_imag=True, hardware_averages=1024)[source]

Generic gettable for a quantify schedule using vector (I,Q) acquisition. Can be set to return either static (demodulated) I and Q values or magnitude and phase.

The gettable evaluates the parameters passed as schedule_kwargs, then generates the Schedule using the schedule_function, this is then compiled and finally executed by the InstrumentCoordinator.

__init__(device, schedule_function, schedule_kwargs, device_cfg, hardware_cfg, instr_coord, acq_instr, real_imag=True, hardware_averages=1024)[source]

Create a new instance of ScheduleVectorAcqGettable which is used to do I and Q acquisition.

Parameters
  • device (InstrumentInstrument) – The qcodes instrument.

  • schedule_function ((…) → ScheduleCallable[…, Schedule]) – A function which returns a Schedule.

  • schedule_kwargs ({str: Any}Dict[str, Any]) – The schedule function keyword arguments, when a value in this dictionary is a Parameter, this parameter will be evaluated every time .get() is called before being passed to the schedule_function.

  • device_cfg ({str: Any}Dict[str, Any]) – The device configuration dictionary.

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

  • instr_coord (InstrumentCoordinatorInstrumentCoordinator) – An instance of InstrumentCoordinator.

  • real_imag (boolbool (default: True)) – If true, the gettable returns I, Q values. Otherwise, magnitude and phase (degrees) are returned.

  • acq_instr (strstr) – Name of the instrument that is used to perform the acquisition.

  • hardware_averages (intint (default: 1024)) – The number of hardware averages.

get()[source]

Start the experimental sequence and retrieve acquisition data.

Return type

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

Returns

The acquired I/Q voltage signal as a complex number, split into a tuple of floats: either real/imaginary parts or magnitude/phase, depending on whether real_imag is True.

backends

qblox_backend

Compiler backend for Qblox hardware.

quantify_scheduler.backends.qblox_backend.generate_port_clock_to_device_map(mapping)[source]

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

Note

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

Parameters

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

Return type

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

Returns

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

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

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

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

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

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

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

Return type

{str: Any}Dict[str, Any]

Returns

The compiled program.

zhinst_backend

Backend for Zurich Instruments.

class quantify_scheduler.backends.zhinst_backend.ZIAcquisitionConfig(n_acquisitions, resolvers)[source]

Zurich Instruments acquisition configuration.

class quantify_scheduler.backends.zhinst_backend.ZIDeviceConfig(name, schedule, settings_builder, acq_config)[source]

Zurich Instruments device configuration.

quantify_scheduler.backends.zhinst_backend.apply_waveform_corrections(output, waveform, start_and_duration_in_seconds, instrument_info, is_pulse)[source]

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

Parameters
Return type

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

Returns

quantify_scheduler.backends.zhinst_backend.compile_backend(schedule, hardware_map)[source]

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

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

Parameters
Return type

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

Returns

A collection containing the compiled backend configuration for each device.

Raises

NotImplementedError – Thrown when using unsupported ZI Instruments.

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

Returns a timing critical execution table of Instructions.

Parameters
Raises

RuntimeError – Raised if encountered an unknown uuid.

Return type

List[Instruction]List[Instruction]

Returns

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

Returns the measurement sequence instruction.

Parameters
Return type

MeasureMeasure

Returns

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

Returns wave sequence instruction.

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

Parameters
Return type

WaveWave

Returns

types

Common python dataclasses for multiple backends.

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

The backend LocalOssilator record type.

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

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

class quantify_scheduler.backends.types.common.MixerCorrections(amp_ratio=1.0, phase_error=0.0, dc_offset_I=0.0, dc_offset_Q=0.0)[source]

The mixer corrections record type.

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

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

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

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

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

The backend Modulation record type.

Parameters
  • type (quantify_scheduler.enums.ModulationModeType) –

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

    1. no modulation (‘none’)

    2. Premodulation (‘premod’)

    3. IQ Modulation (‘modulate’)

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

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

Python dataclasses for compilation to Qblox hardware.

class quantify_scheduler.backends.types.qblox.LOSettings(power, lo_freq)[source]

Dataclass containing all the settings for a generic LO instrument.

classmethod from_mapping(mapping)[source]

Factory method for the LOSettings from a mapping dict.

Parameters

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

Return type

LOSettingsLOSettings

Returns

Instantiated LOSettings from the mapping dict.

lo_freq: Optional[float]

The frequency to set the LO to.

power: float

Power of the LO source.

class quantify_scheduler.backends.types.qblox.MixerCorrections(amp_ratio=1.0, phase_error=0.0, offset_I=0.0, offset_Q=0.0)[source]

Data structure that holds all the mixer correction parameters to compensate for skewness/lo feed-through. This class is used to correct the waveforms to compensate for skewness and to set the SequencerSettings.

correct_skewness(waveform)[source]

Applies the pre-distortion needed to compensate for amplitude and phase errors in the IQ mixer. In practice this is simply a wrapper around the apply_mixer_skewness_corrections function, that uses the attributes specified here.

Parameters

waveform (ndarrayndarray) – The (complex-valued) waveform before correction.

Return type

ndarrayndarray

Returns

The complex-valued waveform after correction.

amp_ratio: float = 1.0

Amplitude ratio between the I and Q paths to correct for the imbalance in the two path in the IQ mixer.

offset_I: float = 0.0

DC offset on the I path used to compensate for lo feed-through.

offset_Q: float = 0.0

DC offset on the Q path used to compensate for lo feed-through.

phase_error: float = 0.0

Phase shift used to compensate for quadrature errors.

class quantify_scheduler.backends.types.qblox.OpInfo(uuid, data, timing, pulse_settings=None)[source]

Data structure containing all the information describing a pulse or acquisition needed 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.

Returns

The duration of the pulse/acquisition.

Return type

float

property is_acquisition

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

Returns

Is this an acquisition?

Return type

bool

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

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

timing: float

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

uuid: str

A unique identifier for this pulse/acquisition.

class quantify_scheduler.backends.types.qblox.PulsarSettings(ref, hardware_averages=1, acq_mode='SSBIntegrationComplex')[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.

static extract_settings_from_mapping(mapping)[source]

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

Parameters

mapping ({str: Any}Dict[str, Any]) –

Return type

PulsarSettingsPulsarSettings

acq_mode: str = 'SSBIntegrationComplex'

The acquisition mode the Pulsar operates in. This setting will most likely change in the future.

hardware_averages: int = 1

The number of repetitions of the Schedule.

ref: str

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

class quantify_scheduler.backends.types.qblox.QASMRuntimeSettings(awg_gain_0, awg_gain_1, awg_offset_0=0.0, awg_offset_1=0.0)[source]

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

awg_gain_0: float

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

awg_gain_1: float

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

awg_offset_0: float = 0.0

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

awg_offset_1: float = 0.0

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

class quantify_scheduler.backends.types.qblox.SequencerSettings(nco_en, sync_en, modulation_freq=None, awg_offset_path_0=0.0, awg_offset_path_1=0.0, duration=0)[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.

awg_offset_path_0: float = 0.0

Sets the DC offset on path 0. This is used e.g. for calibration of lo leakage.

awg_offset_path_1: float = 0.0

Sets the DC offset on path 1. This is used e.g. for calibration of lo leakage when using IQ mixers.

duration: int = 0

Duration of the acquisition. This is a temporary addition for not yet merged the InstrumentCoordinator to function properly. This will be removed in a later version!

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.

Python dataclasses for quantify-scheduler json-schemas.

class quantify_scheduler.backends.types.zhinst.CommandTable(table)[source]

The CommandTable definition for ZI HDAWG.

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

The definition of a single CommandTable entry.

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

A CommandTable entry definition with a value.

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

The CommandTable header definition.

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

The command table waveform properties.

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

The device definition class for zhinst devices.

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

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

Enum of device types.

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

Sequence base instruction record type.

static default()[source]

Returns a default Instruction instance.

Returns

Return type

Instruction

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

Instrument information record type.

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

Sequence measurement instruction record type.

class quantify_scheduler.backends.types.zhinst.Output(port, clock, mode, modulation, local_oscillator, gain1=0, gain2=0, line_trigger_delay=-1, triggers=<factory>, markers=<factory>, mixer_corrections=None)[source]

The definition class for zhinst channel properties.

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

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

Operation mode of all weighted integration units.

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

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

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

UHFQA QAS result mode.

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

UHFQA QAS result source.

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

Sequence waveform instruction record type.

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

The waveform destination enum type.

qblox

Helper functions for Qblox backend.

exception quantify_scheduler.backends.qblox.helpers.DriverVersionError[source]

Raise when the installed driver version is not supported

quantify_scheduler.backends.qblox.helpers.find_all_port_clock_combinations(d)[source]

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

Parameters

d (dictdict) – The dictionary to traverse.

Return type

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

Returns

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

quantify_scheduler.backends.qblox.helpers.find_inner_dicts_containing_key(d, key)[source]

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

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

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

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

Return type

List[dict]List[dict]

Returns

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

quantify_scheduler.backends.qblox.helpers.generate_waveform_data(data_dict, sampling_rate)[source]

Generates an array using the parameters specified in data_dict.

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

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

Return type

ndarrayndarray

Returns

The (possibly complex) values of the generated waveform.

quantify_scheduler.backends.qblox.helpers.generate_waveform_names_from_uuid(uuid)[source]

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

Parameters

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

Return type

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

Returns

  • uuid_I – Name for the I waveform.

  • uuid_Q – Name for the Q waveform.

quantify_scheduler.backends.qblox.helpers.verify_qblox_instruments_version()[source]

Verifies whether the installed version is supported by the qblox_backend.

Raises

DriverVersionError – When an incorrect or no installation of qblox-instruments was found.

Contains the compiler container class.

class quantify_scheduler.backends.qblox.compiler_container.CompilerContainer(schedule)[source]

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

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

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

__init__(schedule)[source]

Constructor for the instrument container.

Parameters

schedule (ScheduleSchedule) – The schedule to be compiled.

add_instrument_compiler(name, instrument, mapping)[source]

Adds an instrument compiler to the container.

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

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

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

Return type

NoneNone

compile(repetitions)[source]

Performs the compilation for all the individual instruments.

Parameters

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

Return type

{str: Any}Dict[str, Any]

Returns

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

classmethod from_mapping(schedule, mapping)[source]

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

Parameters
Return type

CompilerContainerCompilerContainer

instrument_compilers

The compilers for the individual instruments.

resources

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

total_play_time

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

Compiler classes for Qblox backend.

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

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

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

Constructor for a local oscillator compiler.

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

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

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

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

compile(repetitions=1)[source]

Compiles the program for the LO InstrumentCoordinator component.

Parameters

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

Return type

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

Returns

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

property frequency

Getter for the frequency.

Return type

floatfloat

Returns

The current frequency.

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

Pulsar QCM specific implementation of the pulsar compiler.

sequencer_type

alias of quantify_scheduler.backends.qblox.instrument_compilers.QCMSequencer

add_acquisition(port, clock, acq_info)[source]

Raises an exception when called since the pulsar QCM does not support acquisitions.

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

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

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

Raises

RuntimeError – Always.

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

Pulsar QRM specific implementation of the pulsar compiler.

sequencer_type

The type of the sequencer.

alias of quantify_scheduler.backends.qblox.instrument_compilers.QRMSequencer

max_sequencers: int = 1

Maximum number of sequencer available in the instrument.

class quantify_scheduler.backends.qblox.instrument_compilers.QCMSequencer(parent, name, portclock, seq_settings, lo_name=None)[source]

Subclass of Pulsar_sequencer_base that is meant to implement all the parts that are specific to a Pulsar QCM sequencer.

awg_output_volt = 2.5

Voltage range of the awg output paths.

class quantify_scheduler.backends.qblox.instrument_compilers.QRMSequencer(parent, name, portclock, seq_settings, lo_name=None)[source]

Subclass of Pulsar_sequencer_base that is meant to implement all the parts that are specific to a Pulsar QRM sequencer.

awg_output_volt = 0.5

Voltage range of the awg output paths.

Compiler base and utility classes for Qblox backend.

class quantify_scheduler.backends.qblox.compiler_abc.ControlDeviceCompiler(parent, name, total_play_time, hw_mapping)[source]

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

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

Constructor for a ControlDeviceCompiler object.

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

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

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

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

add_acquisition(port, clock, acq_info)[source]

Assigns a certain acquisition to this device.

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

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

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

add_pulse(port, clock, pulse_info)[source]

Assigns a certain pulse to this device.

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

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

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

abstract compile(repetitions=1)[source]

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

Parameters

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

Return type

{str: Any}Dict[str, Any]

Returns

A data structure representing the compiled program.

property portclocks_with_data

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

Return type

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

Returns

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

class quantify_scheduler.backends.qblox.compiler_abc.InstrumentCompiler(parent, name, total_play_time, hw_mapping=None)[source]

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

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

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

Constructor for an InstrumentCompiler object.

Parameters
abstract compile(repetitions)[source]

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

Parameters

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

Return type

AnyAny

Returns

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

prepare()[source]

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

Return type

NoneNone

class quantify_scheduler.backends.qblox.compiler_abc.PulsarBase(parent, name, total_play_time, hw_mapping)[source]

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

This class is defined as an abstract base class since the distinction between Pulsar QRM and Pulsar QCM specific implementations are defined in subclasses. Effectively, this base class contains the functionality shared by the Pulsar QRM and Pulsar QCM and serves to avoid code duplication between the two.

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

Constructor function.

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

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

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

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

compile(repetitions=1)[source]

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

Parameters

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

Return type

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

Returns

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

prepare()[source]

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

Return type

NoneNone

abstract property max_sequencers

Specifies the maximum amount of sequencers available to this instrument.

Return type

intint

Returns

The maximum amount of sequencers

abstract property sequencer_type

Specifies whether the sequencers in this pulsar are QCM_sequencers or QRM_sequencers.

Return type

ABCMetaABCMeta

Returns

A pulsar sequencer type

class quantify_scheduler.backends.qblox.compiler_abc.PulsarSequencerBase(parent, name, portclock, seq_settings, lo_name=None)[source]

Abstract base class that specify the compilation steps on the sequencer level. The distinction between Pulsar QCM and Pulsar QRM is made by the subclasses.

__init__(parent, name, portclock, seq_settings, lo_name=None)[source]

Constructor for the sequencer compiler.

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

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

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

  • seq_settings (dictdict) – Sequencer settings dictionary.

align_modulation_frequency_with_ext_lo()[source]

Sets the frequencies so that the LO and IF frequencies follow the relation: \(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 will be thrown during assignment (in the setter method of the frequency).

Raises

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

compile(repetitions=1)[source]

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

Parameters

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

Return type

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

Returns

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

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

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

Example of a program generated by this function:

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

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

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

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

Return type

strstr

Returns

The generated QASM program.

static get_indices_from_wf_dict(uuid, wf_dict)[source]

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

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

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

Return type

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

Returns

  • Index of the I waveform.

  • Index of the Q waveform.

update_settings()[source]

Updates the sequencer settings to set all parameters that are determined by the compiler. Currently, this only changes the offsets based on the mixer calibration parameters.

abstract property awg_output_volt

The output range in volts. This is to be overridden by the subclass to account for the differences between a QCM and a QRM.

Return type

floatfloat

Returns

The output range in volts.

property frequency

The frequency used for modulation of the pulses.

Return type

floatfloat

Returns

The frequency.

property has_data

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

Return type

boolbool

Returns

Has data been assigned to this sequencer?

property name

The name assigned to this specific sequencer.

Return type

strstr

Returns

The name.

property portclock

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

Return type

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

Returns

The portclock.

property settings

Gives the current settings.

Return type

SequencerSettingsSequencerSettings

Returns

The settings set to this sequencer.

Constants for compilation to Qblox hardware.

quantify_scheduler.backends.qblox.constants.GRID_TIME = 4

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

quantify_scheduler.backends.qblox.constants.IMMEDIATE_SZ_GAIN = 65535

Size of gain instruction immediates in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.IMMEDIATE_SZ_OFFSET = 65535

Size of offset instruction immediates in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.IMMEDIATE_SZ_WAIT = 65535

Size of wait instruction immediates in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.NUMBER_OF_SEQUENCERS_QCM = 2

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

quantify_scheduler.backends.qblox.constants.NUMBER_OF_SEQUENCERS_QRM = 1

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

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

Duration of the individual pulses when pulse stitching is used.

quantify_scheduler.backends.qblox.constants.REGISTER_SIZE = 4294967295

Size of registers in Q1ASM programs.

quantify_scheduler.backends.qblox.constants.SAMPLING_RATE = 1000000000

Sampling rate of the Qblox Pulsar series instruments.

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

QASM program class for Qblox backend.

class quantify_scheduler.backends.qblox.qasm_program.QASMProgram(parent)[source]

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

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

auto_play_pulse(pulse, idx0, idx1)[source]

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

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

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

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

auto_wait(wait_time)[source]

Automatically emits a correct wait command. If the wait time is longer than allowed by the sequencer it correctly breaks it up into multiple wait instructions.

Parameters

wait_time (intint) – Time to wait in ns.

Raises

ValueError – If wait_time <= 0.

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

Wrapper around the get_instruction_as_list which adds it to this program.

Parameters
  • args – All arguments to pass to get_instruction_as_list.

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

Return type

NoneNone

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

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

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

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

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

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

Return type

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

Returns

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

Raises

SyntaxError – More arguments passed than the sequencer allows.

loop(register, label, repetitions=1)[source]

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

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

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

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

Examples

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

import inspect, os, json
from quantify_scheduler.types import Schedule
from quantify_scheduler.backends.qblox.qasm_program import QASMProgram
import quantify_scheduler.schemas.examples as es
from quantify_scheduler.backends.qblox import (
    instrument_compilers, compiler_container
)

esp = inspect.getfile(es)
map_f = os.path.abspath(os.path.join(esp, "..", "qblox_test_mapping.json"))
with open(map_f, "r") as f:
    HARDWARE_MAPPING = json.load(f)

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

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

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

Generates a staircase through offset instructions.

Parameters
play_stitched_pulse(pulse, idx0, idx1)[source]

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

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

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

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

static to_pulsar_time(time)[source]

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

Parameters

time (floatfloat) – The time to convert

Return type

intint

Returns

The integer valued nanosecond time

update_runtime_settings(operation)[source]

Adds the commands needed to correctly set the QASMRuntimeSettings.

Parameters

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

Notes

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

wait_till_start_operation(operation)[source]

Waits until the start of a pulse or acquisition.

Parameters

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

Raises

ValueError – If wait time < 0.

wait_till_start_then_acquire(acquisition, idx0, idx1)[source]

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

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

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

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

wait_till_start_then_play(pulse, idx0, idx1)[source]

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

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

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

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

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

parent

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

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

quantify_scheduler.backends.qblox.non_generic.check_reserved_pulse_id(pulse)[source]

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

Parameters

pulse (OpInfoOpInfo) – The pulse to check.

Return type

str | NoneOptional[str]

Returns

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

quantify_scheduler.backends.qblox.non_generic.generate_reserved_waveform_data(reserved_pulse_id, data_dict, sampling_rate)[source]

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

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

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

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

Return type

ndarrayndarray

zhinst

Helpers for Zurich Instruments.

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

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

Parameters

base_clock (floatfloat) – The Instruments base clock rate.

Returns

The node and clock rate values.

Return type

Dict[int, int]

quantify_scheduler.backends.zhinst.helpers.get_directory(awg)[source]

Returns the LabOne directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type

PathPath

Returns

The path of this directory.

quantify_scheduler.backends.zhinst.helpers.get_readout_channel_bitmask(readout_channels_count)[source]

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

Parameters

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

Return type

strstr

Returns

The channel bitmask.

quantify_scheduler.backends.zhinst.helpers.get_src_directory(awg)[source]

Returns the source directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type

PathPath

Returns

The path to the source directory.

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

Gets the value of a ZI node.

Parameters
Return type

strstr

Returns

The node value.

quantify_scheduler.backends.zhinst.helpers.get_waveform_table(pulse_ids, pulseid_pulseinfo_dict)[source]

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

Parameters
Return type

{int: int}Dict[int, int]

Returns

The waveform table dictionary.

quantify_scheduler.backends.zhinst.helpers.get_waves_directory(awg)[source]

Returns the waves directory of an AWG.

Parameters

awg (AWGAWG) – The HDAWG AWG object.

Return type

PathPath

Returns

The path to the waves directory.

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

Uploads and compiles the AWG sequencer program.

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

Sets the value of a AWG module node.

Parameters
Return type

NoneNone

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

Sets the commandtable JSON for an AWG.

Parameters
Return type

NoneNone

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

Sets the value of a ZI node.

Parameters
Return type

NoneNone

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

Sets the value of a ZI node.

Parameters
Return type

NoneNone

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

Sets the vector value of a ZI node.

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.set_wave_vector(instrument, awg_index, wave_index, vector)[source]

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

Parameters
Return type

NoneNone

quantify_scheduler.backends.zhinst.helpers.write_seqc_file(awg, contents, filename)[source]

Writes the contents of to the source directory of LabOne.

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

  • contents (strstr) – The content to write.

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

Return type

PathPath

Returns

Returns the path which was written.

quantify_scheduler.backends.zhinst.resolvers.monitor_acquisition_resolver(uhfqa, monitor_nodes)[source]

Returns complex value of UHFQA Monitor nodes.

Parameters
Return type

ndarrayndarray

quantify_scheduler.backends.zhinst.resolvers.result_acquisition_resolver(uhfqa, result_node)[source]

Returns complex value of UHFQA Result node.

Parameters
Return type

ndarrayndarray

class quantify_scheduler.backends.zhinst.seqc_il_generator.SeqcILGenerator[source]

The Intermediate Sequencer Language Generator.

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

__init__()[source]

Creates a new instance of SeqcILGenerator.

assign_get_user_reg(name, index)[source]

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

Parameters
  • name (strstr) – The variable name.

  • index (intint) – The register index.

Return type

NoneNone

assign_placeholder(name, size)[source]

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

Parameters
  • name (strstr) – The variable name.

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

Return type

NoneNone

assign_var(name, value)[source]

Assign a value to a variable by name.

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

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

Parameters
Return type

NoneNone

declare_var(name, value=None)[source]

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

Parameters
  • name (strstr) – The variable name.

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

Return type

NoneNone

declare_wave(name, value=None)[source]

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

Parameters
  • name (strstr) – The variable name.

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

Return type

NoneNone

emit_assign_wave_index(*args, index)[source]

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

Parameters

index (intint) – The waveform table index.

Return type

NoneNone

emit_begin_repeat(repetitions=1)[source]

Emit repeat loop to the program.

Parameters

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

Return type

NoneNone

emit_begin_while(predicate='true')[source]

Emit while loop to the program.

Parameters

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

Return type

NoneNone

emit_comment(text)[source]

Emit a comment to the program.

Parameters

text (strstr) –

Return type

NoneNone

emit_end_repeat()[source]

Emit ending the repeat loop.

Return type

NoneNone

emit_end_while()[source]

Emit ending the while loop.

Return type

NoneNone

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

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

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

Parameters

index (intint) – The wave index to execute.

Return type

NoneNone

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

Emit playWave to the program.

Parameters

name – The variable name.

Return type

NoneNone

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

Emit setTrigger to the program.

Parameters

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

Return type

NoneNone

emit_start_qa_monitor()[source]

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

Return type

NoneNone

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

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

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

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

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

Return type

NoneNone

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

Emits a wait instruction to the sequencer program.

Parameters

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

Return type

NoneNone

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

Emit waitDigTrigger to the program.

Parameters

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

Return type

NoneNone

emit_wait_wave(comment='')[source]

Emit waitWave to the program.

Return type

NoneNone

generate()[source]

Returns the generated seqc program.

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

Returns

The seqc program.

Return type

str

class quantify_scheduler.backends.zhinst.seqc_il_generator.SeqcInfo(cached_schedule, output, low_res_clock)[source]

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

to_clocks(seconds)[source]

Returns the converted value in clocks.

Parameters

seconds (float) –

Returns

Return type

int

property line_trigger_delay_in_clocks

Returns the configured line delay when using triggers in clocks.

Returns

Return type

int

property line_trigger_delay_in_seconds

Returns the configured line delay when using triggers in seconds.

Returns

Return type

float

property schedule_duration_in_clocks

Returns the total schedule duration in clocks.

Returns

Return type

int

property schedule_duration_in_seconds

Returns the total schedule duration in seconds.

Returns

Return type

float

property schedule_offset_in_clocks

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

Returns

Return type

int

property schedule_offset_in_seconds

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

Returns

Return type

float

property timeline_end_in_clocks

Returns the port timeline start in clocks.

Returns

Return type

float

property timeline_end_in_seconds

Returns the port timeline end in seconds.

Returns

Return type

float

property timeline_start_in_clocks

Returns the port timeline start in clocks.

Returns

Return type

float

property timeline_start_in_seconds

Returns the port timeline start in seconds.

Returns

Return type

float

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

The sequencer enum type.

quantify_scheduler.backends.zhinst.seqc_il_generator.add_csv_waveform_variables(seqc_gen, device_serial, awg_index, commandtable_map)[source]

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

Parameters
quantify_scheduler.backends.zhinst.seqc_il_generator.add_execute_table_entry(seqc_gen, index, device_type, comment='')[source]

Adds an executeTableEntry instruction to seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

Raises

AttributeError – Raised when the DeviceType not equals HDAWG.

quantify_scheduler.backends.zhinst.seqc_il_generator.add_play_wave(seqc_gen, *variable, device_type, comment='')[source]

Adds a playWave instruction to the seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

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

Add Sequence Information to the SeqcILGenerator using comments.

Parameters
quantify_scheduler.backends.zhinst.seqc_il_generator.add_set_trigger(seqc_gen, value, device_type, comment='')[source]

Adds a setTrigger instruction to the seqc program.

Parameters
Returns

Elapsed number of clock cycles.

Return type

int

quantify_scheduler.backends.zhinst.seqc_il_generator.add_wait(seqc_gen, delay, device_type, comment='')[source]

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

Parameters
Returns

The number of clocks waited.

Return type

int

Settings builder for Zurich Instruments.

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

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

class quantify_scheduler.backends.zhinst.settings.ZISetting(node, value, apply_fn)[source]

Zurich Instruments Settings record type.

apply(instrument)[source]

Applies settings to the Instrument.

Parameters

instrument (ZIBaseInstrumentZIBaseInstrument) –

as_dict()[source]

Returns the key-value pair as a dictionary.

Return type

{str: Any}Dict[str, Any]

Returns

class quantify_scheduler.backends.zhinst.settings.ZISettings(daq_settings, awg_settings)[source]

Zurich Instruments settings result class.

__init__(daq_settings, awg_settings)[source]

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

Parameters
apply(instrument)[source]

Apply all settings to the instrument.

Return type

NoneNone

as_dict()[source]

Returns the ZISettings as a dictionary.

Return type

{str: Any}Dict[str, Any]

Returns

classmethod deserialize(settings_path)[source]

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

Parameters

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

Return type

ZISettingsBuilderZISettingsBuilder

Returns

The ZISettingsBuilder containing all the deserialized settings.

Raises

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

serialize(root, options)[source]

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

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

Parameters
Return type

PathPath

Returns

The path to the parent JSON file.

property awg_indexes

Returns a list of enabled AWG indexes.

Return type

List[int]List[int]

class quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder[source]

The Zurich Instruments Settings builder class.

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

__init__()[source]

Creates a new instance of ZISettingsBuilder

build()[source]

Builds the ZISettings class.

Return type

ZISettingsZISettings

Returns

with_awg_time(awg_index, clock_rate_index)[source]

Adds the Instruments clock rate frequency setting.

See ZI instrument user manual

/DEV…./AWGS/n/TIME

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_commandtable_data(awg_index, json_data)[source]

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

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_compiler_sourcestring(awg_index, seqc)[source]

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

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_csv_wave_vector(awg_index, wave_index, vector)[source]

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

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

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_defaults(defaults)[source]

Adds the Instruments default settings.

Parameters

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

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_gain(awg_index, gain)[source]

Adds the gain settings for the Instruments awg by index.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_delay(delay)[source]

Adds the Instruments QAS delay.

Parameters

delay (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_length(n_samples)[source]

Adds the Instruments QAS Monitor integration length setting.

Parameters

n_samples (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_mode(mode)[source]

Adds the Instruments QAS Monitor integration mode setting.

Parameters

mode (QasIntegrationModeQasIntegrationMode) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_weights_imag(channels, imag)[source]

Adds the Instruments QAS Monitor integration imaginary weights setting.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_integration_weights_real(channels, real)[source]

Adds the Instruments QAS Monitor integration real weights setting.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_averages(n_averages)[source]

Adds the Instruments QAS Monitor averages setting.

Parameters

n_averages (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_enable(enabled)[source]

Adds the Instruments QAS Monitor enable setting.

Parameters

enabled (boolbool) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_length(n_samples)[source]

Adds the Instruments QAS Monitor length setting.

Parameters

n_samples (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_monitor_reset(value)[source]

Adds the Instruments QAS Monitor reset setting.

Parameters

value (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_averages(n_averages)[source]

Adds the Instruments QAS Monitor result averages setting.

Parameters

n_averages (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_enable(enabled)[source]

Adds the Instruments QAS Monitor result enable setting.

Parameters

enabled (boolbool) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_length(n_samples)[source]

Adds the Instruments QAS Monitor result length setting.

Parameters

n_samples (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_mode(mode)[source]

Adds the Instruments QAS Monitor result mode setting.

Parameters

mode (QasResultModeQasResultMode) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_reset(value)[source]

Adds the Instruments QAS Result reset setting.

Parameters

value (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_result_source(mode)[source]

Adds the Instruments QAS Monitor result source setting.

Parameters

mode (QasResultSourceQasResultSource) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_qas_rotations(channels, value)[source]

Adds the Instruments QAS rotation setting.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_sigout_offset(channel_index, offset_in_millivolts)[source]

Adds the channel sigout offset setting in volts.

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_sigouts(awg_index, outputs)[source]

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

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_system_channelgrouping(channelgrouping)[source]

Adds the Instruments channelgrouping setting.

Parameters

channelgrouping (intint) –

Return type

ZISettingsBuilderZISettingsBuilder

Returns

with_wave_vector(awg_index, wave_index, vector)[source]

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

Parameters
Return type

ZISettingsBuilderZISettingsBuilder

Returns

helpers

Schedule helper functions.

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

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

property acqid_acqinfo_dict

Returns the acquisition info lookup table.

Return type

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

property port_timeline_dict

Returns the timeline per port lookup dictionary.

Return type

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

property pulseid_pulseinfo_dict

Returns the pulse info lookup table.

Return type

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

property pulseid_waveformfn_dict

Returns waveform function lookup table.

Return type

{int: GetWaveformPartial}Dict[int, GetWaveformPartial]

property schedule

Returns schedule.

Return type

ScheduleSchedule

property start_offset_in_seconds

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

Return type

floatfloat

property total_duration_in_seconds

Returns the schedule total duration in seconds.

Return type

floatfloat

quantify_scheduler.helpers.schedule.get_acq_info_by_uuid(schedule)[source]

Returns a lookup dictionary of unique identifiers of acquisition information.

Parameters

schedule (ScheduleSchedule) – The schedule.

Return type

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

quantify_scheduler.helpers.schedule.get_acq_uuid(acq_info)[source]

Returns an unique identifier for a acquisition protocol.

Parameters

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

Return type

intint

Returns

The uuid hash.

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

Returns the end of an operation in seconds.

Parameters
Return type

floatfloat

Returns

The Operation start time in Seconds.

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

Returns the start of an operation in seconds.

Parameters
Return type

floatfloat

Returns

The Operation start time in Seconds.

quantify_scheduler.helpers.schedule.get_port_timeline(schedule)[source]

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

Using iterators on this collection enables sorting.

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

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

schedule (ScheduleSchedule) – The schedule.

Return type

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

quantify_scheduler.helpers.schedule.get_pulse_info_by_uuid(schedule)[source]

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

Parameters

schedule (ScheduleSchedule) – The schedule.

Return type

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

quantify_scheduler.helpers.schedule.get_pulse_uuid(pulse_info, excludes=None)[source]

Returns an unique identifier for a pulse.

Parameters

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

Return type

intint

Returns

The uuid hash.

quantify_scheduler.helpers.schedule.get_schedule_time_offset(schedule, port_timeline_dict)[source]

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

Parameters
Return type

floatfloat

Returns

The operation t0 in seconds.

quantify_scheduler.helpers.schedule.get_total_duration(schedule)[source]

Returns the total schedule duration in seconds.

Parameters

schedule (ScheduleSchedule) – The schedule.

Return type

floatfloat

Returns

Duration in seconds.

class quantify_scheduler.helpers.waveforms.GetWaveformPartial(*args, **kwargs)[source]

Protocol type definition class for the get_waveform partial function.

quantify_scheduler.helpers.waveforms.apply_mixer_skewness_corrections(waveform, amplitude_ratio, phase_shift)[source]

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

Phase correction is done using:

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

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

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

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

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

Return type

ndarrayndarray

Returns

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

quantify_scheduler.helpers.waveforms.exec_custom_waveform_function(wf_func, t, pulse_info)[source]

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

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

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

  • t (ndarrayndarray) – The linear timespace.

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

Return type

ndarrayndarray

Returns

Returns the computed waveform.

quantify_scheduler.helpers.waveforms.exec_waveform_function(wf_func, t, pulse_info)[source]

Returns the result of the pulse’s waveform function.

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

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

  • t (ndarrayndarray) – The linear timespace.

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

Return type

ndarrayndarray

Returns

Returns the computed waveform.

quantify_scheduler.helpers.waveforms.exec_waveform_partial(pulse_id, pulseid_waveformfn_dict, sampling_rate)[source]

Returns the result of the partial waveform function.

Parameters
Return type

ndarrayndarray

Returns

The waveform array.

quantify_scheduler.helpers.waveforms.get_waveform(pulse_info, sampling_rate)[source]

Returns the waveform of a pulse_info dictionary.

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

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

Return type

ndarrayndarray

Returns

The waveform.

quantify_scheduler.helpers.waveforms.get_waveform_by_pulseid(schedule)[source]

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

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

Parameters

schedule (ScheduleSchedule) – The schedule.

Return type

{int: GetWaveformPartial}Dict[int, GetWaveformPartial]

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

Returns the number of samples required to respect the granularity.

Parameters
Return type

intint

quantify_scheduler.helpers.waveforms.modulate_waveform(t, envelope, freq, t0=0)[source]

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

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

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

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

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

  • freq (floatfloat) – The frequency of the modulation

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

Return type

ndarrayndarray

Returns

The modulated waveform

quantify_scheduler.helpers.waveforms.normalize_waveform_data(data)[source]

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

Parameters

data (ndarrayndarray) – The waveform data to rescale.

Return type

Tuple[ndarray, float, float