load_noise_model

pennylane_qiskit.load_noise_model(noise_model, verbose: bool = False, decimal_places: int | None = None) NoiseModel[source]

Loads a PennyLane NoiseModel from a Qiskit noise model.

Parameters:
  • noise_model (qiskit_aer.noise.NoiseModel) – a Qiskit noise model object

  • verbose (bool) – when printing a NoiseModel, a complete list of Kraus matrices for each qml.QubitChannel is displayed with verbose=True. By default, verbose=False and only the number of Kraus matrices and the number of qubits they act on is displayed for brevity.

  • decimal_places (int | None) – number of decimal places to round the elements of Kraus matrices when they are being displayed for each qml.QubitChannel when verbose=True.

Returns:

An equivalent noise model constructed in PennyLane

Return type:

pennylane.NoiseModel

Raises:

ValueError – When an encountered quantum error cannot be converted.

Note

Currently, PennyLane noise models do not support readout errors, so those will be skipped during conversion.

Example

Consider the following noise model constructed in Qiskit:

>>> import qiskit_aer.noise as noise
>>> error_1 = noise.depolarizing_error(0.001, 1) # 1-qubit noise
>>> error_2 = noise.depolarizing_error(0.01, 2) # 2-qubit noise
>>> noise_model = noise.NoiseModel()
>>> noise_model.add_all_qubit_quantum_error(error_1, ['rz', 'ry'])
>>> noise_model.add_all_qubit_quantum_error(error_2, ['cx'])

This noise model can be converted into PennyLane using:

>>> load_noise_model(noise_model)
NoiseModel({
    OpIn(['RZ', 'RY']): QubitChannel(num_kraus=4, num_wires=1)
    OpIn(['CNOT']): QubitChannel(num_kraus=16, num_wires=2)
})