ProgramSet
- class braket.program_sets.program_set.ProgramSet(programs, shots_per_executable=None)[source]
Bases:
objectA set of programs to be run together on a device.
- Parameters:
programs (
list[CircuitBinding|Circuit] |CircuitBinding) – A list of circuit bindings or circuits to execute. It is also possible to provide a single circuit binding. Note: circuits cannot have result types.shots_per_executable (
int|None) – The number of shots to run each executable; this will be used to enforce the total shots on task creation. If not provided, the only validation at task creation will be divisibility by number of executables.
- to_ir(*, gate_definitions=None)[source]
Serializes the program set into a form that can run on a Braket device.
- Parameters:
gate_definitions (
Mapping[tuple[Gate,QubitSet],PulseSequence] |None) – The calibration data for the device. default: None.- Return type:
ProgramSet- Returns:
braket.ir.openqasm.ProgramSet – The serialized program set.
- property entries: list[CircuitBinding | Circuit]
The circuit bindings or circuits in this program set
- Type:
list[CircuitBinding | Circuit]
- property total_executables: int
The total number of executables in this program set
- Type:
int
- property shots_per_executable: int | None
The number of shots to run each executable in this program set
- Type:
int
- property total_shots: int
The total number of shots across all executables in this program set, if shots_per_executable was provided.
- Type:
int
- static zip(circuits, *, input_sets=None, observables=None, shots_per_executable=None)[source]
Constructs a batch of circuits from a list of circuits and optionally an input set and/or observable for each; alternatively, a single CircuitBinding can be provided and paired with corresponding observables.
- Parameters:
circuits (
Sequence[Circuit] |CircuitBinding) – The parametrized circuit with parameters or set of fixed circuits to run with multiple observables.input_sets (
Sequence[Mapping[str,float]] |None) – The inputs to the circuit; must match number of circuits if provided. Must be empty if circuits is a CircuitBinding.observables (
Sequence[Observable|None] |None) – A set of observables to measure with the circuits; must match number of circuits if provided.shots_per_executable (
int|None) – The number of shots to run each executable; this will be used to enforce the total shots on task creation. If not provided, the only validation at task creation will be divisibility by number of executables.
- Return type:
- Returns:
ProgramSet – a program set consisting of matching sets of circuits, inputs and observables.
- static product(circuits, observables, shots_per_executable=None)[source]
Constructs a program set from the Cartesian product of the given observables with the given circuits or bindings.
If an entry of the list is a single circuit, then the resulting program will consist of that circuit and all the observables; if an entry is a circuit binding, then the result program will be the Cartesian product of the binding’s input values and observables.
- Parameters:
circuits (
Sequence[Circuit|CircuitBinding]) – The parametrized circuit with parameters or set of fixed circuits to run with multiple observables.observables (
Sum|Sequence[Observable]) – A set of observables to measure with the circuits.shots_per_executable (
int|None) – The number of shots to run each executable; this will be used to enforce the total shots on task creation. If not provided, the only validation at task creation will be divisibility by number of executables.
- Return type:
- Returns:
ProgramSet – a program set consisting of Cartesian products of the given observables with the given circuits or bindings.