{ "cells": [ { "cell_type": "markdown", "id": "fc6d9cc0", "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": "code", "execution_count": 1, "id": "feba1238", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:35.896702Z", "iopub.status.busy": "2024-10-17T13:11:35.896539Z", "iopub.status.idle": "2024-10-17T13:11:36.852565Z", "shell.execute_reply": "2024-10-17T13:11:36.851820Z" }, "title": "HEADER" }, "outputs": [], "source": [ "import numpy as np\n", "\n", "from quantify_scheduler import Schedule\n", "from quantify_scheduler.operations.gate_library import Measure, Reset, X" ] }, { "cell_type": "code", "execution_count": 2, "id": "e7cae6a4", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:36.855088Z", "iopub.status.busy": "2024-10-17T13:11:36.854700Z", "iopub.status.idle": "2024-10-17T13:11:37.510518Z", "shell.execute_reply": "2024-10-17T13:11:37.509751Z" } }, "outputs": [], "source": [ "import json\n", "\n", "import rich # noqa:F401\n", "\n", "import quantify_core.data.handling as dh\n", "from quantify_scheduler.device_under_test.quantum_device import QuantumDevice\n", "\n", "from utils import initialize_hardware, run # noqa:F401" ] }, { "cell_type": "markdown", "id": "8445a6cf", "metadata": {}, "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", "- **QCM** (Slot 2)\n", " - $\\text{O}^{1}$: Flux line for `q0`.\n", " - $\\text{O}^{2}$: Flux line for `q1`.\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", "- **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": "code", "execution_count": 3, "id": "0f8dd2e1", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:37.513564Z", "iopub.status.busy": "2024-10-17T13:11:37.512896Z", "iopub.status.idle": "2024-10-17T13:11:37.517951Z", "shell.execute_reply": "2024-10-17T13:11:37.517324Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Data will be saved in:\n", "/root/quantify-data\n" ] } ], "source": [ "with open(\"configs/tuning_transmon_coupled_pair_hardware_config.json\") as hw_cfg_json_file:\n", " hardware_cfg = json.load(hw_cfg_json_file)\n", "\n", "# Enter your own dataset directory here!\n", "dh.set_datadir(dh.default_datadir())" ] }, { "cell_type": "markdown", "id": "63b81bf7", "metadata": {}, "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": "code", "execution_count": 4, "id": "a5fcdcf9", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:37.519896Z", "iopub.status.busy": "2024-10-17T13:11:37.519706Z", "iopub.status.idle": "2024-10-17T13:11:38.044589Z", "shell.execute_reply": "2024-10-17T13:11:38.043903Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/usr/local/lib/python3.9/site-packages/quantify_scheduler/backends/types/qblox.py:1220: ValidationWarning: Setting `auto_lo_cal=on_lo_interm_freq_change` will overwrite settings `dc_offset_i=0.0` and `dc_offset_q=0.0`. To suppress this warning, do not set either `dc_offset_i` or `dc_offset_q` for this port-clock.\n", " warnings.warn(\n", "/usr/local/lib/python3.9/site-packages/quantify_scheduler/backends/types/qblox.py:1235: ValidationWarning: Setting `auto_sideband_cal=on_interm_freq_change` will overwrite settings `amp_ratio=1.0` and `phase_error=0.0`. To suppress this warning, do not set either `amp_ratio` or `phase_error` for this port-clock.\n", " warnings.warn(\n" ] } ], "source": [ "quantum_device = QuantumDevice.from_json_file(\"devices/transmon_device_2q.json\")\n", "qubit = quantum_device.get_element(\"q0\")\n", "quantum_device.hardware_config(hardware_cfg)\n", "meas_ctrl, _, cluster = initialize_hardware(quantum_device, ip=None)" ] }, { "cell_type": "markdown", "id": "f0ba84c2", "metadata": { "lines_to_next_cell": 0, "title": "BODY" }, "source": [ "## Rabi Oscillations" ] }, { "cell_type": "code", "execution_count": 5, "id": "86600ad1", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:38.046903Z", "iopub.status.busy": "2024-10-17T13:11:38.046699Z", "iopub.status.idle": "2024-10-17T13:11:38.572708Z", "shell.execute_reply": "2024-10-17T13:11:38.572022Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<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)
" ], "text/plain": [ " 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)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pulse_amps = np.linspace(-0.14, 0.14, 200)\n", "sched = Schedule(\"rabi_amplitude\", 400)\n", "\n", "for acq_idx, pulse_amp in enumerate(pulse_amps):\n", " sched.add(Reset(qubit.name))\n", " sched.add(X(qubit.name, amp180=pulse_amp))\n", " sched.add(Measure(qubit.name, acq_index=acq_idx), rel_time=20e-9) # wait 20ns before measuring\n", "\n", "rabi_ds = run(schedule=sched, quantum_device=quantum_device)\n", "rabi_ds" ] }, { "cell_type": "code", "execution_count": 6, "id": "2522e47b", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:38.575073Z", "iopub.status.busy": "2024-10-17T13:11:38.574650Z", "iopub.status.idle": "2024-10-17T13:11:38.578233Z", "shell.execute_reply": "2024-10-17T13:11:38.577630Z" } }, "outputs": [], "source": [ "qubit.rxy.amp180(0.07)" ] }, { "cell_type": "code", "execution_count": 7, "id": "a2d0d635", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:38.580068Z", "iopub.status.busy": "2024-10-17T13:11:38.579904Z", "iopub.status.idle": "2024-10-17T13:11:38.614808Z", "shell.execute_reply": "2024-10-17T13:11:38.614209Z" } }, "outputs": [ { "data": { "text/html": [ "
{\n",
       "    'config_type': 'quantify_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig',\n",
       "    'hardware_description': {\n",
       "        'cluster0': {\n",
       "            'instrument_type': 'Cluster',\n",
       "            'modules': {\n",
       "                '6': {'instrument_type': 'QCM_RF'},\n",
       "                '2': {'instrument_type': 'QCM'},\n",
       "                '8': {'instrument_type': 'QRM_RF'}\n",
       "            },\n",
       "            'sequence_to_file': False,\n",
       "            'ref': 'internal'\n",
       "        }\n",
       "    },\n",
       "    'hardware_options': {\n",
       "        'output_att': {'q0:mw-q0.01': 10, 'q1:mw-q1.01': 10, 'q0:res-q0.ro': 60, 'q1:res-q1.ro': 60},\n",
       "        'mixer_corrections': {\n",
       "            'q0:mw-q0.01': {\n",
       "                'auto_lo_cal': 'on_lo_interm_freq_change',\n",
       "                'auto_sideband_cal': 'on_interm_freq_change',\n",
       "                'dc_offset_i': None,\n",
       "                'dc_offset_q': None,\n",
       "                'amp_ratio': 1.0,\n",
       "                'phase_error': 0.0\n",
       "            },\n",
       "            'q1:mw-q1.01': {\n",
       "                'auto_lo_cal': 'on_lo_interm_freq_change',\n",
       "                'auto_sideband_cal': 'on_interm_freq_change',\n",
       "                'dc_offset_i': None,\n",
       "                'dc_offset_q': None,\n",
       "                'amp_ratio': 1.0,\n",
       "                'phase_error': 0.0\n",
       "            },\n",
       "            'q0:res-q0.ro': {\n",
       "                'auto_lo_cal': 'on_lo_interm_freq_change',\n",
       "                'auto_sideband_cal': 'on_interm_freq_change',\n",
       "                'dc_offset_i': None,\n",
       "                'dc_offset_q': None,\n",
       "                'amp_ratio': 1.0,\n",
       "                'phase_error': 0.0\n",
       "            },\n",
       "            'q1:res-q1.ro': {\n",
       "                'auto_lo_cal': 'on_lo_interm_freq_change',\n",
       "                'auto_sideband_cal': 'on_interm_freq_change',\n",
       "                'dc_offset_i': None,\n",
       "                'dc_offset_q': None,\n",
       "                'amp_ratio': 1.0,\n",
       "                'phase_error': 0.0\n",
       "            }\n",
       "        },\n",
       "        'modulation_frequencies': {\n",
       "            'q0:mw-q0.01': {'interm_freq': 80000000.0},\n",
       "            'q1:mw-q1.01': {'interm_freq': 80000000.0},\n",
       "            'q0:res-q0.ro': {'lo_freq': 7500000000.0},\n",
       "            'q1:res-q1.ro': {'lo_freq': 7500000000.0}\n",
       "        }\n",
       "    },\n",
       "    'connectivity': {\n",
       "        'graph': [\n",
       "            ['cluster0.module6.complex_output_0', 'q0:mw'],\n",
       "            ['cluster0.module6.complex_output_1', 'q1:mw'],\n",
       "            ['cluster0.module2.real_output_0', 'q0:fl'],\n",
       "            ['cluster0.module2.real_output_1', 'q1:fl'],\n",
       "            ['cluster0.module8.complex_output_0', 'q0:res'],\n",
       "            ['cluster0.module8.complex_output_0', 'q1:res']\n",
       "        ]\n",
       "    }\n",
       "}\n",
       "
\n" ], "text/plain": [ "\u001b[1m{\u001b[0m\n", " \u001b[32m'config_type'\u001b[0m: \u001b[32m'quantify_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig'\u001b[0m,\n", " \u001b[32m'hardware_description'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'cluster0'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'instrument_type'\u001b[0m: \u001b[32m'Cluster'\u001b[0m,\n", " \u001b[32m'modules'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'6'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'instrument_type'\u001b[0m: \u001b[32m'QCM_RF'\u001b[0m\u001b[1m}\u001b[0m,\n", " \u001b[32m'2'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'instrument_type'\u001b[0m: \u001b[32m'QCM'\u001b[0m\u001b[1m}\u001b[0m,\n", " \u001b[32m'8'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'instrument_type'\u001b[0m: \u001b[32m'QRM_RF'\u001b[0m\u001b[1m}\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'sequence_to_file'\u001b[0m: \u001b[3;91mFalse\u001b[0m,\n", " \u001b[32m'ref'\u001b[0m: \u001b[32m'internal'\u001b[0m\n", " \u001b[1m}\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'hardware_options'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'output_att'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'q0:mw-q0.01'\u001b[0m: \u001b[1;36m10\u001b[0m, \u001b[32m'q1:mw-q1.01'\u001b[0m: \u001b[1;36m10\u001b[0m, \u001b[32m'q0:res-q0.ro'\u001b[0m: \u001b[1;36m60\u001b[0m, \u001b[32m'q1:res-q1.ro'\u001b[0m: \u001b[1;36m60\u001b[0m\u001b[1m}\u001b[0m,\n", " \u001b[32m'mixer_corrections'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'q0:mw-q0.01'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'auto_lo_cal'\u001b[0m: \u001b[32m'on_lo_interm_freq_change'\u001b[0m,\n", " \u001b[32m'auto_sideband_cal'\u001b[0m: \u001b[32m'on_interm_freq_change'\u001b[0m,\n", " \u001b[32m'dc_offset_i'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'dc_offset_q'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'amp_ratio'\u001b[0m: \u001b[1;36m1.0\u001b[0m,\n", " \u001b[32m'phase_error'\u001b[0m: \u001b[1;36m0.0\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'q1:mw-q1.01'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'auto_lo_cal'\u001b[0m: \u001b[32m'on_lo_interm_freq_change'\u001b[0m,\n", " \u001b[32m'auto_sideband_cal'\u001b[0m: \u001b[32m'on_interm_freq_change'\u001b[0m,\n", " \u001b[32m'dc_offset_i'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'dc_offset_q'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'amp_ratio'\u001b[0m: \u001b[1;36m1.0\u001b[0m,\n", " \u001b[32m'phase_error'\u001b[0m: \u001b[1;36m0.0\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'q0:res-q0.ro'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'auto_lo_cal'\u001b[0m: \u001b[32m'on_lo_interm_freq_change'\u001b[0m,\n", " \u001b[32m'auto_sideband_cal'\u001b[0m: \u001b[32m'on_interm_freq_change'\u001b[0m,\n", " \u001b[32m'dc_offset_i'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'dc_offset_q'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'amp_ratio'\u001b[0m: \u001b[1;36m1.0\u001b[0m,\n", " \u001b[32m'phase_error'\u001b[0m: \u001b[1;36m0.0\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'q1:res-q1.ro'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'auto_lo_cal'\u001b[0m: \u001b[32m'on_lo_interm_freq_change'\u001b[0m,\n", " \u001b[32m'auto_sideband_cal'\u001b[0m: \u001b[32m'on_interm_freq_change'\u001b[0m,\n", " \u001b[32m'dc_offset_i'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'dc_offset_q'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'amp_ratio'\u001b[0m: \u001b[1;36m1.0\u001b[0m,\n", " \u001b[32m'phase_error'\u001b[0m: \u001b[1;36m0.0\u001b[0m\n", " \u001b[1m}\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'modulation_frequencies'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'q0:mw-q0.01'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'interm_freq'\u001b[0m: \u001b[1;36m80000000.0\u001b[0m\u001b[1m}\u001b[0m,\n", " \u001b[32m'q1:mw-q1.01'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'interm_freq'\u001b[0m: \u001b[1;36m80000000.0\u001b[0m\u001b[1m}\u001b[0m,\n", " \u001b[32m'q0:res-q0.ro'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'lo_freq'\u001b[0m: \u001b[1;36m7500000000.0\u001b[0m\u001b[1m}\u001b[0m,\n", " \u001b[32m'q1:res-q1.ro'\u001b[0m: \u001b[1m{\u001b[0m\u001b[32m'lo_freq'\u001b[0m: \u001b[1;36m7500000000.0\u001b[0m\u001b[1m}\u001b[0m\n", " \u001b[1m}\u001b[0m\n", " \u001b[1m}\u001b[0m,\n", " \u001b[32m'connectivity'\u001b[0m: \u001b[1m{\u001b[0m\n", " \u001b[32m'graph'\u001b[0m: \u001b[1m[\u001b[0m\n", " \u001b[1m[\u001b[0m\u001b[32m'cluster0.module6.complex_output_0'\u001b[0m, \u001b[32m'q0:mw'\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[1m[\u001b[0m\u001b[32m'cluster0.module6.complex_output_1'\u001b[0m, \u001b[32m'q1:mw'\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[1m[\u001b[0m\u001b[32m'cluster0.module2.real_output_0'\u001b[0m, \u001b[32m'q0:fl'\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[1m[\u001b[0m\u001b[32m'cluster0.module2.real_output_1'\u001b[0m, \u001b[32m'q1:fl'\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[1m[\u001b[0m\u001b[32m'cluster0.module8.complex_output_0'\u001b[0m, \u001b[32m'q0:res'\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[1m[\u001b[0m\u001b[32m'cluster0.module8.complex_output_0'\u001b[0m, \u001b[32m'q1:res'\u001b[0m\u001b[1m]\u001b[0m\n", " \u001b[1m]\u001b[0m\n", " \u001b[1m}\u001b[0m\n", "\u001b[1m}\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "rich.print(quantum_device.hardware_config())" ] }, { "cell_type": "code", "execution_count": 8, "id": "364b573e", "metadata": { "execution": { "iopub.execute_input": "2024-10-17T13:11:38.616711Z", "iopub.status.busy": "2024-10-17T13:11:38.616541Z", "iopub.status.idle": "2024-10-17T13:11:38.622774Z", "shell.execute_reply": "2024-10-17T13:11:38.622193Z" } }, "outputs": [ { "data": { "text/plain": [ "'devices/device_2q_2024-10-17_13-11-38_UTC.json'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "quantum_device.to_json_file(\"devices/\")" ] } ], "metadata": { "files_to_bundle_in_zip_file": [ "configs/tuning_transmon_coupled_pair_hardware_config.json", "devices/transmon_device_2q.json", "utils.py" ], "jupytext": { "main_language": "python", "notebook_metadata_filter": "files_to_bundle_in_zip_file" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" } }, "nbformat": 4, "nbformat_minor": 5 }