# Rabi Amplitude Calibration¶

As the next step of the qubit calibration, we will perform an amplitude Rabi experiment. We already know and have fixed the resonance frequency of the readout resonator, as well as the qubit transition frequency. In this experiment, we adjust the amplitude of a qubit excitation pulse of fixed duration and modulation frequency and, for each amplitude, measure the qubit state after application of the pulse. During application of the resonant drive pulse, the qubit state vector will rotate on the Bloch sphere, and the speed of this precession will depend linearly on the amplitude of the applied drive pulse. The resulting rotation angle will be proportional to the area under the played pulse.

The experimental parameters for the Rabi experiment are the sweep range of the pulse amplitude and the number of averages. We also define the qubit excitation pulse envelope. Here we take a Gaussian waveform with the length defined in the qubit parameters dictionary at the start. Initially, we excitation pulse with unit amplitude, which we will later adjust in the definition of the experiment pulse sequence.

```
## frequency range of spectroscopy scan
amp_min = 0
amp_max = min([qubit_parameters['pi_amp'] * 2.2, 1.0])
## how many amplitude points to measure
amp_num = 101
## how many averages per point: 2^n_average
n_average = 10
## set up sweep parameter - qubit drive amplitude
rabi_sweep = LinearSweepParameter(uid="rabi_amp", start=amp_min, stop=amp_max, count=amp_num)
## Rabi excitation pulse - gaussian
gaussian_pulse = pulse_library.gaussian(
uid="gaussian_pulse", length=qubit_parameters['qb_len'], amplitude=1.0
)
```

Having determined the proper qubit frequencies in the qubit spectroscopy, we can now apply these settings to the calibration of the device setup, as frequencies of the hardware oscillators used to modulate the qubit drive lines.

```
## qubit drive frequency - set in DeviceSetup calibration as baseline reference
drive_Oscillator_q0.frequency = qubit_parameters['qb0_freq']
drive_Oscillator_q0.modulation_type = ModulationType.HARDWARE
drive_Oscillator_q1.frequency = qubit_parameters['qb1_freq']
drive_Oscillator_q1.modulation_type = ModulationType.HARDWARE
```

The pulse sequence is similar to the qubit spectroscopy experiment before, now with the Gaussian pulse defined above and sweeping its pulse amplitude in real-time in the outer loop of the experiment.

For the qubit readout, we use the same pulses and the same sequence as defined in the qubit spectroscopy experiment.

```
## Create Rabi Experiment
exp_rabi = Experiment(
uid="Amplitude Rabi",
signals=[
ExperimentSignal("drive"),
ExperimentSignal("measure"),
ExperimentSignal("acquire"),
],
)
### define Rabi experiment
## outer loop - real-time averaging
with exp_rabi.acquire_loop_rt(uid="rabi_shots", count=pow(2, n_average), averaging_mode=AveragingMode.CYCLIC, acquisition_type=AcquisitionType.INTEGRATION):
## inner loop - real time sweep of Rabi ampitudes
with exp_rabi.sweep(uid="rabi_sweep", parameter=rabi_sweep):
## play qubit excitation pulse - amplitude is swept
with exp_rabi.section(uid="qubit_excitation"):
exp_rabi.play(signal="drive", pulse=gaussian_pulse, amplitude=rabi_sweep)
## readout pulse and data acquisition
readoutQubit(exp_rabi, section_id="qubit_readout", readout_id="measure",
acquire_id="acquire", reserve_id="drive", acquire_handle="q0_rabi",
readout_delay=qubit_parameters['ro_delay'], acquire_offset =qubit_parameters['ro_int_delay'],
readout_pulse=readout_pulse, readout_weights=readout_weighting_function, relax_time=qubit_parameters['relax']
)
```

Figure 1 shows example data acquired in such an amplitude Rabi experiment and plots the readout resonator response as a function of the qubit excitation pulse amplitude. Fitting a simple sinusoidal to the data allows to determine its periodicity, which allows us to calibrate the pulse amplitudes necessary for bringing the qubit to the equator of the Bloch sphere (π/2-pulse) and for flipping the qubit state (π-pulse). In the example notebook, we use a fit to the data shown to determine these two pulse amplitudes and set their values in the qubit parameters dictionary.

With the successful amplitude Rabi experiment, we are now able to drive the qubit state vector to reach any point on the single qubit Bloch sphere, and we can use the calibrated readout resonator to then measure the qubit state after this evolution.

Next, we will use this information to measure the lifetime of the qubit state in a T1 experiment and its dephasing time using a Ramsey sequence.