{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "7887ef23", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:10.283273Z", "iopub.status.busy": "2025-06-13T13:21:10.282975Z", "iopub.status.idle": "2025-06-13T13:21:10.288053Z", "shell.execute_reply": "2025-06-13T13:21:10.287361Z" }, "nbsphinx": "hidden" }, "outputs": [], "source": [ "# Copyright 2025 Keysight Technologies Inc." ] }, { "cell_type": "raw", "id": "a73b4815", "metadata": { "lines_to_next_cell": 0, "raw_mimetype": "text/restructuredtext" }, "source": [ "Live Plotting\n", "=============\n", "\n", "The QCS is able to display live plots for the IQ data of programs while they are\n", "running.\n", "Currently the only programs capable of running live plots are one-dimensional\n", "and two-dimensional software sweeps. The\n", ":py:class:`~keysight.qcs.executor.HclBackend` must also be set with\n", "``hw_demod = True``.\n", "\n", "In order to enable live plotting, set the ``live_plotting_config`` parameter\n", "on :py:class:`~keysight.qcs.executor.HclBackend` with the channels to visualize.\n", "\n", "Live plotting on a program\n", "**************************" ] }, { "cell_type": "code", "execution_count": 2, "id": "6e2496d7", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:10.290973Z", "iopub.status.busy": "2025-06-13T13:21:10.290693Z", "iopub.status.idle": "2025-06-13T13:21:14.176024Z", "shell.execute_reply": "2025-06-13T13:21:14.175061Z" } }, "outputs": [], "source": [ "import keysight.qcs as qcs\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 3, "id": "dada891a", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.181071Z", "iopub.status.busy": "2025-06-13T13:21:14.180416Z", "iopub.status.idle": "2025-06-13T13:21:14.189971Z", "shell.execute_reply": "2025-06-13T13:21:14.189116Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "\n", "# Define a channel mapper or load one from file.\n", "channel_mapper_exists = False\n", "\n", "if channel_mapper_exists:\n", " mapper = qcs.load(\"\")\n", "else:\n", " # generate an empty channel mapper with the correct address\n", " mapper = qcs.ChannelMapper(\"127.0.0.1\")\n", "\n", "readout_pulse_channels = qcs.Channels([0, 1], \"readout_pulse\", absolute_phase=True)\n", "readout_acquisition_channels = qcs.Channels(\n", " [0, 1], \"readout_acquisition\", absolute_phase=True\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "ed055c83", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.193575Z", "iopub.status.busy": "2025-06-13T13:21:14.193200Z", "iopub.status.idle": "2025-06-13T13:21:14.365461Z", "shell.execute_reply": "2025-06-13T13:21:14.364802Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
\n", " \n", "\tkeysight-logo-svg\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\n", "\n", " \n", "
\n", " Program\n", "
\n", " \n", "\n", "\n", "\n", "
\n", " Program\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Layers1
Targets4
Repetitions\n", " Sweep with 50 repetitions\n", "
\n", " Associations\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
frequencyArray(name=frequencies, shape=(50,), dtype=float, unit=none, value=[5 GHz, 5.0051 GHz, 5.0102 GHz, 5.01531 GHz, 5.02041 GHz, 5.02551 GHz, 5.03061 GHz, 5.03571 GHz, 5.04082 GHz, 5.04592 GHz, ... ])
\n", " Repeat with 50 repetitions\n", "
\n", "
\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", " Layer #0\n", "
\n", " \n", "\n", "\n", "\n", "
\n", " Layer #0 \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
\n", "
\n", "\n", "
\n", "
\n", "
\n", " readout_pulse\n", " \n", " 0\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " RFWaveform on ('readout_pulse', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Amplitude1
FrequencyScalar(name=frequency, value=None, dtype=float, unit=Hz)
EnvelopeGaussianEnvelope(2.0)
Instantaneous Phase0 rad
Post-phase0 rad
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " 1\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " RFWaveform on ('readout_pulse', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Amplitude1
FrequencyScalar(name=frequency, value=None, dtype=float, unit=Hz)
EnvelopeGaussianEnvelope(2.0)
Instantaneous Phase0 rad
Post-phase0 rad
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " readout_acquisition\n", " \n", " 0\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Acquisition on ('readout_acquisition', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Integration Filter\n", " \n", " \n", "\n", "\n", "\n", "
\n", " RFWaveform \n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Amplitude1
Frequency[5.1 GHz, 5.15 GHz]
EnvelopeGaussianEnvelope(2.0)
Instantaneous Phase0 rad
Post-phase0 rad
\n", "
\n", "\n", "
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " 1\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Acquisition on ('readout_acquisition', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Integration Filter\n", " \n", " \n", "\n", "\n", "\n", "
\n", " RFWaveform \n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration80 ns
Amplitude1
Frequency[5.1 GHz, 5.15 GHz]
EnvelopeGaussianEnvelope(2.0)
Instantaneous Phase0 rad
Post-phase0 rad
\n", "
\n", "\n", "
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": { "text/html": { "isolated": true } }, "output_type": "display_data" } ], "source": [ "# Define a program to run\n", "program = qcs.Program()\n", "frequency = qcs.Scalar(\"frequency\", dtype=float)\n", "waveform = qcs.RFWaveform(80e-9, qcs.GaussianEnvelope(), 1, frequency)\n", "int_filter = qcs.RFWaveform(80e-9, qcs.GaussianEnvelope(), 1, [5.1e9, 5.15e9])\n", "program.add_waveform(waveform, readout_pulse_channels)\n", "program.add_acquisition(int_filter, readout_acquisition_channels)\n", "program.n_shots(50)\n", "frequencies = qcs.Array(\"frequencies\", value=np.linspace(5e9, 5.25e9, 50))\n", "program.sweep(frequencies, frequency)\n", "program.draw()" ] }, { "cell_type": "code", "execution_count": 5, "id": "086943f4", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.369241Z", "iopub.status.busy": "2025-06-13T13:21:14.368918Z", "iopub.status.idle": "2025-06-13T13:21:14.424783Z", "shell.execute_reply": "2025-06-13T13:21:14.423964Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "# Setup live plotting to display the two digitizer channels\n", "backend = qcs.HclBackend(\n", " channel_mapper=mapper,\n", " hw_demod=True,\n", " live_plotting_config=readout_acquisition_channels,\n", ")" ] }, { "cell_type": "code", "execution_count": 6, "id": "94c83314", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.428095Z", "iopub.status.busy": "2025-06-13T13:21:14.427791Z", "iopub.status.idle": "2025-06-13T13:21:14.431712Z", "shell.execute_reply": "2025-06-13T13:21:14.431012Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "# Set this to True if connected to hardware\n", "run_on_hw = False\n", "\n", "if run_on_hw:\n", " # Execute the program.\n", " # While running, live IQ data for the frequency sweep will be shown.\n", " program_result = qcs.Executor(backend).execute(program)\n", "\n", " # Plot the \"static\" version of the plot to compare the results\n", " program_result.plot_iq(channel_subplots=False, plot_type=\"linear\")" ] }, { "cell_type": "raw", "id": "4df09d35", "metadata": { "lines_to_next_cell": 0, "raw_mimetype": "text/restructuredtext" }, "source": [ "\n", "Live plotting on an experiment\n", "******************************\n", "Live plotting can also be setup to run on experiments.\n", "Here we show an example of setting up live plotting to run with a 2D spectroscopy\n", "experiment. See :doc:`../../applications/res_spec` for more details on setting up\n", "this experiment." ] }, { "cell_type": "code", "execution_count": 7, "id": "a6a7611e", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.435541Z", "iopub.status.busy": "2025-06-13T13:21:14.435180Z", "iopub.status.idle": "2025-06-13T13:21:14.526553Z", "shell.execute_reply": "2025-06-13T13:21:14.525681Z" } }, "outputs": [], "source": [ "qubits = qcs.Qudits([0, 1])\n", "calibration_set = qcs.experiments.make_calibration_set(qubits=len(qubits))" ] }, { "cell_type": "code", "execution_count": 8, "id": "69d48697", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.529920Z", "iopub.status.busy": "2025-06-13T13:21:14.529594Z", "iopub.status.idle": "2025-06-13T13:21:14.837117Z", "shell.execute_reply": "2025-06-13T13:21:14.836275Z" }, "lines_to_next_cell": 0 }, "outputs": [], "source": [ "# Create a resonator spectroscopy experiment with live plotting\n", "# Note that the channels for live plotting match the channels from the calibration set.\n", "backend = qcs.HclBackend(\n", " channel_mapper=mapper,\n", " hw_demod=True,\n", " live_plotting_config=readout_acquisition_channels,\n", ")\n", "\n", "res_spectroscopy2D = qcs.experiments.ResonatorSpectroscopy2D(\n", " backend=backend,\n", " calibration_set=calibration_set,\n", " qubits=qubits,\n", " operation=\"measurement\",\n", ")" ] }, { "cell_type": "code", "execution_count": 9, "id": "43905abf", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.840984Z", "iopub.status.busy": "2025-06-13T13:21:14.840591Z", "iopub.status.idle": "2025-06-13T13:21:14.890806Z", "shell.execute_reply": "2025-06-13T13:21:14.889792Z" }, "lines_to_next_cell": 0 }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
\n", " \n", "\tkeysight-logo-svg\n", "\t\n", "\t\n", "\t\t\n", "\t\n", "\n", "\n", " \n", "
\n", " Program\n", "
\n", " \n", "\n", "\n", "\n", "
\n", " Program\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration105 ns
Layers1
Targets4
Repetitions\n", "
\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", " Layer #0\n", "
\n", " \n", "\n", "\n", "\n", "
\n", " Layer #0 \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Duration105 ns
\n", "
\n", "\n", "
\n", "
\n", "
\n", " readout_pulse\n", " \n", " 0\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_pulse', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=readout_pulse_delay, shape=(2,), dtype=float, unit=s, value=[0 s, 0 s])
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " RFWaveform on ('readout_pulse', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=readout_pulse_duration, shape=(2,), dtype=float, unit=s, value=[100 ns, 100 ns])
AmplitudeArraySlice(name=readout_pulse_amplitudes, shape=(2,), dtype=float, unit=none, value=[0.1, 0.1])
FrequencyArraySlice(name=readout_frequencies, shape=(2,), dtype=float, unit=Hz, value=[5.15 GHz, 5.15 GHz])
EnvelopeSineEnvelope()
Instantaneous PhaseArraySlice(name=readout_pulse_phases, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
Post-phaseArraySlice(name=measurement_post_phase, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_pulse', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationScalar(name=_implicit, value=5 ns, dtype=float, unit=s)
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " 1\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_pulse', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=readout_pulse_delay, shape=(2,), dtype=float, unit=s, value=[0 s, 0 s])
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " RFWaveform on ('readout_pulse', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=readout_pulse_duration, shape=(2,), dtype=float, unit=s, value=[100 ns, 100 ns])
AmplitudeArraySlice(name=readout_pulse_amplitudes, shape=(2,), dtype=float, unit=none, value=[0.1, 0.1])
FrequencyArraySlice(name=readout_frequencies, shape=(2,), dtype=float, unit=Hz, value=[5.15 GHz, 5.15 GHz])
EnvelopeSineEnvelope()
Instantaneous PhaseArraySlice(name=readout_pulse_phases, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
Post-phaseArraySlice(name=measurement_post_phase, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_pulse', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationScalar(name=_implicit, value=5 ns, dtype=float, unit=s)
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " readout_acquisition\n", " \n", " 0\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_acquisition', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=acquisition_delay, shape=(2,), dtype=float, unit=s, value=[5 ns, 5 ns])
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Acquisition on ('readout_acquisition', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArray(name=_implicit, shape=(2,), dtype=float, unit=s, value=[100 ns, 100 ns])
Integration Filter\n", " \n", " \n", "\n", "\n", "\n", "
\n", " RFWaveform \n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=acquisition_duration, shape=(2,), dtype=float, unit=s, value=[100 ns, 100 ns])
AmplitudeArraySlice(name=measurement_integrator_amplitude, shape=(2,), dtype=float, unit=none, value=[1, 1])
FrequencyArraySlice(name=readout_frequencies, shape=(2,), dtype=float, unit=Hz, value=[5.15 GHz, 5.15 GHz])
EnvelopeConstantEnvelope()
Instantaneous PhaseArraySlice(name=measurement_integrator_phase, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
Post-phaseArraySlice(name=measurement_integrator_post_phase, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
\n", "
\n", "\n", "
ClassifierClassifier(ArraySlice(name=references, shape=(2, 2), dtype=complex, unit=none))
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_acquisition', 0)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationScalar(name=_implicit, value=4.96308e-24 s, dtype=float, unit=s)
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " 1\n", " \n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_acquisition', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=acquisition_delay, shape=(2,), dtype=float, unit=s, value=[5 ns, 5 ns])
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Acquisition on ('readout_acquisition', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArray(name=_implicit, shape=(2,), dtype=float, unit=s, value=[100 ns, 100 ns])
Integration Filter\n", " \n", " \n", "\n", "\n", "\n", "
\n", " RFWaveform \n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationArraySlice(name=acquisition_duration, shape=(2,), dtype=float, unit=s, value=[100 ns, 100 ns])
AmplitudeArraySlice(name=measurement_integrator_amplitude, shape=(2,), dtype=float, unit=none, value=[1, 1])
FrequencyArraySlice(name=readout_frequencies, shape=(2,), dtype=float, unit=Hz, value=[5.15 GHz, 5.15 GHz])
EnvelopeConstantEnvelope()
Instantaneous PhaseArraySlice(name=measurement_integrator_phase, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
Post-phaseArraySlice(name=measurement_integrator_post_phase, shape=(2,), dtype=float, unit=rad, value=[0 rad, 0 rad])
\n", "
\n", "\n", "
ClassifierClassifier(ArraySlice(name=references, shape=(2, 2), dtype=complex, unit=none))
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", " \n", "
\n", " \n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " Delay on ('readout_acquisition', 1)\n", "
\n", "
\n", " Parameters\n", "
\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "
DurationScalar(name=_implicit, value=4.96308e-24 s, dtype=float, unit=s)
\n", "
\n", "\n", "\n", "
\n", "
\n", "
\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": { "text/html": { "isolated": true } }, "output_type": "display_data" } ], "source": [ "# Draw the program to view the operations to be performed on hardware\n", "res_spectroscopy2D.draw()" ] }, { "cell_type": "raw", "id": "d25bca83", "metadata": { "lines_to_next_cell": 0, "raw_mimetype": "text/restructuredtext" }, "source": [ "Next, we define the sweep values for both the\n", "amplitude and frequency of the readout pulse.\n" ] }, { "cell_type": "code", "execution_count": 10, "id": "abbcebfa", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.894073Z", "iopub.status.busy": "2025-06-13T13:21:14.893767Z", "iopub.status.idle": "2025-06-13T13:21:14.902477Z", "shell.execute_reply": "2025-06-13T13:21:14.901738Z" } }, "outputs": [], "source": [ "# Retrieve the readout frequencies stored in the calibration set for the target qubits\n", "current_freq = res_spectroscopy2D.calibration_set.variables.readout_frequencies[\n", " [0, 1]\n", "].value\n", "\n", "# Set the range for sweeping the readout pulse frequency\n", "start_frequency = current_freq - 200e6\n", "end_frequency = current_freq + 200e6\n", "freq_steps = 9\n", "freq_scan_values = np.linspace(start_frequency, end_frequency, freq_steps)" ] }, { "cell_type": "code", "execution_count": 11, "id": "921f279d", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.905648Z", "iopub.status.busy": "2025-06-13T13:21:14.905355Z", "iopub.status.idle": "2025-06-13T13:21:14.910224Z", "shell.execute_reply": "2025-06-13T13:21:14.909496Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "# Set the range for sweeping the readout pulse amplitude (units = V)\n", "start_amplitude = 0.1 if len(qubits) == 1 else [0.1] * len(qubits)\n", "end_amplitude = 1 if len(qubits) == 1 else [1] * len(qubits)\n", "ampl_steps = 10\n", "ampl_scan_values = np.linspace(start_amplitude, end_amplitude, ampl_steps)" ] }, { "cell_type": "code", "execution_count": 12, "id": "aa4af590", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.913547Z", "iopub.status.busy": "2025-06-13T13:21:14.913224Z", "iopub.status.idle": "2025-06-13T13:21:14.941030Z", "shell.execute_reply": "2025-06-13T13:21:14.940183Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "# Configure the repetitions for this experiment\n", "res_spectroscopy2D.configure_repetitions(\n", " frequencies=freq_scan_values,\n", " frequency_name=\"readout_frequencies\",\n", " amplitudes=ampl_scan_values,\n", " amplitude_name=\"readout_pulse_amplitudes\",\n", " n_shots=10,\n", ")" ] }, { "cell_type": "raw", "id": "bce689d7", "metadata": { "lines_to_next_cell": 0, "raw_mimetype": "text/restructuredtext" }, "source": [ "We can now execute the experiment and see the live 2D heatmaps." ] }, { "cell_type": "code", "execution_count": 13, "id": "c761dcac", "metadata": { "execution": { "iopub.execute_input": "2025-06-13T13:21:14.944534Z", "iopub.status.busy": "2025-06-13T13:21:14.944219Z", "iopub.status.idle": "2025-06-13T13:21:14.948026Z", "shell.execute_reply": "2025-06-13T13:21:14.947270Z" } }, "outputs": [], "source": [ "if run_on_hw:\n", " res_spectroscopy2D.execute()" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "raw_mimetype,nbsphinx,-all", "main_language": "python", "notebook_metadata_filter": "-all", "text_representation": { "extension": ".py", "format_name": "percent" } }, "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.10.15" } }, "nbformat": 4, "nbformat_minor": 5 }