{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "806c3013", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:51.454728Z", "iopub.status.busy": "2025-04-17T20:54:51.454415Z", "iopub.status.idle": "2025-04-17T20:54:51.459752Z", "shell.execute_reply": "2025-04-17T20:54:51.459036Z" }, "nbsphinx": "hidden" }, "outputs": [], "source": [ "# Copyright 2025 Keysight Technologies Inc." ] }, { "cell_type": "raw", "id": "15b9e032", "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": "fc2607eb", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:51.462616Z", "iopub.status.busy": "2025-04-17T20:54:51.462357Z", "iopub.status.idle": "2025-04-17T20:54:54.859440Z", "shell.execute_reply": "2025-04-17T20:54:54.858291Z" } }, "outputs": [], "source": [ "import keysight.qcs as qcs\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 3, "id": "9217687a", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:54.865253Z", "iopub.status.busy": "2025-04-17T20:54:54.864545Z", "iopub.status.idle": "2025-04-17T20:54:54.873015Z", "shell.execute_reply": "2025-04-17T20:54:54.872119Z" }, "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": "c9169c67", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:54.876206Z", "iopub.status.busy": "2025-04-17T20:54:54.875693Z", "iopub.status.idle": "2025-04-17T20:54:55.036503Z", "shell.execute_reply": "2025-04-17T20:54:55.035824Z" } }, "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": "5c493b73", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.039822Z", "iopub.status.busy": "2025-04-17T20:54:55.039489Z", "iopub.status.idle": "2025-04-17T20:54:55.093396Z", "shell.execute_reply": "2025-04-17T20:54:55.092585Z" }, "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": "a79d377a", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.096439Z", "iopub.status.busy": "2025-04-17T20:54:55.096144Z", "iopub.status.idle": "2025-04-17T20:54:55.100286Z", "shell.execute_reply": "2025-04-17T20:54:55.099568Z" }, "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": "31adee28", "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": "892e118b", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.103163Z", "iopub.status.busy": "2025-04-17T20:54:55.102884Z", "iopub.status.idle": "2025-04-17T20:54:55.185780Z", "shell.execute_reply": "2025-04-17T20:54:55.184995Z" } }, "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": "4b74f30b", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.188872Z", "iopub.status.busy": "2025-04-17T20:54:55.188574Z", "iopub.status.idle": "2025-04-17T20:54:55.477933Z", "shell.execute_reply": "2025-04-17T20:54:55.476881Z" }, "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": "7e51df27", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.481384Z", "iopub.status.busy": "2025-04-17T20:54:55.481078Z", "iopub.status.idle": "2025-04-17T20:54:55.532341Z", "shell.execute_reply": "2025-04-17T20:54:55.531655Z" }, "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": "6a6c4856", "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": "b9362b3c", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.535634Z", "iopub.status.busy": "2025-04-17T20:54:55.535341Z", "iopub.status.idle": "2025-04-17T20:54:55.544051Z", "shell.execute_reply": "2025-04-17T20:54:55.542778Z" } }, "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": "6f56fa63", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.547359Z", "iopub.status.busy": "2025-04-17T20:54:55.547034Z", "iopub.status.idle": "2025-04-17T20:54:55.552247Z", "shell.execute_reply": "2025-04-17T20:54:55.551431Z" }, "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": "6ac34652", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.555607Z", "iopub.status.busy": "2025-04-17T20:54:55.555061Z", "iopub.status.idle": "2025-04-17T20:54:55.588396Z", "shell.execute_reply": "2025-04-17T20:54:55.587585Z" }, "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": "c5240612", "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": "5ba34af3", "metadata": { "execution": { "iopub.execute_input": "2025-04-17T20:54:55.592515Z", "iopub.status.busy": "2025-04-17T20:54:55.592214Z", "iopub.status.idle": "2025-04-17T20:54:55.595869Z", "shell.execute_reply": "2025-04-17T20:54:55.595130Z" } }, "outputs": [], "source": [ "if run_on_hw:\n", " res_spectroscopy2D.execute()" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "nbsphinx,raw_mimetype,-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 }