Skip to content

Instantly share code, notes, and snippets.

@Jsevillamol
Created May 22, 2020 12:03
Show Gist options
  • Save Jsevillamol/752725dd01d8d0474eb4de6eefd4a70b to your computer and use it in GitHub Desktop.
Save Jsevillamol/752725dd01d8d0474eb4de6eefd4a70b to your computer and use it in GitHub Desktop.
# Script to retrieve the characteristics of the available backends in IBM Quantum Experience
# by Jaime Sevilla, based on a script from Douglas T. McClure
# Importing standard Qiskit libraries and configuring account
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
# Loading your IBM Q account(s)
provider = IBMQ.load_account()
# from qiskit import IBMQ
provider = IBMQ.load_account()
from datetime import date, timedelta
# Iterate over the backends, printing the characteristics
for backend in provider.backends():
# We are not interested in calibration
if backend.configuration().simulator:
continue
# Search for earliest available calibration
date_t = date(2010, 1, 1)
limit = date.today()
delta = timedelta(weeks=4)
while True:
prop = backend.properties(datetime=date_t)
if prop is not None: break
date_t += delta
if date_t > limit: raise Error
print(f"backend = {prop.backend_name}")
print(f"online date = {backend.configuration().online_date}")
print(f"earliest calibration date = {date_t}")
print(f"n qubits = {backend.configuration().n_qubits}")
err_rates = []
for gate in prop.gates:
if gate.gate == 'cx':
err_rates.append(gate.parameters[0].value)
if len(err_rates) > 0:
print(f"average error rate = {sum(err_rates)/len(err_rates)}")
print("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment