Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.24k stars 2.36k forks source link

QuantumCircuit.append ignores calibrations #6632

Open eggerdj opened 3 years ago

eggerdj commented 3 years ago

Information

What is the current behavior?

QuantumCircuit.append ignores calibrations.

Steps to reproduce the problem

from qiskit import QuantumCircuit
import qiskit.pulse as pulse

qc1 = QuantumCircuit(1)
qc1.x(0)

with pulse.build(name="xp") as xp:
    pulse.play(pulse.Drag(160, 0.1, 40, 0.1), pulse.DriveChannel(0))

qc2 = QuantumCircuit(1)
qc2.rx(0.25, 0)
qc2.add_calibration("rx", qubits=(0,), schedule=xp)

qc2.calibrations

qc1.append(qc2, qargs=(0,))
print(qc1)
print(qc1.calibrations)

prints

     ┌───┐┌───────────┐
q_0: ┤ X ├┤ circuit-1 ├
     └───┘└───────────┘
{}

What is the expected behavior?

The calibrations of qc1 after the append should contain the calibrations of qc2, i.e. qc1.calibrations should show

{'rx': {((0,), ()): ScheduleBlock(Play(Drag(duration=160, amp=(0.1+0j), sigma=40, beta=0.1), DriveChannel(0)), name="xp", transform=AlignLeft())}}

Suggested solutions

Transfer the calibrations in append if we append a quantum circuit.

Nnayak3110 commented 3 years ago

Any progress yet?