I want to get the error rates of the basis gates of a backend. Is there a function that can achieve this functionality?
For example, I want the error rates of the basis gates rx, cx of ibmq_mumbai backend programmatically.
Backend properties()
method returns an instance of BackendProperties
from which you can get the gate errors as follows:
At first, let's get a handle to the backend:
from qiskit_ibm_provider import IBMProvider
provider = IBMProvider()
backend = provider.get_backend('ibm_brisbane')
Then, we get a reference to BackendProperties
:
backend_props = backend.properties()
Now, we loop over the basis gates and display gate_error
for each qubit:
for basis_gate in backend.configuration().basis_gates:
print('>>', basis_gate)
for gate_props in backend_props.gates:
data = gate_props.to_dict()
if data['gate'] == basis_gate:
for param in data['parameters']:
if param['name'] == 'gate_error':
print(' ', data['qubits'], param['value'])
Note that, ibmq_mumbai
is no longer exist. However, an old snapshot of its data exists in fake provider module. So, you can get error information by creating an instance of FakeMumbai
from qiskit.providers.fake_provider import FakeMumbai
backend = FakeMumbai()
then use it with the above code.