0
$\begingroup$

I wish to know how to suppress the following warning obtained on qiskit when I try to add two different types of noise to a qubit

WARNING: quantum error already exists for instruction "u2" on qubits [0] , appending additional error.

I know that some warnings can be suppressed with

import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)

but I do not know what category my warning is contained in. I would also like to know if I can access somewhere all the different warning categories. Additionally trying

import warnings
warnings.filterwarnings('ignore')

to suppress all warnings does not help.

$\endgroup$
1
  • $\begingroup$ do you mind adding a code example? $\endgroup$
    – luciano
    Oct 19 '20 at 1:33
3
$\begingroup$

Qiskit's NoiseModel class processes warnings through a logger from the logging package, not through the warnings package, so suppressing warnings as in other answers won't help.

However, each method in NoiseModel provides a warnings parameter; it defaults to True but you can set it to False to prevent the warnings from being logged.

Example: myNoiseModel.add_quantum_error(..., warnings=False)

$\endgroup$
0
$\begingroup$

You don't need to provide a category to silence all of the warnings:

import warnings
warnings.filterwarnings('ignore')
$\endgroup$
1
  • $\begingroup$ Hi, thanks but I tried this and nothing changes. I have updated the question to include this. Have you any other suggestions? $\endgroup$
    – LOC
    Oct 18 '20 at 22:01
0
$\begingroup$

I don't know if this help at all but in term of warning categories, I used ?? warnings and found a few other types:

category=PendingDeprecationWarning
category=ImportWarning
category=ResourceWarning

I also see a question related to warning to Qiskit here. It is not the same as what you are asking but hopefully it will help somehow.


$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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