1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

qiskit_experiments で Rabi振動

Posted at

前回同様,qiskit_experimentsを用いて,Rabi振動を見ていきたいと思います.

RoughXSXAmplitudeCal

今回はqiskit_experimentsのRoughXSXAmplitudeCalを用いてRabi振動を見ていきます.これはマイクロ波のエンベロープ関数の振幅を変化させていくことによって,$X$ゲートと$SX$ゲートを同時に校正していく関数のようです.Rabi振動を見れば,$X$や$SX$の最適な振幅が分かるということですね.

それではコードを見ていきましょう.

import pandas as pd
import numpy as np
import qiskit.pulse as pulse
from qiskit.circuit import Parameter
from qiskit_experiments.calibration_management.calibrations import Calibrations
from qiskit import schedule
from qiskit import IBMQ
from qiskit_experiments.library.calibration import RoughXSXAmplitudeCal

IBMQ.save_account("") #tokenを入れてください
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q')
backend = provider.get_backend('') #使用するbackendを指定してください

qubit = 0


def setup_cals(backend) -> Calibrations:

    cals = Calibrations.from_backend(backend)

    dur = Parameter("dur")
    amp = Parameter("amp")
    sigma = Parameter("σ")
    drive = pulse.DriveChannel(Parameter("ch0"))

    with pulse.build(name="x") as x:
        pulse.play(pulse.Gaussian(dur, amp, sigma), drive)

    with pulse.build(name="sx") as sx:
        pulse.play(pulse.Gaussian(dur, amp, sigma), drive)

    cals.add_schedule(x, num_qubits=1)
    cals.add_schedule(sx, num_qubits=1)

    return cals

def add_parameter_guesses(cals: Calibrations):

    for sched in ["x","sx"]:
        cals.add_parameter_value(15, "σ", schedule=sched)
        cals.add_parameter_value(120, "dur", schedule=sched)
        cals.add_parameter_value(0.5, "amp", schedule=sched)

cals = setup_cals(backend)
add_parameter_guesses(cals)

columns_to_show = ["parameter", "qubits", "schedule", "value"]
pd.DataFrame(**cals.parameters_table(qubit_list=[qubit, ()]))[columns_to_show]

param0.png

setup_calsで波形を決めています.今回は以前同様Gussianを選択しました.また,各パラメータが指定した値になっていることが分かります.また,RoughXSXAmplitudeCalの構成上,$X$と$SX$どちらの波形も指定する必要があります.さて,ampをスイープしながらRabi振動を見ていきます.

rabi = RoughXSXAmplitudeCal((qubit,), cals, backend=backend, amplitudes=np.linspace(0, 0.75, 50))

rabi_data = rabi.run().block_for_results()
rabi_data.figure(0)

rabi_result0.png

確かに以前同様の結果が得られていることが分かります.また,$X$や$SX$に最適な振幅を見てみると,

pd.DataFrame(**cals.parameters_table(qubit_list=[qubit, ()], parameters="amp"))[columns_to_show]

param1.png
より,確かに更新されていることが分かります.

最後に

2量子ビット操作も実験してみたいですね(2回目).

Version Information

Software Version
qiskit 0.45.1
qiskit_experiments 0.5.4
System information
Python version 3.10.12
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?