NoiseModel¶
- class NoiseModel(basis_gates=None)[source]¶
Noise model class for Qiskit Aer simulators.
This class is used to represent noise model for the
QasmSimulator
. It can be used to construct custom noise models for simulator, or to automatically generate a basic device noise model for an IBMQ backend. See thenoise
module documentation for additional information.Example: Basic device noise model
An approximate
NoiseModel
can be generated automatically from the properties of real device backends from the IBMQ provider using thefrom_backend()
method.from qiskit import IBMQ, Aer from qiskit.providers.aer.noise import NoiseModel provider = IBMQ.load_account() backend = provider.get_backend('ibmq_vigo') noise_model = NoiseModel.from_backend(backend) print(noise_model)
Example: Custom noise model
Custom noise models can be used by adding
QuantumError
to circuit gate, reset or measure instructions, andReadoutError
to measure instructions.import qiskit.providers.aer.noise as noise # Error probabilities prob_1 = 0.001 # 1-qubit gate prob_2 = 0.01 # 2-qubit gate # Depolarizing quantum errors error_1 = noise.depolarizing_error(prob_1, 1) error_2 = noise.depolarizing_error(prob_2, 2) # Add errors to noise model noise_model = noise.NoiseModel() noise_model.add_all_qubit_quantum_error(error_1, ['u1', 'u2', 'u3']) noise_model.add_all_qubit_quantum_error(error_2, ['cx']) print(noise_model)
Initialize an empty noise model.
- Parameters
basis_gates (list[str] or None) – Specify an initial basis_gates for the noise model. If None a default value of [‘id’, ‘u3’, ‘cx’] is used (Default: None).
Additional Information: Errors added to the noise model will have their instruction appended to the noise model basis_gates if the instruction is in the
QasmSimulator
basis_gates. If the instruction is not in theQasmSimulator
basis_gates it is assumed to be a label for a standard gate, and that gate should be added to the NoiseModel basis_gates either using the init method, or theadd_basis_gates()
method.Attributes
Return basis_gates for compiling to the noise model.
Return the set of noisy instructions for this noise model.
Return the set of noisy qubits for this noise model.
Methods
Add a quantum error to the noise model that applies to all qubits.
Add a single-qubit readout error that applies measure on all qubits.
NoiseModel.add_basis_gates
(instructions[, …])Add additional gates to the noise model basis_gates.
NoiseModel.add_nonlocal_quantum_error
(error, …)Add a non-local quantum error to the noise model.
NoiseModel.add_quantum_error
(error, …[, …])Add a quantum error to the noise model.
NoiseModel.add_readout_error
(error, qubits)Add a readout error to the noise model.
NoiseModel.from_backend
(backend[, …])Return a noise model derived from a devices backend properties.
NoiseModel.from_dict
(noise_dict)Load NoiseModel from a dictionary.
Reset the noise model.
Declares X90 based gates for noise model.
NoiseModel.to_dict
([serializable])Return the noise model as a dictionary.