operation ========= .. py:module:: quantify_scheduler.operations.operation .. autoapi-nested-parse:: Module containing the core concepts of the scheduler. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.operations.operation.Operation Attributes ~~~~~~~~~~ .. autoapisummary:: quantify_scheduler.operations.operation.cached_locate .. py:data:: cached_locate .. py:class:: Operation(name: str) Bases: :py:obj:`quantify_scheduler.json_utils.JSONSchemaValMixin`, :py:obj:`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 :class:`~quantify_scheduler.resources.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:: :mod:`quantify_scheduler` comes with a :mod:`~quantify_scheduler.operations.gate_library` and a :mod:`~quantify_scheduler.operations.pulse_library` , both containing common operations. **JSON schema of a valid Operation** .. jsonschema:: https://gitlab.com/quantify-os/quantify-scheduler/-/raw/main/quantify_scheduler/schemas/operation.json .. note:: Two different Operations containing the same information generate the same hash and are considered identical. .. py:property:: name :type: str Return the name of the operation. .. py:property:: duration :type: float 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. .. py:property:: hash :type: str A hash based on the contents of the Operation. Needs to be a str for easy compatibility with json. .. py:property:: valid_gate :type: bool An operation is a valid gate if it contains information on how to represent the operation on the gate level. .. py:property:: valid_pulse :type: bool An operation is a valid pulse if it contains information on how to represent the operation on the pulse level. .. py:property:: valid_acquisition :type: bool An operation is a valid acquisition if it contains information on how to represent the operation as a acquisition on the pulse level. .. py:property:: has_voltage_offset :type: bool Checks if the operation contains information for a voltage offset. .. py:attribute:: schema_filename :value: 'operation.json' .. py:attribute:: _class_signature .. py:method:: _update() -> None Update the Operation's internals. .. py:method:: _get_signature(parameters: dict) -> str :classmethod: Returns the constructor call signature of this instance for serialization. The string constructor representation can be used to recreate the object using eval(signature). :param parameters: The current data dictionary. :type parameters: dict .. py:method:: add_gate_info(gate_operation: Operation) -> None Updates self.data['gate_info'] with contents of gate_operation. :param gate_operation: an operation containing gate_info. .. py:method:: add_device_representation(device_operation: Operation) -> None Takes the information that specifies how to represent an operation at the quantum-device abstraction layer and adds it to the current operation. :param device_operation: an operation containing the pulse_info and/or acquisition info describing how to represent the current operation at the quantum-device layer. .. py:method:: add_pulse(pulse_operation: Operation) -> None Adds pulse_info of pulse_operation Operation to this Operation. :param pulse_operation: an operation containing pulse_info. .. py:method:: add_acquisition(acquisition_operation: Operation) -> None Adds acquisition_info of acquisition_operation Operation to this Operation. :param acquisition_operation: an operation containing acquisition_info. .. py:method:: is_valid(object_to_be_validated) -> bool :classmethod: 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.