control_flow_library#

Contains the control flow operations for the Qblox backend.

Module Contents#

Classes#

ConditionalOperation

Conditional over another operation.

class ConditionalOperation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, qubit_name: str, t0: float = 0.0)[source]#

Bases: quantify_scheduler.operations.control_flow_library.ConditionalOperation

Conditional over another operation.

If a preceding thresholded acquisition on qubit_name results in a “1”, the body will be executed, otherwise it will generate a wait time that is equal to the time of the subschedule, to ensure the absolute timing of later operations remains consistent.

Parameters:
  • body – Operation to be conditionally played

  • qubit_name – Name of the qubit on which the body will be conditioned

  • t0 – Time offset, by default 0

Example

A conditional reset can be implemented as follows:

# relevant imports
from quantify_scheduler import Schedule
from quantify_scheduler.qblox.operations import ConditionalOperation
from quantify_scheduler.operations import Measure, X

# define conditional reset as a Schedule
conditional_reset = Schedule("conditional reset")
conditional_reset.add(Measure("q0", feedback_trigger_label="q0"))
conditional_reset.add(
    ConditionalOperation(body=X("q0"), qubit_name="q0"),
    rel_time=364e-9,
)
{'name': '447079b1-c5d9-4b9a-b3bb-cb96bbe2376e', 'operation_id': '235036756074264273', 'timing_constraints': [{'rel_time': 3.64e-07, 'ref_schedulable': None, 'ref_pt_new': None, 'ref_pt': None}], 'label': '447079b1-c5d9-4b9a-b3bb-cb96bbe2376e'}