このページはまだ翻訳されていません。英語の原文を表示しています。
Build noise models
Package versions
The code on this page was developed using the following requirements. We recommend using these versions or newer.
qiskit[all]~=2.3.0
qiskit-ibm-runtime~=0.43.1
qiskit-aer~=0.17
This page shows how to use the Qiskit Aer noise module to build noise models for simulating quantum circuits in the presence of errors. This is useful for emulating noisy quantum processors and for studying the effects of noise on the execution of quantum algorithms.
import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import Kraus, SuperOp
from qiskit.visualization import plot_histogram
from qiskit.transpiler import generate_preset_pass_manager
from qiskit_aer import AerSimulator
# Import from Qiskit Aer noise module
from qiskit_aer.noise import (
NoiseModel,
QuantumError,
ReadoutError,
depolarizing_error,
pauli_error,
thermal_relaxation_error,
)
Qiskit Aer noise module
The Qiskit Aer noise module contains Python classes to build customized noise models for simulation. There are three key classes:
-
The
NoiseModelclass which stores a noise model used for noisy simulation. -
The
QuantumErrorclass which describes CPTP gate errors. These can be applied:- After gate or reset instructions
- Before measure instructions.
-
The
ReadoutErrorclass which describes classical readout errors.
Initializing a noise model from a backend
You can initialize a noise model with parameters set from the latest calibration data for a physical backend:
from qiskit_ibm_runtime import QiskitRuntimeService
service = QiskitRuntimeService()
backend = service.backend("ibm_fez")
noise_model = NoiseModel.from_backend(backend)
This will yield a noise model that roughly approximates the errors one would encounter when using that backend. If you want to have more detailed control over the parameters of the noise model, then you'll need to create your own noise model, as described in the rest of this page.
Quantum errors
Rather than deal with the QuantumError object directly, many helper functions exist to automatically generate a specific type of parameterized quantum error. These are contained in the noise module and include functions for many common error types used in quantum computing research. The function names and the type of error they return are:
| Standard error function | Details |
|---|---|
kraus_error | a general n-qubit CPTP error channel given as a list of Kraus matrices . |
mixed_unitary_error | an n-qubit mixed unitary error given as a list of unitary matrices and probabilities . |
coherent_unitary_error | an n-qubit coherent unitary error given as a single unitary matrix . |
pauli_error | an n-qubit Pauli error channel (mixed unitary) given as a list of Pauli's and probabilities |
depolarizing_error | an n-qubit depolarizing error channel parameterized by a depolarization probability . |
reset_error | a single-qubit reset error parameterized by probabilities of resetting to the , state. |
thermal_relaxation_error | a single qubit thermal relaxation channel parameterized by relaxation time constants , , gate time , and excited state thermal population . |
phase_amplitude_damping_error | A single-qubit generalized combined phase and amplitude damping error channel given by an amplitude damping parameter , a phase damping parameter , and an excited state thermal population . |
amplitude_damping_error | A single-qubit generalized amplitude damping error channel given by an amplitude damping parameter , and an excited state thermal population . |
phase_damping_error | A single-qubit phase damping error channel given by a phase damping parameter . |
Combining quantum errors
QuantumError instances can be combined by using composition, tensor product, and tensor expansion (reversed order tensor product) to produce new QuantumErrors as:
- Composition: as
error = error1.compose(error2) - Tensor product: as
error = error1.tensor(error2) - Expand product: