qiskit_noise_learning.aer_executor.AerExecutor
class qiskit_noise_learning.aer_executor.AerExecutor(qasm_simulator: AerSimulator, noise_dict: dict[str, PauliLindbladMap] | None = None, angle_decimals: int = 5, warn_absent: bool = True, root_seed: int | None = None)
Bases: object
Local Aer-based executor mimicking the IBM Runtime executor interface.
Runs a QuantumProgram eagerly on construction of the returned job — the result is available immediately when AerRuntimeJob.result() is called.
Noise injection
When noise_dict is provided, Pauli-Lindblad noise is injected into circuits at tagged barriers via InsertNoisePass. Samplomatic inserts three barriers around each boxed gate — left (L), middle (M), and right (R) — with labels of the form <pos><idx>@tag=<tag> (e.g. R0@tag=r0). By default, noise is injected at the R (right) barriers, i.e. after the gate. Use noise_after=False on InsertNoisePass to target M barriers instead (noise before the gate).
The noise_dict format is:
- Keys — layer name tags (strings, e.g.
"r0","my_tag"). Each key must match therefof aTagannotation used when building theQuantumProgram. A warning is emitted (ifwarn_absent=True) when a tagged barrier’s tag is absent from the dict; the barrier is left as-is (no noise inserted for that layer). - Values —
PauliLindbladMapinstances describing the Pauli-Lindblad noise channel for that gate. The map’snum_qubitsmust equal the number of qubits on the corresponding barrier in the circuit. - Qubit indexing — indices inside the map are local to the barrier’s qubit set, independent of global circuit qubit numbering. Local index
irefers to thei-th qubit of the barrier in ascending physical-qubit order, so a device-wide map can be converted withPauliLindbladMap.keep_qubits(sorted(qubits)).
Parameters
- qasm_simulator – The Aer simulator to run programs on.
- noise_dict – A map from barrier label refs to Pauli-Lindblad noise maps. Pass
None(default) to run without noise injection. - angle_decimals – Gate angles are rounded to the nearest multiple of π/2 at this decimal precision before simulation. This prevents floating-point drift from preventing Clifford-method simulation when angles are nominally Clifford.
- warn_absent – If
True(default), emit a warning when a tagged barrier’s tag is not found innoise_dict. Set toFalsewhen partial coverage of tags is intentional. - root_seed – Root seed for random number generation, covering both the sampling of shots and the sampling of twirls. Rather than being used directly, it seeds a sequence that each call to
run()draws the next seed from, so that runs are independently random. With the default ofNonea root seed is drawn nondeterministically; it is available asroot_seedeither way.
__init__
__init__(qasm_simulator: AerSimulator, noise_dict: dict[str, PauliLindbladMap] | None = None, angle_decimals: int = 5, warn_absent: bool = True, root_seed: int | None = None)
Methods
Column 1 | Column 2 |
|---|---|
__init__(qasm_simulator[, noise_dict, ...]) | |
run(program) | Run a quantum program and return a completed job. |
Attributes
Column 1 | Column 2 |
|---|---|
root_seed | The root seed each run's randomness is derived from. |
root_seed
Type: int
The root seed each run’s randomness is derived from.
Passing this to a new executor reproduces this executor’s whole sequence of runs. It is not the seed of any individual run: to reproduce a single run, use the seed of the job that produced it, AerRuntimeJob.seed.
run
run(program: QuantumProgram) → AerRuntimeJob
Run a quantum program and return a completed job.
Each call draws a fresh seed from the executor’s root seed, so successive runs are independently random even when the executor is seeded.
Parameters
program – The quantum program to execute.
Returns
A job whose result is immediately available.