{ "cells": [ { "cell_type": "markdown", "id": "5292d317", "metadata": {}, "source": [ "# Fixed Frequency Transmon\n", "This notebook shows a typical tuneup sequence for fixed frequency transmon qubits.\n", "The notebook aims to be as compact as possible, for more details, please refer to the respective experiments." ] }, { "cell_type": "markdown", "id": "eea8eef1", "metadata": {}, "source": [ "# Time of flight measurement\n", "Here show how to measure time of flight for your system.\n", "This is useful to calibrate the acquisition delay for subsequent experiments." ] }, { "cell_type": "code", "execution_count": 1, "id": "a68aad66", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:30.227668Z", "iopub.status.busy": "2024-11-13T02:36:30.227246Z", "iopub.status.idle": "2024-11-13T02:36:31.928551Z", "shell.execute_reply": "2024-11-13T02:36:31.927685Z" }, "tags": [ "imports" ] }, "outputs": [], "source": [ "import json\n", "from functools import partial\n", "from typing import Literal\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import rich # noqa:F401\n", "from qcodes.parameters import ManualParameter\n", "from sklearn.metrics import ConfusionMatrixDisplay\n", "\n", "import quantify_core.data.handling as dh\n", "from quantify_core.analysis.readout_calibration_analysis import ReadoutCalibrationAnalysis\n", "from quantify_core.analysis.time_of_flight_analysis import TimeOfFlightAnalysis\n", "from quantify_scheduler import Schedule\n", "from quantify_scheduler.backends.qblox import constants\n", "from quantify_scheduler.device_under_test.quantum_device import QuantumDevice\n", "from quantify_scheduler.enums import BinMode\n", "from quantify_scheduler.gettables import ScheduleGettable\n", "from quantify_scheduler.math import closest_number_ceil\n", "from quantify_scheduler.operations.gate_library import Measure, Reset, Rxy, X\n", "from quantify_scheduler.operations.pulse_library import IdlePulse\n", "from quantify_scheduler.schedules.timedomain_schedules import ramsey_sched\n", "\n", "from utils import initialize_hardware, run # noqa:F401" ] }, { "cell_type": "code", "execution_count": 2, "id": "e1954073", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:31.931745Z", "iopub.status.busy": "2024-11-13T02:36:31.930878Z", "iopub.status.idle": "2024-11-13T02:36:31.934676Z", "shell.execute_reply": "2024-11-13T02:36:31.934033Z" }, "tags": [ "config", "header_1" ] }, "outputs": [], "source": [ "hw_config_path = \"configs/tuning_transmon_coupled_pair_hardware_config.json\"\n", "device_path = \"devices/transmon_device_2q.json\"" ] }, { "cell_type": "code", "execution_count": 3, "id": "2dad16bb", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:31.936562Z", "iopub.status.busy": "2024-11-13T02:36:31.936383Z", "iopub.status.idle": "2024-11-13T02:36:31.940428Z", "shell.execute_reply": "2024-11-13T02:36:31.939750Z" }, "tags": [ "header_2" ] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Data will be saved in:\n", "/root/quantify-data\n" ] } ], "source": [ "with open(hw_config_path) 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": "code", "execution_count": 4, "id": "bb5b12a5", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:31.942273Z", "iopub.status.busy": "2024-11-13T02:36:31.942084Z", "iopub.status.idle": "2024-11-13T02:36:32.459879Z", "shell.execute_reply": "2024-11-13T02:36:32.459197Z" }, "tags": [ "header_3" ] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/builds/qblox/packages/software/qblox_instruments_docs/.venv/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", "/builds/qblox/packages/software/qblox_instruments_docs/.venv/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(device_path)\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": "dce7e5a9", "metadata": { "lines_to_next_cell": 0 }, "source": [ "## Schedule definition" ] }, { "cell_type": "code", "execution_count": 5, "id": "6951b400", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:32.462142Z", "iopub.status.busy": "2024-11-13T02:36:32.461922Z", "iopub.status.idle": "2024-11-13T02:36:32.465730Z", "shell.execute_reply": "2024-11-13T02:36:32.465040Z" } }, "outputs": [], "source": [ "def tof_trace_schedule(\n", " qubit_name: str,\n", " repetitions: int = 1,\n", ") -> Schedule:\n", " schedule = Schedule(\"Trace measurement schedule\", repetitions=repetitions)\n", " schedule.add(Measure(qubit_name, acq_protocol=\"Trace\"))\n", " return schedule" ] }, { "cell_type": "markdown", "id": "3dc3d597", "metadata": { "lines_to_next_cell": 0 }, "source": [ "## Measuring time of flight with trace acquisition" ] }, { "cell_type": "code", "execution_count": 6, "id": "57a28c22", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:32.467583Z", "iopub.status.busy": "2024-11-13T02:36:32.467392Z", "iopub.status.idle": "2024-11-13T02:36:32.471399Z", "shell.execute_reply": "2024-11-13T02:36:32.470723Z" }, "lines_to_next_cell": 0 }, "outputs": [], "source": [ "def set_readout_attenuation_hardware_config(attenuation_dB: int):\n", " hwcfg = quantum_device.hardware_config()\n", " output_att = hwcfg[\"hardware_options\"][\"output_att\"]\n", " output_att[f\"{qubit.ports.readout()}-{qubit.name}.ro\"] = attenuation_dB\n", " quantum_device.hardware_config(hwcfg)\n", "\n", "\n", "set_readout_attenuation_hardware_config(0)\n", "qubit.measure.pulse_duration(300e-9)\n", "qubit.measure.integration_time(1e-6)\n", "qubit.measure.pulse_amp(0.1)\n", "qubit.measure.acq_delay(4e-9)" ] }, { "cell_type": "code", "execution_count": 7, "id": "33d03939", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:32.473177Z", "iopub.status.busy": "2024-11-13T02:36:32.472986Z", "iopub.status.idle": "2024-11-13T02:36:32.477297Z", "shell.execute_reply": "2024-11-13T02:36:32.476575Z" }, "lines_to_next_cell": 0 }, "outputs": [], "source": [ "tof_t = ManualParameter(name=\"tof_t\", unit=\"ns\", label=\"Trace acquisition sample\")\n", "tof_t.batched = True\n", "tof_t.batch_size = round(qubit.measure.integration_time() * constants.SAMPLING_RATE)\n", "\n", "tof_sched_kwargs = dict(\n", " qubit_name=qubit.name,\n", ")\n", "\n", "# set gettable\n", "gettable = ScheduleGettable(\n", " quantum_device,\n", " schedule_function=tof_trace_schedule,\n", " schedule_kwargs=tof_sched_kwargs,\n", " real_imag=False,\n", " batched=True,\n", ")\n", "\n", "# set measurement control\n", "meas_ctrl.gettables(gettable)" ] }, { "cell_type": "code", "execution_count": 8, "id": "18b84cad", "metadata": { "execution": { "iopub.execute_input": "2024-11-13T02:36:32.479038Z", "iopub.status.busy": "2024-11-13T02:36:32.478848Z", "iopub.status.idle": "2024-11-13T02:36:32.634100Z", "shell.execute_reply": "2024-11-13T02:36:32.633442Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Starting batched measurement...\n", "Iterative settable(s) [outer loop(s)]:\n", "\t --- (None) --- \n", "Batched settable(s):\n", "\t tof_t \n", "Batch size limit: 1000\n", "\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7711dd0141eb44d88f67ac0c38146e60", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Completed: 0%| [ elapsed time: 00:00 | time left: ? ] it" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
<xarray.Dataset> Size: 24kB\n", "Dimensions: (x0: 1000)\n", "Coordinates:\n", " * x0 (x0) int64 8kB 0 1 2 3 4 5 6 7 ... 992 993 994 995 996 997 998 999\n", "Data variables:\n", " y0 (x0) float64 8kB 0.001493 -0.0005849 ... 0.002208 0.0007401\n", " y1 (x0) float64 8kB 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", "Attributes:\n", " tuid: 20241113-023632-482-9d6ba1\n", " name: Time of flight measurement q0\n", " grid_2d: False\n", " grid_2d_uniformly_spaced: False\n", " 1d_2_settables_uniformly_spaced: False