control_flow_library#
Standard control flow operations for use with the quantify_scheduler.
Module Contents#
Classes#
Loop over another operation. |
|
Conditional operation. |
- class Loop(repetitions: int, t0: float = 0)[source]#
Bases:
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
- class Conditional(qubit_name: str, t0: float = 0)[source]#
Bases:
quantify_scheduler.operations.operation.Operation
Conditional operation.
Cannot be added to Schedule manually, to be used with the control_flow arg of
add()
.When passing
control_flow=Conditional(<qubit_name>)
toSchedule.add
, the subschedule will be conditional onqubit_name
. In other words, if a preceding thresholded acquisition onqubit_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.- Parameters:
Example
A conditional reset can be implemented as follows:
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)