---
title: ExecutorCircuitGenerator (latest version)
description: API reference for qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator in the latest version of qiskit-noise-learning
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit-noise-learning/generated/circuit-generator-executor-circuit-generator
---

# qiskit\_noise\_learning.circuit\_generator.ExecutorCircuitGenerator

*class* `qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator(gate_set: QiskitGateSet, creg_prefix: str = 'meas', local_clifford_ref_prefix: str = 'c', pass_manager: PassManager | None = None)`

[GitHub](https://github.com/Qiskit/qiskit-noise-learning/tree/stable/0.2/qiskit_noise_learning/circuit_generator/executor/executor_circuit_generator.py)

Bases: `CircuitGenerator`\[[`QuantumProgram`](/docs/api/samplomatic/auto/quantum-program-quantum-program "(in samplomatic)"), [`QuantumProgramResult`](/docs/api/samplomatic/auto/quantum-program-quantum-program-result "(in samplomatic)")]

A circuit generator that converts sequences of Qiskit gates into a samplex items.

**Parameters**

- **gate\_set** – The Qiskit gate set that this generator constructs against.
- **creg\_prefix** – The prefix assigned to all creg names used in instruction sequence measurements. Defaults to `"meas"`.
- **local\_clifford\_ref\_prefix** – The prefix assigned to all local Clifford parameter references in template circuits. Defaults to `"c"`.
- **pass\_manager** – An optional `PassManager` to apply to all template circuits produced by [`ExecutorCircuitGenerator.generate()`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate"). Pass managers should not modify the details of the existing circuit (e.g. re-order qubits or rename measurements).

Pure preparation gates (those with `prep_idxs` and no operations) at the beginning of an instruction sequence are not explicitly included as a box in the template circuit. Instead, any single-qubit gates (e.g. basis rotation) associated with preparation are absorbed into the subsequent box’s left-dressing.

Each [`PartialPauliPermutation`](/docs/api/qiskit-noise-learning/generated/sequences-partial-pauli-permutation "qiskit_noise_learning.sequences.PartialPauliPermutation") of an instruction sequence is emitted as the left-dressing of the box that follows it. A box dresses only the qubits it acts on, so a permutation must be the identity on every qubit of [`qubit_subset`](/docs/api/qiskit-noise-learning/generated/gate-sets-gate-set#qubit_subset "qiskit_noise_learning.gate_sets.GateSet.qubit_subset") that the following gate does not act on. Qubits outside that subset take no part in the experiment, and a permutation acting on them is ignored.

### \_\_init\_\_

`__init__(gate_set: QiskitGateSet, creg_prefix: str = 'meas', local_clifford_ref_prefix: str = 'c', pass_manager: PassManager | None = None)`

## Methods

|                                                                                                                                                                                                                                          |                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [`__init__`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.__init__ "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.__init__")(gate\_set\[, creg\_prefix, ...])                                    |                                                                                      |
| [`collect`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.collect "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.collect")(result)                                                                | Coerce data from a specific execution framework into a canonical form.               |
| [`generate`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate")(experiment)                                                         | Generate a new experimental task from the provided experiment.                       |
| [`generate_samplex_item`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate_samplex_item "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate_samplex_item")(instruction\_sequences, ...) | Generate a samplex item from instruction sequences with the same structure.          |
| [`generate_samplex_items`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate_samplex_items "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.generate_samplex_items")(...)                      | Generate samplex items from instruction sequences.                                   |
| `partition`(sequences)                                                                                                                                                                                                                   | Partition the positions of instruction sequences that can share a generation output. |

## Attributes

|                                                                                                                                                                      |                                                 |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| [`gate_set`](#qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.gate_set "qiskit_noise_learning.circuit_generator.ExecutorCircuitGenerator.gate_set") | The gate set this generator constructs against. |

### gate\_set

Type: [`QiskitGateSet`](/docs/api/qiskit-noise-learning/generated/gate-sets-qiskit-gate-set "qiskit_noise_learning.gate_sets.qiskit_gate_set.QiskitGateSet")

The gate set this generator constructs against.

### collect

*static* `collect(result)`

Coerce data from a specific execution framework into a canonical form.

### generate

`generate(experiment)`

Generate a new experimental task from the provided experiment.

### generate\_samplex\_items

`generate_samplex_items(instruction_sequences: list[InstructionSequence], num_randomizations: int) → tuple[list[SamplexItem], ExecutorDataMapper]`

Generate samplex items from instruction sequences.

**Parameters**

- **instruction\_sequences** – The instruction sequences to generate circuits for.
- **num\_randomizations** – The number of randomizations per sequence.

**Returns**

A tuple of samplex items and a data mapper.

### generate\_samplex\_item

`generate_samplex_item(instruction_sequences: list[InstructionSequence], num_randomizations: int) → tuple[SamplexItem, list[str], dict[str, ndarray[int]]]`

Generate a samplex item from instruction sequences with the same structure.

Every twirled box must be left-dressed: the accumulated `PartialPauliPermutation` is emitted as each box’s left-dressing local Clifford, so a right-dressed twirl is not supported and raises.

**Parameters**

- **instruction\_sequences** – The similar instruction sequences to generate.
- **num\_randomizations** – The number of randomizations per sequence.

**Returns**

A samplex item where the order of the arguments correspond to the order of `instruction_sequences`, an ordered list of creg names, and a dictionary mapping creg names to the physical qubit index measured into each of their classical bits, in classical bit order.

**Raises**

- [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `instruction_sequences` is empty.
- [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If any of the instruction sequences is not complete.
- [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If any of the instruction sequences have different structure.
- [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If a twirled box is not left-dressed.
- [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If the single-qubit Clifford layer preceding a box is non-identity on a gate-set qubit that the box’s gate does not act on.
