NoiseModel¶
- class NoiseModel(basis_gates=None)[source]¶
Bases:
object
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_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_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, ['rz', 'sx', 'x']) 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’, ‘rz’, ‘sx’, ‘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.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.
Add additional gates to the noise model basis_gates.
Add a non-local quantum error to the noise model (DEPRECATED).
Add a quantum error to the noise model.
Add a readout error to the noise model.
Return a noise model derived from a devices backend properties.
Load NoiseModel from a dictionary.
Return True if the noise model has no noise terms.
Reset the noise model.
Return the noise model as a dictionary.
Attributes
- basis_gates¶
Return basis_gates for compiling to the noise model.
- noise_instructions¶
Return the set of noisy instructions for this noise model.
- noise_qubits¶
Return the set of noisy qubits for this noise model.