See also
A Jupyter notebook version of this tutorial can be downloaded here.

Coupled qubits characterization#
This coupled-qubits characterization experiment aims to demonstrate two-qubit interactions between flux-tunable transmons. At the start of the experiment, two neighboring qubits with different \(f_{01}\) frequencies are prepared in the |1⟩ state. By playing a pulse on the flux line of the qubit with the highest frequency (\(q_0\) in this example), we can bring the |20⟩ and |11⟩ levels into resonance, which causes the two-qubit state to oscillate between the |11⟩ and |20⟩ states at a rate proportional to the coupling \(g\). For each full rotation \(\ket{11}\rightarrow\ket{20}\rightarrow\ket{11}\), the state picks up a global phase \(\pi\), which allows for the implementation of two-qubit gates. The goal of the characterization is to find the correct amplitude and duration of the pulse that should be played on the flux line of the high-frequency qubit, such that a \(\pi\) phase shift is accumulated, resulting in a CZ gate.
[1]:
import numpy as np
from xarray import open_dataset
from qblox_scheduler import HardwareAgent, Schedule
from qblox_scheduler.analysis.helpers import acq_coords_to_dims
from qblox_scheduler.operations import Measure, Reset, SquarePulse, X
from qblox_scheduler.operations.expressions import DType
from qblox_scheduler.operations.loop_domains import arange
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
/.venv/lib/python3.14/site-packages/quantify_core/utilities/general.py:13: QCoDeSDeprecationWarning: The `qcodes.utils.helpers` module is deprecated. Please consult the api documentation at https://microsoft.github.io/Qcodes/api/index.html for alternatives.
from qcodes.utils.helpers import NumpyJSONEncoder
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
Setup#
The hardware agent manages the connection to the instrument and ensures that pulses and acquisitions happen over the appropriate input and output channels of the Cluster. The cell below creates an instance of the HardwareAgent based on the hardware- and device-under-test configuration files in the ./dependencies/configs folder, allowing us to start doing measurements. We also define some convenient aliases to use throughout our measurements. For a more thorough discussion of the
hardware- and device-under-test configuration files, check out this tutorial.
[2]:
# Set up hardware agent, this automatically connects to the instrument
hw_agent = HardwareAgent(
hardware_configuration="./dependencies/configs/hw_config.json",
quantum_device_configuration="./dependencies/configs/dut_config.json",
)
# convenience aliases
q0 = hw_agent.quantum_device.get_element("q0") # Qubits 0 and 2 are measured using QRM-RF + QCM-RF
q2 = hw_agent.quantum_device.get_element("q2")
q3 = hw_agent.quantum_device.get_element("q3") # Qubit 3 is measured using QRC
cluster = hw_agent.get_clusters()["cluster"]
hw_options = hw_agent.hardware_configuration.hardware_options
qubit = q0
/.venv/lib/python3.14/site-packages/qblox_scheduler/qblox/hardware_agent.py:499: UserWarning: cluster: Trying to instantiate cluster with ip 'None'.Creating a dummy cluster.
warnings.warn(
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
Experiment settings#
[3]:
# Flux settings
flux_start = 0.148
flux_stop = 0.155
flux_step = 0.000125
# Time settings
time_start = 25e-9
time_stop = 250e-9
time_step = 1e-9
repetitions = 1
Experiment schedule#
[4]:
coupled_qubits_sched = Schedule("coupled_qubits")
with (
coupled_qubits_sched.loop(arange(0, repetitions, 1, DType.NUMBER)),
coupled_qubits_sched.loop(arange(flux_start, flux_stop, flux_step, DType.AMPLITUDE)) as amp,
coupled_qubits_sched.loop(arange(time_start, time_stop, time_step, DType.TIME)) as time,
):
# Prepare both qubits in |0>
start = coupled_qubits_sched.add(Reset(q0.name, q2.name))
# Prepare both qubits in |1>
coupled_qubits_sched.add(X(q0.name), ref_op=start)
coupled_qubits_sched.add(X(q2.name), ref_op=start)
# Play square pulse over the flux line of q0
flux_pulse = coupled_qubits_sched.add(SquarePulse(amp=amp, duration=time, port=f"{q0.name}:fl"))
# Measure q0
coupled_qubits_sched.add(
Measure(q0.name, coords={"amplitude": amp, "time": time}, acq_channel="S_21"),
ref_op=flux_pulse,
)
# Execute the experiment
coupled_qubits_data = hw_agent.run(coupled_qubits_sched)
if cluster.is_dummy:
example_data = open_dataset("./dependencies/datasets/cphase_chevrons.hdf5", engine="h5netcdf")
coupled_qubits_data.update({"S_21": example_data.S_21})
/tmp/ipykernel_286/402312890.py:16: FutureWarning: amp is deprecated as an argument to SquarePulse and will be removed in qblox-scheduler >= 2.0; use amplitude instead.
flux_pulse = coupled_qubits_sched.add(SquarePulse(amp=amp, duration=time, port=f"{q0.name}:fl"))
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "/.venv/lib/python3.14/site-packages/zmq/eventloop/zmqstream.py", line 565, in _log_error
f.result()
~~~~~~~~^^
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 348, in dispatch_control
await self.process_control(msg)
File "/.venv/lib/python3.14/site-packages/ipykernel/kernelbase.py", line 354, in process_control
idents, msg = self.session.feed_identities(msg, copy=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.14/site-packages/jupyter_client/session.py", line 998, in feed_identities
raise ValueError(msg)
ValueError: DELIM not in msg_list
Analyze the experiment#
[5]:
coupled_qubits_data = acq_coords_to_dims(coupled_qubits_data, ["amplitude", "time"], "S_21")
np.abs(coupled_qubits_data.S_21).plot()
[5]:
<matplotlib.collections.QuadMesh at 0x7f0aa9d4f230>