quantify_scheduler.operations.operation
Module containing the core concepts of the scheduler.
Module Contents
Attributes
- class Operation(name: str, data: dict = None)[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 agate_library
and apulse_library
, both containing common operations.JSON schema of a valid Operation
Note
Two different Operations containing the same information generate the same hash and are considered identical.
- __eq__(other) bool [source]
Returns the equality of two instances based on its content
self.data
.- Parameters
other –
- __str__() str [source]
Returns a concise string representation which can be evaluated into a new instance using eval(str(operation)) only when the data dictionary has not been modified.
This representation is guaranteed to be unique.
- __repr__() str [source]
Returns the string representation of this instance.
This representation can always be evaluated to create a new instance.
eval(repr(operation))
- property duration float [source]
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.
- 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]
Takes the information that specifies how to represent an operation at the quantum-device abstraction layer and adds it 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]
Checks if the contents of the object_to_be_validated are valid according to 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 contains information on how to represent the operation on the gate level.