4
$\begingroup$

I am trying to build a realistic noise model in Qiskit for a quantum computer that might be available 2-3 few years from now on. I tried to start from an existing noise model generated from a fake device, use NoiseModel.to_dict() method, tweak the dictionary a bit and load it back using the NoiseModel.from_dict() method. Unfortunately, the from_dict() method is now deprecated. Is there another method to adjust an existing noise model? There are several examples around on how to build a custom noise model in Qiskit, but I do not trust myself building a realistic one because there are so many settings that can be adjusted.

$\endgroup$

1 Answer 1

1
$\begingroup$

There might be a better manner to do that, but anyway:

You can generate a NoiseModel instance from an actual backend (or from fake V1 backends) by using the NoiseModel.from_backend() method.

Then it is possible to further customize the noise model using the methods and attributes of the NoiseModel class.

For example, this piece of code generates a noise model from ibmq_quito and alters one of its readout errors:

from qiskit import IBMQ
from qiskit.providers.aer.noise import NoiseModel, ReadoutError

provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_quito')
nm_1 = NoiseModel.from_backend(backend)

print('The readout errors defined before altering are:')
print(nm_1._local_readout_errors)

q0_RO_er = ReadoutError([[0.8,0.2],[0.2,0.8]])
nm_1._local_readout_errors[(0,)] = q0_RO_er

print()
print('The readout errors after altering are:')
print(nm_1._local_readout_errors)

This is an example for altering existing definitions. Adding error deifnitions is easier, and can be done using the add_XXX methods of the NoiseModel class (there are several).

$\endgroup$
3
  • $\begingroup$ Indeed, using NoiseModel __ dict __ method gives access to NoiseModel internals. $\endgroup$
    – Radu M.
    Sep 19, 2022 at 8:43
  • $\begingroup$ @Radu M. what do you mean? $\endgroup$
    – Ohad
    Sep 19, 2022 at 14:29
  • $\begingroup$ The dict member provides access to NoiseModel internals. I used it to validate your proposed solution. $\endgroup$
    – Radu M.
    Sep 21, 2022 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.