control_flow_library#

Standard control flow operations for use with the quantify_scheduler.

Module Contents#

Classes#

ControlFlowOperation

Control flow operation that can be used as an Operation in Schedule.

LoopOperation

Loop over another operation predefined times.

ConditionalOperation

Conditional over another operation.

ControlFlowSpec

Control flow specification to be used at Schedule.add.

Loop

Loop control flow specification to be used at Schedule.add.

Conditional

Conditional control flow specification to be used at Schedule.add.

class ControlFlowOperation(name: str)[source]#

Bases: quantify_scheduler.operations.operation.Operation

Control flow operation that can be used as an Operation in Schedule.

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.

property duration: float[source]#

Duration 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.

property duration: float[source]#

Duration 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 to Schedule.add. The ControlFlowSpec is only a type which by itself cannot be used for the control_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

repetitions[source]#
t0[source]#
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

qubit_name[source]#
t0[source]#
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.