QuTech-Delft / quantuminspire

Quantum Inspire SDK
Apache License 2.0
65 stars 27 forks source link

[SDS-NNN] Calibrations in result #112

Closed peendebak closed 3 years ago

peendebak commented 3 years ago

A minimal example:

import quantuminspire
from quantuminspire.credentials import get_authentication
from quantuminspire.qiskit import QI
from qiskit.circuit import QuantumCircuit
from qiskit import execute

qc=QuantumCircuit(2,2)
qc.h(0)
qc.cz(0,1)
qc.measure_all()
qc.draw()

authentication = get_authentication()
QI.set_authentication(authentication)
api = QI.get_api()
backend = QI.get_backend("Starmon-5")

job = execute(qc, backend)
result = job.result()
calibration = result.get_calibration(api)
print(calibration)

@QFer Not sure how to test this, since in the tests we have no active backends I think.

QFer commented 3 years ago

@peendebak Hi I'll 'hijack' this branch to add the functionality you requested. It will be implemented somewhat different because the calibration data can be different for each result when we have more Qiskit circuits in the job. To get the calibration from a result we use a construction similar to getting the probabilities from the result.

QFer commented 3 years ago

The minimal example of Pieter should be rewritten as:

import quantuminspire
from quantuminspire.credentials import get_authentication
from quantuminspire.qiskit import QI
from qiskit.circuit import QuantumCircuit
from qiskit import execute

qc=QuantumCircuit(2,2)
qc.h(0)
qc.cz(0,1)
qc.measure_all()
qc.draw()

authentication = get_authentication()
QI.set_authentication(authentication)
backend = QI.get_backend("Starmon-5")

job = execute(qc, backend)
result = job.result()
calibration = result.get_calibration(qc)
print(calibration)
coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 8d55d86669111c5b677b13502e4bf8670f17a393 on feat/calibration_result into 7b32ecb48d726279ee0022e963e93d20beaecb80 on dev.