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.28k stars 2.37k forks source link

QIskit. Pulse “add_calibration” dont work #13221

Open 18810393041 opened 1 month ago

18810393041 commented 1 month ago

Environment

What is happening?

For the prior version qiskit. Pulse, we can't run Schedule or Scheduleblock directly on the fake backend and the real backend directly, the alternative is to embed Scheduleblock into the quantum gate via 'add_calibration' for pulse control.

However, this does not work, and it is known from measurements that these encoded Schedules do not control quantum bits. I hope the problem can be solved, thank you! 微信截图_20240925160736

How can we reproduce the issue?

from qiskit_ibm_runtime.fake_provider import FakeValenciaV2 from qiskit import QuantumCircuit, pulse from qiskit.pulse import ( Play, Schedule, ShiftFrequency, DriveChannel, MeasureChannel, build ) from qiskit_ibm_runtime import QiskitRuntimeService

backend = FakeValenciaV2() config = backend.configuration() print(config.open_pulse)

backend_name = 'ibm_brisbane'

service = QiskitRuntimeService()

backend = service.backend(backend_name)

from qiskit import QuantumCircuit

circ = QuantumCircuit(1, 1) circ.id(0) circ.measure([0], [0])

circ.draw("mpl") with pulse.build() as h_q0: pulse.play( pulse.library.Gaussian(duration=256, amp=0.2, sigma=50, name="custom"), pulse.DriveChannel(0) )

circ.add_calibration("id", qubits=[0], schedule=h_q0) circ.draw("mpl")

result = backend.run(circ).result().data() print(result)

What should happen?

No matter how the pulse parameters are adjusted, they do not work for the id gate.

Any suggestions?

No response

18810393041 commented 1 month ago
from qiskit_ibm_runtime.fake_provider import FakeValenciaV2
from qiskit import QuantumCircuit, pulse
from qiskit.pulse import (Play,Schedule,DriveChannel,MeasureChannel,build)
from qiskit_ibm_runtime import QiskitRuntimeService
backend = FakeValenciaV2()
config = backend.configuration()
print(config.open_pulse)
# backend_name = 'ibm_brisbane'
# service = QiskitRuntimeService()
# backend = service.backend(backend_name)

circ = QuantumCircuit(1, 1)
circ.id(0)
circ.measure([0], [0])
with pulse.build() as h_q0:
    pulse.play(
        pulse.library.Gaussian(duration=256, amp=0.2, sigma=50, name="custom"),
        pulse.DriveChannel(0)
    )
circ.add_calibration("id", qubits=[0], schedule=h_q0)
circ.draw("mpl")
result = backend.run(circ).result().data()
print(result)