{
"cells": [
{
"cell_type": "markdown",
"id": "65527272",
"metadata": {
"lines_to_next_cell": 0
},
"source": []
},
{
"cell_type": "markdown",
"id": "48b2b573",
"metadata": {
"tags": [
"header_banner"
]
},
"source": [
"\n",
" \n",
""
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "ccd804bd",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-12T18:00:19.976389Z",
"iopub.status.busy": "2025-03-12T18:00:19.976177Z",
"iopub.status.idle": "2025-03-12T18:00:22.094633Z",
"shell.execute_reply": "2025-03-12T18:00:22.094017Z"
},
"tags": [
"imports",
"header_0"
]
},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"import numpy as np\n",
"import rich # noqa:F401\n",
"\n",
"import quantify_core.data.handling as dh\n",
"from quantify_core.analysis import RabiAnalysis\n",
"from quantify_core.data.handling import load_dataset\n",
"from quantify_scheduler import QuantumDevice, Schedule\n",
"from quantify_scheduler.operations import Measure, Reset, X\n",
"\n",
"from utils import display_dict, initialize_hardware, run_schedule, show_connectivity # noqa:F401"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a93d4ebd",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-12T18:00:22.098268Z",
"iopub.status.busy": "2025-03-12T18:00:22.097381Z",
"iopub.status.idle": "2025-03-12T18:00:22.100714Z",
"shell.execute_reply": "2025-03-12T18:00:22.100272Z"
},
"tags": [
"config",
"header_1"
]
},
"outputs": [],
"source": [
"hw_config_path = \"configs/tuning_spin_coupled_pair_hardware_config.json\"\n",
"device_path = \"devices/spin_device_2q.json\""
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "c0ba0e06",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-12T18:00:22.102639Z",
"iopub.status.busy": "2025-03-12T18:00:22.102275Z",
"iopub.status.idle": "2025-03-12T18:00:22.105375Z",
"shell.execute_reply": "2025-03-12T18:00:22.104943Z"
},
"tags": [
"header_2"
]
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data will be saved in:\n",
"/root/quantify-data\n"
]
}
],
"source": [
"# Enter your own dataset directory here!\n",
"dh.set_datadir(dh.default_datadir())"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "71b4cf0c",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-12T18:00:22.107250Z",
"iopub.status.busy": "2025-03-12T18:00:22.106799Z",
"iopub.status.idle": "2025-03-12T18:00:22.783749Z",
"shell.execute_reply": "2025-03-12T18:00:22.783181Z"
},
"tags": [
"header_3"
]
},
"outputs": [],
"source": [
"quantum_device = QuantumDevice.from_json_file(device_path)\n",
"qubit = quantum_device.get_element(\"q0\")\n",
"quantum_device.hardware_config.load_from_json_file(hw_config_path)\n",
"cluster_ip = None\n",
"meas_ctrl, inst_coord, cluster = initialize_hardware(quantum_device, ip=cluster_ip)"
]
},
{
"cell_type": "markdown",
"id": "ff458df9",
"metadata": {},
"source": [
"# Rabi Oscillations\n",
"Here we will carry out an experiment to measure the Rabi frequency that is required to excite the qubit to $|1\\rangle$."
]
},
{
"cell_type": "markdown",
"id": "72540df9",
"metadata": {
"tags": [
"no_demo"
]
},
"source": [
"## Setup\n",
"In this section we configure the hardware configuration which specifies the connectivity of our system.\n",
"\n",
"The experiments of this tutorial are meant to be executed with a Qblox Cluster controlling a transmon system.\n",
"The experiments can also be executed using a dummy Qblox device that is created via an instance of the `Cluster` class, and is initialized with a dummy configuration.\n",
"When using a dummy device, the analysis will not work because the experiments will return `np.nan` values.\n",
"\n",
"### Configuration file\n",
"\n",
"This is a template hardware configuration file for a 2-qubit system with a flux-control line which can be used to tune the qubit frequency. We will only work with qubit 0.\n",
"\n",
"The hardware connectivity is as follows, by cluster slot:\n",
"\n",
"- **QCM** (Slot 2)\n",
" - $\\text{O}^{1}$: Flux line for `q0`.\n",
" - $\\text{O}^{2}$: Flux line for `q1`.\n",
"\n",
"- **QCM-RF** (Slot 6)\n",
" - $\\text{O}^{1}$: Drive line for `q0` using fixed 80 MHz IF.\n",
" - $\\text{O}^{2}$: Drive line for `q1` using fixed 80 MHz IF.\n",
"\n",
"- **QRM-RF** (Slot 8)\n",
" - $\\text{O}^{1}$ and $\\text{I}^{1}$: Shared readout line for `q0`/`q1` using a fixed LO set at 7.5 GHz.\n",
"\n",
"Note that in the hardware configuration below the mixers are uncorrected, but for high fidelity experiments this should also be done for all the modules."
]
},