2
$\begingroup$

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
Thanks
Jan

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

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

circ1 = QuantumCircuit(1,name='1Qcirc')
circ1.u(0.4,0.6,0.9,0)
qc1 = transpile(circ1, basis_gates=['u1','u2','u3'], optimization_level=1)

circ2 = QuantumCircuit(2,name='2Qcirc')
circ2.u(0.4,0.6,0.9,0)
circ2.sx(1)
qc2 = transpile(circ2, basis_gates=['u1','u2','u3'], optimization_level=1)

sched1=schedule(qc1,backend1)
sched2=schedule(qc2,backend2)

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)
plt.tight_layout()
plt.show()
$\endgroup$
1
$\begingroup$

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) 

backend1.defaults().instruction_schedule_map.get('u3',qubits=[0]).instructions 

this gives you the set of instructions below :

    ((0, ShiftPhase(-1.0*P2, DriveChannel(0))),
     (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))),
     (320,
      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

P2=0.90
P0=0.40
P1=0.60

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 
circ1.add_calibration(.......). 

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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