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 device element 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': '5b053cd5-acce-48e7-8221-60cd1c929bf6', 'operation_id': '4107737710936014360', 'timing_constraints': [TimingConstraint(ref_schedulable=None, ref_pt=None, ref_pt_new=None, rel_time=3.64e-07)], 'label': '5b053cd5-acce-48e7-8221-60cd1c929bf6'}