control_flow_library ==================== .. py:module:: quantify_scheduler.operations.control_flow_library .. autoapi-nested-parse:: Standard control flow operations for use with the quantify_scheduler. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.operations.control_flow_library.Loop quantify_scheduler.operations.control_flow_library.Conditional .. py:class:: Loop(repetitions: int, t0: float = 0) Bases: :py:obj:`quantify_scheduler.operations.operation.Operation` Loop over another operation. Cannot be added to Schedule manually, to be used with the ``control_flow`` arg of Schedule.add :param repetitions: number of repetitions :type repetitions: int :param t0: time offset, by default 0 :type t0: float, optional .. py:class:: Conditional(qubit_name: str, t0: float = 0) Bases: :py:obj:`quantify_scheduler.operations.operation.Operation` Conditional operation. Cannot be added to Schedule manually, to be used with the `control_flow` arg of :meth:`~quantify_scheduler.schedules.schedule.Schedule.add`. When passing ``control_flow=Conditional()`` to ``Schedule.add``, the subschedule will be *conditional* on ``qubit_name``. In other words, if a preceding thresholded acquisition on ``qubit_name`` results in a "1", the subschedule 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. :param qubit_name: The name of the qubit to condition on. :type qubit_name: str :param t0: Time offset, by default 0 :type t0: float, optional .. rubric:: Example A conditional reset can be implemented as follows: .. admonition:: example # relevant imports from quantify_scheduler import Schedule from quantify_scheduler.operations.control_flow_library import Conditional from quantify_scheduler.operations.gate_library import Measure, X # define schedule schedule = Schedule("main schedule") # define a subschedule containing conditional reset conditional_reset = Schedule("conditional reset") conditional_reset.add(Measure("q0", feedback_trigger_label="q0")) sub_schedule = Schedule("conditional x") sub_schedule.add(X("q0")) conditional_reset.add(sub_schedule, control_flow=Conditional("q0")) # add conditional reset as if it were a gate schedule.add(conditional_reset)