enter image description hereWhen I downloaded the source code from Qiskit Notebook Accessing Higher Energy States and tried to execute it, the output and graph seem wrong in the step finding the frequency step which leads to the failure of other parts. I have tried to update the library "Sample Pulse" to the new library "Waveform". However, the output is still incorrect. I think the data given for IBM-Armonk is out of date. Does anyone know what is the problem?

Basically, I can not find the correct output when executing the code to find Rabi Oscillations. Here the code

num_rabi_points = 50 # number of experiments (ie amplitudes to sweep out)

    # Drive amplitude values to iterate over: 50 amplitudes evenly spaced from 0 to 0.75
drive_amp_min = 0
drive_amp_max = 0.75
drive_amps = np.linspace(drive_amp_min, drive_amp_max, num_rabi_points)
# Create schedule
rabi_01_schedules = []
# loop over all drive amplitudes
for ii, drive_amp in enumerate(drive_amps):
    # drive pulse
    rabi_01_pulse = pulse_lib.gaussian(duration=drive_samples, 
                                       name='rabi_01_pulse_%d' % ii)
    # add commands to schedule
    schedule = pulse.Schedule(name='Rabi Experiment at drive amp = %s' % drive_amp)
    schedule |= pulse.Play(rabi_01_pulse, drive_chan)
    schedule |= measure << schedule.duration # shift measurement to after drive pulse
# Assemble the schedules into a program
# Note: We drive at the calibrated frequency.
rabi_01_expt_program = assemble(rabi_01_schedules,
                                schedule_los=[{drive_chan: cal_qubit_freq}]
                                               * num_rabi_points)
  • 1
    $\begingroup$ Hello, it is a little difficult to help with just "something's wrong". Could you maybe elaborate more on this by showing us what results you get with what code and explain what result you expected maybe? $\endgroup$ – Lena May 25 at 7:31
  • 1
    $\begingroup$ I have just edited my question. Can you take a look at it again $\endgroup$ – BẢO BẠCH GIA May 25 at 8:29
  • 1
    $\begingroup$ @BẢOBẠCHGIA don't add screenshots of code, copy paste the code in the question itself. This makes the post more searchable and the code easier to reproduce $\endgroup$ – glS May 26 at 9:07
  • $\begingroup$ Oke, I have already finished finding the Frequency Sweep using the code in qiskit.org/textbook/ch-quantum-hardware/…. However, when graphing the Rabi oscillations, the output still wrongs. I have already edited my question $\endgroup$ – BẢO BẠCH GIA May 26 at 10:16
  • $\begingroup$ What is the wrong output that you are getting? $\endgroup$ – chrysaor4 May 27 at 10:43

I came across the same issue last week and hence made corrections and opened a PR on the same to change the default values on the textbook.

The key is to change the drive_power from 0.3 to 0.1

It's expected for such values to change, in fact, the pulses that represent circuit gates used by IBM are calibrated quite often

drive power 0.3

drive power 0.3

drive power 0.1

drive power 0.1


The chart you posted above looks like a nice peak for the 0-1 transition. Looking at the link that you posted it seems like you are trying to find the 1-2 transition. You can find the frequency of this transition with schedules of the form

# ground state reference point
with pulse.build(backend=backend) as gs:
    with pulse.align_sequential():

# excited state reference point
with pulse.build(backend=backend) as es:
    with pulse.align_sequential():
        pulse.play(Drag(160, 0.2068, 80, -0.24), DriveChannel(0))

schedules = [gs, es]
frequencies = np.linspace(-0.36e9, -0.32e9, 51)

for freq in frequencies:
    with pulse.build(backend=backend) as spec:
        with pulse.align_sequential():
            pulse.play(Drag(320, 0.8078, 80, -0.65), DriveChannel(0))
            pulse.shift_frequency(freq, DriveChannel(0))
            pulse.play(Drag(320, 0.8078, 80, -0.65), DriveChannel(0))

the first two schedules are intended as calibration points for the ground state and first excited state. You should run this using level 1 measurement data to obtain the best results e.g.

job = backend.run(schedules, meas_level=1)

Next, you can plot this data in the IQ plane to see which frequency resulted in the most population in the 2nd excited state:

result = job.result()

signal = []
for idx in range(len(frequencies)+2):
plt.scatter(np.real(signal[0]), np.imag(signal[0]), label='Ground state')
plt.scatter(np.real(signal[1]), np.imag(signal[1]), label='1st excited state')
plt.scatter(np.real(signal[2:]), np.imag(signal[2:]), label='spectroscopy')

You can roughly find a peak by doing the following

plt.plot(frequencies, np.imag(signal[2:]))

You can fit this and I would expect the peak for IBM Quantum Armonk to be 347 MHz below the frequency of the 0-1 transition. Note that a better approach would be to train a 0-1-2 state discriminator in the IQ plane. Once you have the frequency of the 1-2 transition the following should be a good schedule to measure Rabi oscillations between 1-2

anharmonicity = -347e6
schedules = []
for amp in np.linspace(0, 0.95, 51):
    with pulse.build(backend=backend) as rabi_12:
        with pulse.align_sequential():
            pulse.play(Drag(320, 0.8078, 80, -0.65), DriveChannel(0))
            pulse.shift_frequency(anharmonicity, DriveChannel(0))
            pulse.play(Drag(320, amp, 80, -0.65), DriveChannel(0))
  • $\begingroup$ I have another question about the pi-amplitude, it seems the the pi-amplitude changes everyday in ibmq-armonk. Can you show me the way to calculate pi-amplitude as well $\endgroup$ – BẢO BẠCH GIA May 28 at 7:48

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.