Can you help me to configure the FakeOpenPulse2Q() to produce more realistic pulses? The code below instantiates 2 circuits and generates the waveforms for each.

enter image description here

The top waveform frame is 1-qubit circuits with a single U3 gate using backend='ibmq_armonk' works fine. The bottom waveform frame is generated by FakeOpenPulse2Q() for a 2-qubit circuit using the same U3 gate on qubit 0 and the waveforms have the right structures but their shapes are simplified. enter image description here

I'm guessing FakeOpenPulse2Q requires a definition of calibrated X90 and CNOT gates for each qubit. Can you help me to
a) transfer the X90 calibration of qubit 0 from ibmq_armonk to FakeOpenPulse2Q()
b) use the same X90 calibration for qubit 1, except shift the drive & read frequencies by 300 and 400 MHz, respectively
c) define a realistic CNOT gate in FakeOpenPulse2Q

import matplotlib.pyplot as plt
from qiskit import IBMQ
from qiskit import QuantumCircuit, transpile,schedule
from qiskit.test.mock import FakeOpenPulse2Q

provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
backend1 = provider.get_backend('ibmq_armonk')
backend2 = FakeOpenPulse2Q()

circ1 = QuantumCircuit(1,name='1Qcirc')
qc1 = transpile(circ1, basis_gates=['u1','u2','u3'], optimization_level=1)

circ2 = QuantumCircuit(2,name='2Qcirc')
qc2 = transpile(circ2, basis_gates=['u1','u2','u3'], optimization_level=1)


fig=plt.figure(1,facecolor='white', figsize=(14, 8))
ax1=plt.subplot2grid((3,1), (0,0), rowspan=1)
ax2=plt.subplot2grid((3,1), (1,0), rowspan=2)

sched1.draw('IQXDebugging', axis = ax1, show_waveform_info = True)
sched2.draw('IQXDebugging', axis = ax2, show_waveform_info = True)

print('circuit1:'); print(circ1)
print('circuit2:'); print(circ2)

1 Answer 1


As a first step, you can create realistic pulses on FakeOpenPulse2Q() using the pulse builder. The default pulses instructions can be retrieved from the instruction schedule map. Here below the example for retrieveing the instruction from armonk and recreate that set of pulses for FakeOpenPulse2Q() using the pulse builder

1) Retrieve the pulse instructions for the gate (u3 in your case) 


this gives you the set of instructions below :

    ((0, ShiftPhase(-1.0*P2, DriveChannel(0))),
      Play(Drag(duration=320, amp=(0.370467155866812-0.0762912966131609j), sigma=80, beta=-1.095928909587139, name='X90p_d0'), DriveChannel(0), name='X90p_d0')),
     (320, ShiftPhase(-1.0*P0, DriveChannel(0))),
      Play(Drag(duration=320, amp=(-0.370467155866812+0.07629129661316089j), sigma=80, beta=-1.095928909587139, name='X90m_d0'), DriveChannel(0), name='X90m_d0')),
     (640, ShiftPhase(-1.0*P1, DriveChannel(0))))

2) Create your calibration pulse program using the pulse builder


from qiskit.pulse import  play, build, shift_phase, ControlChannel, DriveChannel, GaussianSquare, Drag, Gaussian

with build(backend2) as pulse_prog:
shift_phase(-1.0*P2, DriveChannel(0)),
play(Drag(duration=320, amp=(0.370467155866812-0.0762912966131609j), sigma=80, beta=-1.095928909587139, name='X90p_d0'), DriveChannel(0), name='X90p_d0'),
shift_phase(-1.0*P0, DriveChannel(0)),
play(Drag(duration=320, amp=(-0.370467155866812+0.07629129661316089j), sigma=80, beta=-1.095928909587139, name='X90m_d0'), DriveChannel(0), name='X90m_d0')
shift_phase(-1.0*P1, DriveChannel(0))

pulse_prog.draw('IQXDebugging', axis = ax, show_waveform_info = True)

enter image description here

3 ) Then you must Link your calibration to your circuit 

You can refer to the pulse gate tutorial for detailed information --> https://qiskit.org/documentation/tutorials/circuits_advanced/05_pulse_gates.html

I hope this helps as a starting point.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.