operation#

Module containing the core concepts of the scheduler.

Module Contents#

Classes#

Operation

A representation of quantum circuit operations.

Attributes#

cached_locate[source]#
class Operation(name: str)[source]#

Bases: quantify_scheduler.json_utils.JSONSchemaValMixin, collections.UserDict

A representation of quantum circuit operations.

The Operation class is 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.

  • operation_type

Defines what class of operations this gate refers to (e.g. Rxy, CZ etc.).

type

string

  • 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

  • symmetric

A boolean to indicate whether a two qubit gate is symmetric. This is used in the device config compilation stage. By default, it is set as False

type

boolean

  • 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

  • acq_channel

The acquisition channel to use.

type

number

  • acq_index

The acquisition index where to store the result of the acquisition protocol.

type

number

  • acq_return_type

Describes the return type of an acquisition performed using this protocol.

additionalProperties

True

  • logic_info

Not Implemented.

additionalProperties

False

Note

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

schema_filename = 'operation.json'[source]#
_class_signature = None[source]#
_update() None[source]#

Update the Operation’s internals.

property name: str[source]#

Return the name of the operation.

property duration: float[source]#

Determine operation duration from pulse_info.

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

property hash: str[source]#

A hash based on the contents of the Operation.

Needs to be a str for easy compatibility with json.

classmethod _get_signature(parameters: dict) str[source]#

Returns the constructor call signature of this instance for serialization.

The string constructor representation can be used to recreate the object using eval(signature).

Parameters:

parameters (dict) – The current data dictionary.

add_gate_info(gate_operation: Operation) None[source]#

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

Parameters:

gate_operation – an operation containing gate_info.

add_device_representation(device_operation: Operation) None[source]#

Adds device-level representation details to the current operation.

Parameters:

device_operation – an operation containing the pulse_info and/or acquisition info describing how to represent the current operation at the quantum-device layer.

add_pulse(pulse_operation: Operation) None[source]#

Adds pulse_info of pulse_operation Operation to this Operation.

Parameters:

pulse_operation – an operation containing pulse_info.

add_acquisition(acquisition_operation: Operation) None[source]#

Adds acquisition_info of acquisition_operation Operation to this Operation.

Parameters:

acquisition_operation – an operation containing acquisition_info.

classmethod is_valid(object_to_be_validated) bool[source]#

Validates the object’s contents against the schema.

Additionally checks if the hash property of the object evaluates correctly.

property valid_gate: bool[source]#

An operation is a valid gate if it has gate-level representation details.

property valid_pulse: bool[source]#

An operation is a valid pulse if it has pulse-level representation details.

property valid_acquisition: bool[source]#

An operation is a valid acquisition if it has pulse-level acquisition representation details.

property is_conditional_measure_or_acquisition: bool[source]#

An operation is conditional if one of the following holds, self is a: - a Measure gate with a feedback_trigger_label assigned to it, or - an acquisition with a feedback_trigger_label assigned to it.

property is_control_flow: bool[source]#

Determine if operation is a control flow operation.

Returns:

Whether the operation is a control flow operation.

Return type:

bool

property has_voltage_offset: bool[source]#

Checks if the operation contains information for a voltage offset.