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

Resonator punchout#
To verify the presence of a qubit coupled to the resonator, and to optimize the readout signal-to-noise ratio (SNR) while preventing back-action on the qubit, we perform a “punchout” experiment by sweeping the attenuation of the microwave tone over resonator spectroscopy traces. In the high-power regime the resonator responds at its bare frequency, while at the low-power regime the resonator frequency is dressed by the coupling to the qubit. The crossover between the two is called “resonator punchout” (Blais et al., 2021: https://arxiv.org/abs/2005.12667).
[1]:
from dependencies.analysis_utils import PunchoutAnalysis
from xarray import open_dataset
from qblox_scheduler import HardwareAgent, Schedule
from qblox_scheduler.experiments import SetHardwareOption
from qblox_scheduler.operations import IdlePulse, Measure
from qblox_scheduler.operations.expressions import DType
from qblox_scheduler.operations.loop_domains import arange, linspace
Generating hash table for SingleQubitClifford.
Hash table generated.
Generating hash table for TwoQubitCliffordCZ.
Hash table generated.
Generating hash table for TwoQubitCliffordZX.
Hash table generated.
Testing decompositions.
Test passed.
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")
q2 = hw_agent.quantum_device.get_element("q2")
cluster = hw_agent.get_clusters()["cluster"]
hw_options = hw_agent.hardware_configuration.hardware_options
qubit = q0
/builds/0/.venv/lib/python3.10/site-packages/qblox_scheduler/qblox/hardware_agent.py:460: UserWarning: cluster: Trying to instantiate cluster with ip 'None'.Creating a dummy cluster.
warnings.warn(
Experiment settings#
[3]:
# Frequency settings
frequency_center = qubit.clock_freqs.readout # Hz
frequency_width = 5e6 # Hz
frequency_npoints = 300
# Attenuation settings
att_start = 0 # dB
att_stop = 30 # dB
att_step = 2 # dB
repetitions = 100
Experiment schedule#
[4]:
po_sched = Schedule("resonator_punchout")
with po_sched.loop(
arange(start=att_start, stop=att_stop, step=att_step, dtype=DType.NUMBER)
) as amp:
# Set output attenuation
po_sched.add(SetHardwareOption("output_att", amp, f"{qubit.name}:res-{qubit.name}.ro"))
with (
po_sched.loop(arange(0, repetitions, 1, DType.NUMBER)),
po_sched.loop(
linspace(
start=frequency_center - frequency_width / 2,
stop=frequency_center + frequency_width / 2,
num=frequency_npoints,
dtype=DType.FREQUENCY,
)
) as freq,
):
po_sched.add(
Measure(
qubit.name,
freq=freq,
coords={"frequency": freq, "amp": amp},
acq_channel="S_21",
)
)
po_sched.add(IdlePulse(10e-6)) # Let the resonator decay
# Execute the experiment
po_data = hw_agent.run(po_sched)
if cluster.is_dummy:
example_data = open_dataset(
"./dependencies/datasets/resonator_punchout.hdf5", engine="h5netcdf"
)
po_data = po_data.update({"S_21": example_data.S_21})
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=0.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=2.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=4.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=6.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=8.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=10.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=12.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=14.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=16.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=18.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=20.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=22.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=24.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=26.0, input_type=float])
return self.__pydantic_serializer__.to_python(
/builds/0/.venv/lib/python3.10/site-packages/pydantic/main.py:464: UserWarning: Pydantic serializer warnings:
PydanticSerializationUnexpectedValue(Expected `int` - serialized value may not be as expected [field_name='output_att', input_value=28.0, input_type=float])
return self.__pydantic_serializer__.to_python(
Analyze the experiment#
[5]:
punchout_analysis = PunchoutAnalysis(po_data).run()
punchout_analysis.display_figs_mpl()
Post-run#
[6]:
# Update the device config
hw_options.output_att[f"{qubit.name}:res-{qubit.name}.ro"] = 24
Update the device configuration file#
After measurement, we may store the measured device properties inside a new file to use in future experiments. The time-unique identifier ensures that it is easy to find back previously found measurement results.
[7]:
hw_agent.quantum_device.to_json_file("./dependencies/configs", add_timestamp=True)
[7]:
'./dependencies/configs/two_flux_tunable_transmons_2025-10-30_00-37-45_UTC.json'