control_flow_library#
Standard control flow operations for use with the quantify_scheduler.
Module Contents#
Classes#
Control flow operation that can be used as an |
|
Loop over another operation predefined times. |
|
Conditional over another operation. |
|
Control flow specification to be used at |
|
Loop control flow specification to be used at |
|
Conditional control flow specification to be used at |
- class ControlFlowOperation(name: str)[source]#
Bases:
quantify_scheduler.operations.operation.Operation
Control flow operation that can be used as an
Operation
inSchedule
.This is an abstract class. Each concrete implementation of the control flow operation decides how and when their
body
operation is executed.- property body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule[source]#
- Abstractmethod:
Body of a control flow.
- class LoopOperation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, repetitions: int, t0: float = 0.0)[source]#
Bases:
ControlFlowOperation
Loop over another operation predefined times.
Repeats the operation defined in
body
repetitions
times. The actual implementation depends on the backend.- Parameters:
body – Operation to be repeated
repetitions – Number of repetitions
t0 – Time offset, by default 0
- property body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule[source]#
Body of a control flow.
- class ConditionalOperation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, qubit_name: str, t0: float = 0.0)[source]#
Bases:
ControlFlowOperation
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 repeated
repetitions – Number of repetitions
t0 – Time offset, by default 0
Example
A conditional reset can be implemented as follows:
example
- property body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule[source]#
Body of a control flow.
- class ControlFlowSpec[source]#
Control flow specification to be used at
Schedule.add
.The users can specify any concrete control flow with the
control_flow
argument toSchedule.add
. TheControlFlowSpec
is only a type which by itself cannot be used for thecontrol_flow
argument, use any concrete control flow derived from it.- abstract create_operation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule) quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule [source]#
Transform the control flow specification to an operation or schedule.
- class Loop(repetitions: int, t0: float = 0.0)[source]#
Bases:
ControlFlowSpec
Loop control flow specification to be used at
Schedule.add
.For more information, see
LoopOperation
.- Parameters:
repetitions – Number of repetitions
t0 – Time offset, by default 0
- create_operation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule) quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule [source]#
Transform the control flow specification to an operation or schedule.
- class Conditional(qubit_name: str, t0: float = 0.0)[source]#
Bases:
ControlFlowSpec
Conditional control flow specification to be used at
Schedule.add
.For more information, see
ConditionalOperation
.- Parameters:
qubit_name – Number of repetitions
t0 – Time offset, by default 0
- create_operation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule) quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule [source]#
Transform the control flow specification to an operation or schedule.