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 - Operationin- Schedule.- This is an abstract class. Each concrete implementation of the control flow operation decides how and when their - bodyoperation 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- repetitionstimes. 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, hardware_buffer_time: float = 0.0)[source]#
- Bases: - ControlFlowOperation- Conditional over another operation. - If a preceding thresholded acquisition on - qubit_nameresults 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 
- hardware_buffer_time – Time buffer, by default 0 
 
 - Example - A conditional reset can be implemented as follows: - # relevant imports from quantify_scheduler import Schedule from quantify_scheduler.operations import ConditionalOperation, 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': '95f599aa-65bf-471f-88b0-73766f327a1b', 'operation_id': '1440073003361819240', 'timing_constraints': [{'rel_time': 3.64e-07, 'ref_schedulable': None, 'ref_pt_new': None, 'ref_pt': None}], 'label': '95f599aa-65bf-471f-88b0-73766f327a1b'}- Added in version 0.22.0: For some hardware specific implementations, a - hardware_buffer_timemight be required to ensure the correct timing of the operations. This will be added to the duration of the- bodyto prevent overlap with other operations.- 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_flowargument to- Schedule.add. The- ControlFlowSpecis only a type which by itself cannot be used for the- control_flowargument, 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) LoopOperation[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 – Target device element. 
- t0 – Time offset, by default 0 
 
 - create_operation(body: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule) ConditionalOperation[source]#
- Transform the control flow specification to an operation or schedule.