
{
"cell_type": "markdown",
"id": "7182d4be",
"metadata": {
"tags": [
"no_demo"
]
},
"source": [
"### Quantum device settings\n",
"Here we initialize our `QuantumDevice` and our qubit parameters, checkout this [tutorial](https://quantify-os.org/docs/quantify-scheduler/tutorials/Operations%20and%20Qubits.html) for further details.\n",
"\n",
"In short, a `QuantumDevice` contains device elements where we save our found parameters. Here we are loading a template for 2 qubits, but we will only use qubit 0."
]
},
{
"cell_type": "markdown",
"id": "462af799",
"metadata": {
"lines_to_next_cell": 0
},
"source": [
"## Rabi Oscillations"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "54513dac",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-12T18:00:22.786351Z",
"iopub.status.busy": "2025-03-12T18:00:22.786180Z",
"iopub.status.idle": "2025-03-12T18:00:23.418655Z",
"shell.execute_reply": "2025-03-12T18:00:23.417844Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"
<xarray.Dataset> Size: 5kB\n", "Dimensions: (acq_index_0: 200)\n", "Coordinates:\n", " * acq_index_0 (acq_index_0) int64 2kB 0 1 2 3 4 5 ... 194 195 196 197 198 199\n", "Data variables:\n", " 0 (acq_index_0) complex128 3kB (nan+nanj) ... (nan+nanj)
setting | \nvalue | \n
---|---|
q0:mw-q0.f_larmor | \n0 | \n
q1:mw-q1.f_larmor | \n0 | \n
setting | \nvalue | \n
---|---|
offset_ch0_path_I | \nNone | \n
offset_ch0_path_Q | \nNone | \n
offset_ch1_path_I | \nNone | \n
offset_ch1_path_Q | \nNone | \n
in0_gain | \nNone | \n
in1_gain | \nNone | \n
distortion_corrections | \n[{'bt': {'coeffs': None, 'config': 'QbloxFilte... | \n
out0_lo_freq_cal_type_default | \nLoCalEnum.OFF | \n
out1_lo_freq_cal_type_default | \nLoCalEnum.OFF | \n
setting | \nvalue | \n
---|---|
acq_protocol | \nSSBIntegrationComplex | \n
bin_mode | \naverage | \n
acq_return_type | \n<class 'complex'> | \n
repetitions | \n400 | \n
setting | \nvalue | \n
---|---|
instrument_type | \nQCM_RF | \n
setting | \nvalue | \n
---|---|
config_type | \nquantify_scheduler.backends.qblox_backend.Qblo... | \n
setting | \nvalue | \n
---|---|
repetitions | \n400 | \n
setting | \nvalue | \n
---|---|
offset_ch0_path_I | \nNone | \n
offset_ch0_path_Q | \nNone | \n
offset_ch1_path_I | \nNone | \n
offset_ch1_path_Q | \nNone | \n
in0_gain | \nNone | \n
in1_gain | \nNone | \n
distortion_corrections | \n[{'bt': {'coeffs': None, 'config': 'QbloxFilte... | \n
out0_lo_freq_cal_type_default | \nLoCalEnum.ON_LO_INTERM_FREQ_CHANGE | \n
out1_lo_freq_cal_type_default | \nLoCalEnum.OFF | \n
lo0_freq | \n5020000000.0 | \n
lo1_freq | \nNone | \n
out0_att | \n0 | \n
out1_att | \nNone | \n
in0_att | \nNone | \n
setting | \nvalue | \n
---|---|
auto_lo_cal | \non_lo_interm_freq_change | \n
auto_sideband_cal | \non_interm_freq_change | \n
setting | \nvalue | \n
---|---|
sync_en | \nTrue | \n
channel_name | \nreal_output_0 | \n
channel_name_measure | \n[real_input_1, real_input_0] | \n
connected_output_indices | \n(0,) | \n
connected_input_indices | \n(0, 1) | \n
seq_fn | \nNone | \n
thresholded_acq_trigger_write_en | \nNone | \n
thresholded_acq_trigger_write_address | \nNone | \n
thresholded_acq_trigger_write_invert | \nFalse | \n
nco_en | \nTrue | \n
init_offset_awg_path_I | \n0.0 | \n
init_offset_awg_path_Q | \n0.0 | \n
init_gain_awg_path_I | \n1.0 | \n
init_gain_awg_path_Q | \n1.0 | \n
modulation_freq | \n120000000.0 | \n
mixer_corr_phase_offset_degree | \nNone | \n
mixer_corr_gain_ratio | \nNone | \n
auto_sideband_cal | \nSidebandCalEnum.OFF | \n
integration_length_acq | \n1900 | \n
thresholded_acq_threshold | \nNone | \n
thresholded_acq_rotation | \nNone | \n
ttl_acq_input_select | \nNone | \n
ttl_acq_threshold | \nNone | \n
ttl_acq_auto_bin_incr_en | \nNone | \n
setting | \nvalue | \n
---|---|
repetitions | \n400 | \n
setting | \nvalue | \n
---|---|
num_bins | \n200 | \n
index | \n0 | \n
setting | \nvalue | \n
---|---|
interm_freq | \n80000000.0 | \n
setting | \nvalue | \n
---|---|
instrument_type | \nQCM | \n
setting | \nvalue | \n
---|---|
instrument_type | \nQRM | \n
setting | \nvalue | \n
---|---|
reference_source | \ninternal | \n
sync_on_external_trigger | \nNone | \n
setting | \nvalue | \n
---|---|
acq_channel | \n0 | \n
acq_indices | \n[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,... | \n
thresholded_trigger_count | \nNone | \n
setting | \nvalue | \n
---|---|
sync_en | \nTrue | \n
channel_name | \ncomplex_output_0 | \n
channel_name_measure | \nNone | \n
connected_output_indices | \n(0, 1) | \n
connected_input_indices | \n() | \n
seq_fn | \nNone | \n
thresholded_acq_trigger_write_en | \nNone | \n
thresholded_acq_trigger_write_address | \nNone | \n
thresholded_acq_trigger_write_invert | \nFalse | \n
nco_en | \nTrue | \n
init_offset_awg_path_I | \n0.0 | \n
init_offset_awg_path_Q | \n0.0 | \n
init_gain_awg_path_I | \n1.0 | \n
init_gain_awg_path_Q | \n1.0 | \n
modulation_freq | \n80000000.0 | \n
mixer_corr_phase_offset_degree | \n0.0 | \n
mixer_corr_gain_ratio | \n1.0 | \n
auto_sideband_cal | \nSidebandCalEnum.ON_INTERM_FREQ_CHANGE | \n
integration_length_acq | \nNone | \n
thresholded_acq_threshold | \nNone | \n
thresholded_acq_rotation | \nNone | \n
ttl_acq_input_select | \nNone | \n
ttl_acq_threshold | \nNone | \n
ttl_acq_auto_bin_incr_en | \nNone | \n
setting | \nvalue | \n
---|---|
sync_en | \nTrue | \n
channel_name | \nreal_output_0 | \n
channel_name_measure | \nNone | \n
connected_output_indices | \n(0,) | \n
connected_input_indices | \n() | \n
seq_fn | \nNone | \n
thresholded_acq_trigger_write_en | \nNone | \n
thresholded_acq_trigger_write_address | \nNone | \n
thresholded_acq_trigger_write_invert | \nFalse | \n
nco_en | \nTrue | \n
init_offset_awg_path_I | \n0.0 | \n
init_offset_awg_path_Q | \n0.0 | \n
init_gain_awg_path_I | \n1.0 | \n
init_gain_awg_path_Q | \n1.0 | \n
modulation_freq | \n0 | \n
mixer_corr_phase_offset_degree | \nNone | \n
mixer_corr_gain_ratio | \nNone | \n
auto_sideband_cal | \nSidebandCalEnum.OFF | \n
integration_length_acq | \nNone | \n
thresholded_acq_threshold | \nNone | \n
thresholded_acq_rotation | \nNone | \n
ttl_acq_input_select | \nNone | \n
ttl_acq_threshold | \nNone | \n
ttl_acq_auto_bin_incr_en | \nNone | \n
setting | \nvalue | \n
---|---|
interm_freq | \n70000000.0 | \n
setting | \nvalue | \n
---|---|
offset_ch0_path_I | \nNone | \n
offset_ch0_path_Q | \nNone | \n
offset_ch1_path_I | \nNone | \n
offset_ch1_path_Q | \nNone | \n
in0_gain | \nNone | \n
in1_gain | \nNone | \n
distortion_corrections | \n[{'bt': {'coeffs': None, 'config': 'QbloxFilte... | \n
out0_lo_freq_cal_type_default | \nLoCalEnum.OFF | \n
out1_lo_freq_cal_type_default | \nLoCalEnum.OFF | \n
lo0_freq | \nNone | \n
lo1_freq | \nNone | \n
out0_att | \nNone | \n
out1_att | \nNone | \n
in0_att | \nNone | \n
setting | \nvalue | \n
---|---|
repetitions | \n400 | \n
setting | \nvalue | \n
---|---|
instrument_type | \nCluster | \n
sequence_to_file | \nFalse | \n
ref | \ninternal | \n
setting | \nvalue | \n
---|---|
graph | \n[[cluster0.module2.real_output_0, q0:gt], [clu... | \n
setting | \nvalue | \n
---|---|
auto_lo_cal | \non_lo_interm_freq_change | \n
auto_sideband_cal | \non_interm_freq_change | \n