See also

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

Single transmon qubit characterization

The experiments of this tutorial are meant to be executed with a Qblox Cluster controlling a transmon system.

The experiments can also be executed using a dummy Qblox device that is created via an instance of the Cluster class, and is initialized with a dummy configuration.

However, when using a dummy device, the analysis will not work because the experiments will return np.nan values.

When using this notebook together with a dummy device, example data is loaded from the "./example_data/" directory.

Setup

In this section we configure the hardware configuration which specifies the connectivity of our system.

Configuration file

This is a template hardware configuration file for a 1-qubit system with a flux-control line which can be used to tune the qubit frequency.

The hardware setup is as follows, by cluster slot: 1. QCM-RF - Drive line for qubit using fixed 80 MHz IF. 2. QCM - Flux line for qubit. 6. QRM-RF - Readout line for qubit using a fixed LO set at 7.5 GHz.

Note that in the hardware configuration below the mixers are uncorrected, but for high fidelity experiments this should also be done for all the modules.

[1]:
hardware_cfg = {
    "backend": "quantify_scheduler.backends.qblox_backend.hardware_compile",
    "cluster0": {
        "sequence_to_file": False,  # Boolean flag which dumps waveforms and program dict to JSON file
        "ref": "internal",  # Use shared clock reference of the cluster
        "instrument_type": "Cluster",
        # ============ DRIVE ============#
        "cluster0_module1": {
            "instrument_type": "QCM_RF",
            "complex_output_0": {
                "output_att": 0,
                "dc_mixer_offset_I": 0.0,
                "dc_mixer_offset_Q": 0.0,
                "portclock_configs": [
                    {
                        "port": "qubit:mw",
                        "clock": "qubit.01",
                        "interm_freq": 80e6,
                        "mixer_amp_ratio": 1.0,
                        "mixer_phase_error_deg": 0.0,
                    }
                ],
            },
        },
        # ============ FLUX ============#
        "cluster0_module2": {
            "instrument_type": "QCM",
            "real_output_0": {
                "portclock_configs": [{"port": "qubit:fl", "clock": "cl0.baseband"}]
            },
        },
        # ============ READOUT ============#
        "cluster0_module3": {
            "instrument_type": "QRM_RF",
            "complex_output_0": {
                "output_att": 0,
                "input_att": 0,
                "dc_mixer_offset_I": 0.0,
                "dc_mixer_offset_Q": 0.0,
                "lo_freq": 7.5e9,
                "portclock_configs": [
                    {
                        "port": "qubit:res",
                        "clock": "qubit.ro",
                        "mixer_amp_ratio": 1.0,
                        "mixer_phase_error_deg": 0.0,
                    }
                ],
            },
        },
    },
}
[2]:
import warnings
from pathlib import Path

import ipywidgets as widgets
import numpy as np
import quantify_core.data.handling as dh
from IPython.display import display
from qblox_instruments import Cluster, ClusterType, PlugAndPlay
from qcodes import Instrument
from qcodes.parameters import ManualParameter
from quantify_core.analysis.single_qubit_timedomain import RabiAnalysis, RamseyAnalysis, T1Analysis
from quantify_core.measurement.control import MeasurementControl
from quantify_core.visualization.pyqt_plotmon import PlotMonitor_pyqt as PlotMonitor
from quantify_scheduler.device_under_test.quantum_device import QuantumDevice
from quantify_scheduler.device_under_test.transmon_element import BasicTransmonElement
from quantify_scheduler.gettables import ScheduleGettable
from quantify_scheduler.instrument_coordinator import InstrumentCoordinator
from quantify_scheduler.instrument_coordinator.components.qblox import ClusterComponent
from quantify_scheduler.operations.gate_library import Measure, Reset
from quantify_scheduler.operations.pulse_library import SetClockFrequency, SquarePulse
from quantify_scheduler.resources import ClockResource
from quantify_scheduler.schedules import heterodyne_spec_sched_nco, rabi_sched, t1_sched
from quantify_scheduler.schedules.timedomain_schedules import ramsey_sched
from quantify_scheduler.schedules.schedule import Schedule

from utils.tutorial_analysis_classes import (
    QubitFluxSpectroscopyAnalysis,
    QubitSpectroscopyAnalysis,
    ResonatorFluxSpectroscopyAnalysis
)
from utils.tutorial_utils import (
    set_drive_attenuation,
    set_readout_attenuation,
    show_args,
    show_drive_args,
    show_readout_args
)

Scan For Clusters

We scan for the available clusters on our network using the Plug & Play functionality of the Qblox Instruments package (see Plug & Play for more info).

[3]:
warnings.simplefilter("ignore")

# Scan for available devices and display
with PlugAndPlay() as p:
    # Get info of all devices
    device_list = p.list_devices()

names = {
    dev_id: dev_info["description"]["name"] for dev_id, dev_info in device_list.items()
}
names["dummy_cluster"] = "dummy_cluster"
ip_addresses = {
    dev_id: dev_info["identity"]["ip"] for dev_id, dev_info in device_list.items()
}


# Create widget for names and ip addresses
connect = widgets.Dropdown(
    options=[["Dummy-Cluster", "dummy_cluster"]]
    + [
        (f"{names[dev_id]} @{ip_addresses[dev_id]}", dev_id)
        for dev_id in device_list.keys()
    ],
    description="Select Device",
)
display(connect)

Connect to Cluster

We now make a connection with the Cluster selected in the dropdown widget. We also define a function to find the modules we’re interested in. We select the readout and control module we want to use.

[4]:
# Close all existing QCoDeS Instrument instances
Instrument.close_all()

# Select the device
dev_id = connect.value

# Here we have the option to use a dummy device so that you can run your tests without a physical cluster
dummy_cfg = (
    {
        1: ClusterType.CLUSTER_QCM_RF,
        2: ClusterType.CLUSTER_QCM,
        3: ClusterType.CLUSTER_QRM_RF,
    }
    if dev_id == "dummy_cluster"
    else None
)

cluster = Cluster(
    name="cluster0", identifier=ip_addresses.get(dev_id), dummy_cfg=dummy_cfg
)

print(f"{connect.label} connected")
Dummy-Cluster connected

Reset the Cluster

We reset the Cluster to enter a well-defined state. Note that resetting will clear all stored parameters and repeats startup calibration, so resetting between experiments is usually not desirable.

[5]:
cluster.reset()
print(cluster.get_system_state())
Status: CRITICAL, Flags: CARRIER_TEMPERATURE_OUT_OF_RANGE, FPGA_TEMPERATURE_OUT_OF_RANGE, Slot flags: SLOT1_CARRIER_TEMPERATURE_OUT_OF_RANGE, SLOT1_FPGA_TEMPERATURE_OUT_OF_RANGE, SLOT2_CARRIER_TEMPERATURE_OUT_OF_RANGE, SLOT2_FPGA_TEMPERATURE_OUT_OF_RANGE, SLOT3_CARRIER_TEMPERATURE_OUT_OF_RANGE, SLOT3_FPGA_TEMPERATURE_OUT_OF_RANGE

Note that a dummy cluster will raise error flags, this is expected behavior and can be ignored.

Quantum device settings

Here we initialize our QuantumDevice and our qubit parameters, checkout this tutorial for further details.

In short, a QuantumDevice contains device elements where we save our found parameters.

[6]:
qubit = BasicTransmonElement("qubit")
qubit.measure.acq_channel(0)

quantum_device = QuantumDevice("device_1q")
quantum_device.hardware_config(hardware_cfg)

quantum_device.add_element(qubit)

Configure measurement control loop

We will use a MeasurementControl object for data acquisition as well as an InstrumentCoordinator for controlling the instruments in our setup.

The PlotMonitor is used for live plotting.

All of these are then associated with the QuantumDevice.

[7]:
def configure_measurement_control_loop(
    device: QuantumDevice, cluster: Cluster, live_plotting: bool = False
) -> None:
    # Close QCoDeS instruments with conflicting names
    for name in [
        "PlotMonitor",
        "meas_ctrl",
        "ic",
        "ic_generic",
        f"ic_{cluster.name}",
    ] + [f"ic_{module.name}" for module in cluster.modules]:
        try:
            Instrument.find_instrument(name).close()
        except KeyError as kerr:
            pass

    meas_ctrl = MeasurementControl("meas_ctrl")
    ic = InstrumentCoordinator("ic")

    # Add cluster to instrument coordinator
    ic_cluster = ClusterComponent(cluster)
    ic.add_component(ic_cluster)

    if live_plotting:
        # Associate plot monitor with measurement controller
        plotmon = PlotMonitor("PlotMonitor")
        meas_ctrl.instr_plotmon(plotmon.name)

    # Associate measurement controller and instrument coordinator with the quantum device
    device.instr_measurement_control(meas_ctrl.name)
    device.instr_instrument_coordinator(ic.name)

    return (meas_ctrl, ic)


meas_ctrl, instrument_coordinator = configure_measurement_control_loop(
    quantum_device, cluster
)

Set data directory

This directory is where all of the experimental data as well as all of the post processing will go.

[8]:
# Enter your own dataset directory here!
dh.set_datadir(Path("example_data").resolve())

Configure external flux control

In the case of flux-tunable transmon qubits, we need to have some way of controlling the external flux.

This can be done by setting an output bias on a module of the cluster which is then connected to the flux line.

# e.g. nullify external flux by setting current to 0 A
cluster.module2.out0_current(0.0)

If your system is not using flux-tunable transmons, then you can skip to the next section.

[9]:
flux_settable: callable = cluster.module2.out0_offset
flux_settable(0.0)

Activate NCO delay compensation

Compensate for the digital propagation delay for each qubit (i.e each sequencer)

For more info, please see: https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/sequencer.html#pulsar-qcm-sequencer-nco-prop-delay-comp-en

To avoid mismatches between modulation and demodulation, the delay between any readout frequency or phase changes and the next acquisition should be equal or greater than the total propagation delay (146ns + user defined value).

[10]:
for i in range(6):
    getattr(cluster.module3, f"sequencer{i}").nco_prop_delay_comp_en(True)
    getattr(cluster.module3, f"sequencer{i}").nco_prop_delay_comp(50)

Characterization experiments

The sweep setpoints for all experiments (e.g. frequency_setpoints in the spectroscopy experiments) are only examples. The sweep setpoints should be changed to match your own system.

We show two sets of experiments: The first contains generic characterization experiments for transmon qubits. The second contains 2D experiments for finding the flux sweetspot, applicable for flux-tunable qubits.

Here we consider five standard characterization experiments for single qubit tuneup. The experiments are: 1. Resonator spectroscopy - Used to find the frequency response of the readout resonator when the qubit is in \(|0\rangle\). 2. Qubit spectroscopy (a.k.a two-tone) - Used to find the \(|0\rangle \rightarrow |1\rangle\) drive frequency. 3. Rabi oscillations - Used to find precise excitation pulse required to excite the qubit to \(|1\rangle\). 4. Ramsey oscillations - Used to tune the \(|0\rangle \rightarrow |1\rangle\) drive frequency more precisely. - Used to measure \(T_2^*\). 5. T1 - Used to find the time it takes for the qubit to decay from \(|1\rangle\) to \(|0\rangle\), the \(T_1\) time.

Resonator spectroscopy

[11]:
freq = ManualParameter(name="freq", unit="Hz", label="Frequency")
freq.batched = True
freq.batch_size = 100

spec_sched_kwargs = dict(
    pulse_amp=1 / 6,
    pulse_duration=2e-6,
    frequencies=freq,
    acquisition_delay=196e-9,
    integration_time=2e-6,
    init_duration=10e-6,
    port=qubit.ports.readout(),
    clock=qubit.name + ".ro",
)
gettable = ScheduleGettable(
    quantum_device,
    schedule_function=heterodyne_spec_sched_nco,
    schedule_kwargs=spec_sched_kwargs,
    real_imag=False,
    batched=True,
)

meas_ctrl.gettables(gettable)
show_args(spec_sched_kwargs, title="spec_sched_kwargs")
spec_sched_kwargs
====================================
pulse_amp         = 0.16666666666666666
pulse_duration    = 2e-06
frequencies       = freq
acquisition_delay = 1.96e-07
integration_time  = 2e-06
init_duration     = 1e-05
port              = qubit:res
clock             = qubit.ro
[12]:
set_readout_attenuation(quantum_device, qubit, out_att=50, in_att=0)

quantum_device.cfg_sched_repetitions(400)

center = 7.7e9
frequency_setpoints = np.linspace(center - 20e6, center + 20e6, 300)
meas_ctrl.settables(freq)
meas_ctrl.setpoints(frequency_setpoints)

rs_ds = meas_ctrl.run("resonator spectroscopy")
rs_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         --- (None) ---
Batched settable(s):
         freq
Batch size limit: 100

100% completed | elapsed time:      1s | time left:      0s  last batch size:    100
100% completed | elapsed time:      1s | time left:      0s  last batch size:    100
[12]:
<xarray.Dataset>
Dimensions:  (dim_0: 300)
Coordinates:
    x0       (dim_0) float64 7.68e+09 7.68e+09 7.68e+09 ... 7.72e+09 7.72e+09
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103843-951-9209d1
    name:                             resonator spectroscopy
    grid_2d:                          False
    grid_2d_uniformly_spaced:         False
    1d_2_settables_uniformly_spaced:  False
[13]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    rs_ds = dh.load_dataset(tuid="20230509-100918-578-4f26b5")
[14]:
from quantify_core.analysis.spectroscopy_analysis import ResonatorSpectroscopyAnalysis

rs_analysis = ResonatorSpectroscopyAnalysis(tuid=rs_ds.attrs["tuid"], dataset=rs_ds)
rs_analysis.run().display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_27_0.png
../../_images/applications_quantify_tuning_transmon_qubit_27_1.png
../../_images/applications_quantify_tuning_transmon_qubit_27_2.png
[15]:
qubit.reset.duration(100e-6)
qubit.measure.acq_delay(spec_sched_kwargs["acquisition_delay"])
qubit.measure.pulse_amp(spec_sched_kwargs["pulse_amp"])
qubit.measure.pulse_duration(spec_sched_kwargs["pulse_duration"])
qubit.measure.integration_time(spec_sched_kwargs["integration_time"])

qubit.clock_freqs.readout(rs_analysis.quantities_of_interest["fr"].nominal_value)
show_readout_args(qubit)
qubit.measure
============================================
pulse_type                = SquarePulse
pulse_amp                 = 0.16666666666666666
pulse_duration            = 2e-06
acq_channel               = 0
acq_delay                 = 1.96e-07
integration_time          = 2e-06
reset_clock_phase         = True
acq_weights_a             = None
acq_weights_b             = None
acq_weights_sampling_rate = None
acq_weight_type           = SSB

qubit.reset
==============
duration = 0.0001

qubit.clock_freqs
========================
readout = 7902645766.024351

Qubit spectroscopy

[16]:
def two_tone_spec_sched_nco(
    qubit_name: str,
    spec_pulse_amp: float,
    spec_pulse_duration: float,
    spec_pulse_port: str,
    spec_pulse_clock: str,
    spec_pulse_frequencies: np.ndarray,
    repetitions: int = 1,
) -> Schedule:
    """
    Generate a batched schedule for performing fast two-tone spectroscopy using the
    `SetClockFrequency` operation for doing an NCO sweep.

    Parameters
    ----------
    spec_pulse_amp
        Amplitude of the spectroscopy pulse in Volt.
    spec_pulse_duration
        Duration of the spectroscopy pulse in seconds.
    spec_pulse_port
        Location on the device where the spectroscopy pulse should be applied.
    spec_pulse_clock
        Reference clock used to track the spectroscopy frequency.
    spec_pulse_frequencies
        Sample frequencies for the spectroscopy pulse in Hertz.
    repetitions
        The amount of times the Schedule will be repeated.
    """
    sched = Schedule("two-tone", repetitions)
    sched.add_resource(
        ClockResource(name=spec_pulse_clock, freq=spec_pulse_frequencies.flat[0])
    )

    for acq_idx, spec_pulse_freq in enumerate(spec_pulse_frequencies):
        sched.add(Reset(qubit_name))
        sched.add(
            SetClockFrequency(clock=spec_pulse_clock, clock_freq_new=spec_pulse_freq)
        )
        sched.add(
            SquarePulse(
                duration=spec_pulse_duration,
                amp=spec_pulse_amp,
                port=spec_pulse_port,
                clock=spec_pulse_clock,
            )
        )
        sched.add(Measure(qubit_name, acq_index=acq_idx))

    return sched
[17]:
freq = ManualParameter(name="freq", unit="Hz", label="Frequency")
freq.batched = True

qubit_spec_sched_kwargs = dict(
    qubit_name=qubit.name,
    spec_pulse_frequencies=freq,
    spec_pulse_amp=1.0,
    spec_pulse_duration=48e-6,
    spec_pulse_port=qubit.ports.microwave(),
    spec_pulse_clock=qubit.name + ".01",
)

gettable = ScheduleGettable(
    quantum_device,
    schedule_function=two_tone_spec_sched_nco,
    schedule_kwargs=qubit_spec_sched_kwargs,
    real_imag=False,
    batched=True,
)

meas_ctrl.gettables(gettable)

show_args(qubit_spec_sched_kwargs, title="qubit_spec_sched_kwargs")
qubit_spec_sched_kwargs
==============================
qubit_name             = qubit
spec_pulse_frequencies = freq
spec_pulse_amp         = 1.0
spec_pulse_duration    = 4.8e-05
spec_pulse_port        = qubit:mw
spec_pulse_clock       = qubit.01
[18]:
set_drive_attenuation(quantum_device, qubit, out_att=60)

quantum_device.cfg_sched_repetitions(300)
center = 6.1e9
frequency_setpoints = np.linspace(center - 20e6, center + 20e6, 300)
meas_ctrl.settables(freq)
meas_ctrl.setpoints(frequency_setpoints)

qs_ds = meas_ctrl.run("Two-tone")
qs_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         --- (None) ---
Batched settable(s):
         freq
Batch size limit: 300

100% completed | elapsed time:      1s | time left:      0s  last batch size:    300
100% completed | elapsed time:      1s | time left:      0s  last batch size:    300
[18]:
<xarray.Dataset>
Dimensions:  (dim_0: 300)
Coordinates:
    x0       (dim_0) float64 6.08e+09 6.08e+09 6.08e+09 ... 6.12e+09 6.12e+09
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103848-329-8f4eeb
    name:                             Two-tone
    grid_2d:                          False
    grid_2d_uniformly_spaced:         False
    1d_2_settables_uniformly_spaced:  False
[19]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    qs_ds = dh.load_dataset(tuid="20230523-175716-868-8746ad")
[20]:
qs_analysis = QubitSpectroscopyAnalysis(tuid=qs_ds.attrs["tuid"], dataset=qs_ds)
qs_analysis.run().display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_34_0.png
[21]:
qubit.clock_freqs.f01(qs_analysis.quantities_of_interest["frequency_01"].nominal_value)

show_drive_args(qubit)
qubit.rxy
=============
amp180   = nan
motzoi   = 0
duration = 2e-08

qubit.clock_freqs
====================
f01 = 5635062844.791333

Rabi oscillations

[22]:
pulse_amp = ManualParameter(name="pulse_amplitude", unit="V", label="amplitude")
pulse_amp.batched = True

rabi_sched_kwargs = {
    "pulse_amp": pulse_amp,
    "pulse_duration": qubit.rxy.duration(),
    "frequency": qubit.clock_freqs.f01(),
    "qubit": qubit.name,
}

gettable = ScheduleGettable(
    quantum_device,
    schedule_function=rabi_sched,
    schedule_kwargs=rabi_sched_kwargs,
    batched=True,
)

meas_ctrl.gettables(gettable)

show_args(rabi_sched_kwargs, title="rabi_sched_kwargs")
rabi_sched_kwargs
===============================
pulse_amp      = pulse_amplitude
pulse_duration = 2e-08
frequency      = 5635062844.791333
qubit          = qubit
[23]:
set_drive_attenuation(quantum_device, qubit, out_att=18)

quantum_device.cfg_sched_repetitions(400)

amplitude_setpoints = np.linspace(-0.14, 0.14, 200)

meas_ctrl.settables(pulse_amp)
meas_ctrl.setpoints(amplitude_setpoints)

rabi_ds = meas_ctrl.run("Rabi")
rabi_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         --- (None) ---
Batched settable(s):
         pulse_amplitude
Batch size limit: 200

100% completed | elapsed time:      0s | time left:      0s  last batch size:    200
100% completed | elapsed time:      0s | time left:      0s  last batch size:    200
[23]:
<xarray.Dataset>
Dimensions:  (dim_0: 200)
Coordinates:
    x0       (dim_0) float64 -0.14 -0.1386 -0.1372 ... 0.1372 0.1386 0.14
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103851-383-390838
    name:                             Rabi
    grid_2d:                          False
    grid_2d_uniformly_spaced:         False
    1d_2_settables_uniformly_spaced:  False
[24]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    rabi_ds = dh.load_dataset(tuid="20230508-125501-555-fe2542")
[25]:
rabi_analysis = RabiAnalysis(tuid=rabi_ds.attrs["tuid"], dataset=rabi_ds)
rabi_analysis.run().display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_40_0.png
[26]:
qubit.rxy.amp180(
    rabi_analysis.quantities_of_interest["Pi-pulse amplitude"].nominal_value
)
show_drive_args(qubit)
qubit.rxy
===========================
amp180   = 0.09148424065242679
motzoi   = 0
duration = 2e-08

qubit.clock_freqs
====================
f01 = 5635062844.791333

Ramsey oscillations

[27]:
tau = ManualParameter(name="tau", unit="s", label="Time")
tau.batched = True

ramsey_sched_kwargs = {
    "qubit": qubit.name,
    "times": tau,
    "artificial_detuning": 0.0,
}

gettable = ScheduleGettable(
    quantum_device,
    schedule_function=ramsey_sched,
    schedule_kwargs=ramsey_sched_kwargs,
    real_imag=False,
    batched=True,
)
meas_ctrl.gettables(gettable)
show_args(ramsey_sched_kwargs, title="ramsey_sched_kwargs")
ramsey_sched_kwargs
========================
qubit               = qubit
times               = tau
artificial_detuning = 0.0
[28]:
tau_setpoints = np.arange(20e-9, 4e-6, 40e-9)

meas_ctrl.settables(tau)
meas_ctrl.setpoints(tau_setpoints)

quantum_device.cfg_sched_repetitions(500)
ramsey_ds = meas_ctrl.run("ramsey")
ramsey_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         --- (None) ---
Batched settable(s):
         tau
Batch size limit: 100

100% completed | elapsed time:      0s | time left:      0s  last batch size:    100
100% completed | elapsed time:      0s | time left:      0s  last batch size:    100
[28]:
<xarray.Dataset>
Dimensions:  (dim_0: 100)
Coordinates:
    x0       (dim_0) float64 2e-08 6e-08 1e-07 ... 3.9e-06 3.94e-06 3.98e-06
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103853-901-52385f
    name:                             ramsey
    grid_2d:                          False
    grid_2d_uniformly_spaced:         False
    1d_2_settables_uniformly_spaced:  False
[29]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    ramsey_ds = dh.load_dataset(tuid="20230523-123745-377-d21d2c")
[30]:
ramsey_analysis = RamseyAnalysis(tuid=ramsey_ds.attrs["tuid"], dataset=ramsey_ds)
ramsey_analysis.run().display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_46_0.png
[31]:
qubit.clock_freqs.f01(
    qubit.clock_freqs.f01()
    + ramsey_analysis.quantities_of_interest["detuning"].nominal_value
)
show_drive_args(qubit)
qubit.rxy
===========================
amp180   = 0.09148424065242679
motzoi   = 0
duration = 2e-08

qubit.clock_freqs
====================
f01 = 5635941690.431435

T1

[32]:
tau = ManualParameter(name="tau_delay", unit="s", label="Delay")
tau.batched = True

t1_sched_kwargs = {"qubit": qubit.name, "times": tau}

gettable = ScheduleGettable(
    quantum_device,
    schedule_function=t1_sched,
    schedule_kwargs=t1_sched_kwargs,
    real_imag=False,
    batched=True,
)
meas_ctrl.gettables(gettable)

show_args(t1_sched_kwargs, title="t1_sched_kwargs")
t1_sched_kwargs
==============
qubit = qubit
times = tau_delay
[33]:
delay_setpoints = np.arange(40e-9, 200e-6, 500e-9)

meas_ctrl.settables(tau)
meas_ctrl.setpoints(delay_setpoints)

quantum_device.cfg_sched_repetitions(300)
t1_ds = meas_ctrl.run("T1 experiment")
t1_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         --- (None) ---
Batched settable(s):
         tau_delay
Batch size limit: 400

100% completed | elapsed time:      1s | time left:      0s  last batch size:    400
100% completed | elapsed time:      1s | time left:      0s  last batch size:    400
[33]:
<xarray.Dataset>
Dimensions:  (dim_0: 400)
Coordinates:
    x0       (dim_0) float64 4e-08 5.4e-07 1.04e-06 ... 0.000199 0.0001995
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103856-093-ea7ff6
    name:                             T1 experiment
    grid_2d:                          False
    grid_2d_uniformly_spaced:         False
    1d_2_settables_uniformly_spaced:  False
[34]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    t1_ds = dh.load_dataset(tuid="20230309-234522-242-193e69")
[35]:
t1_analysis = T1Analysis(tuid=t1_ds.attrs["tuid"], dataset=t1_ds)
t1_analysis.run().display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_52_0.png

Sweetspot experiments

A flux-tunable qubit is a qubit where the qubit frequency can be altered by changing a magnetic field piercing the circuit.

Here we consider two 2D experiments for finding the flux sweetspot of a flux-tunable qubit. The experiments are: 1. Resonator-flux spectroscopy - Used to find the flux sweetspot when the qubit is in \(|0\rangle\). - Resonator spectroscopy as a function of applied external flux. 2. Qubit-flux spectroscopy (a.k.a two-tone) - Used to find the flux sweetspot when the qubit is excited. - Qubit spectroscopy as a function of applied external flux.

Resonator-flux spectroscopy

[36]:
freq = ManualParameter(name="freq", unit="Hz", label="Frequency")
freq.batched = True
freq.batch_size = 100

spec_sched_kwargs = dict(
    pulse_amp=0.25 / 6,
    pulse_duration=2e-6,
    frequencies=freq,
    acquisition_delay=80e-9,
    integration_time=2e-6,
    init_duration=200e-6,
    port=qubit.ports.readout(),
    clock=qubit.name + ".ro",
)
gettable = ScheduleGettable(
    quantum_device,
    schedule_function=heterodyne_spec_sched_nco,
    schedule_kwargs=spec_sched_kwargs,
    real_imag=False,
    batched=True,
)

meas_ctrl.gettables(gettable)
show_args(spec_sched_kwargs, title="spec_sched_kwargs")
spec_sched_kwargs
=====================================
pulse_amp         = 0.041666666666666664
pulse_duration    = 2e-06
frequencies       = freq
acquisition_delay = 8e-08
integration_time  = 2e-06
init_duration     = 0.0002
port              = qubit:res
clock             = qubit.ro
[37]:
set_readout_attenuation(quantum_device, qubit, out_att=50, in_att=0)

quantum_device.cfg_sched_repetitions(80)
center = 7.7e9
frequency_setpoints = np.linspace(center - 20e6, center + 20e6, 300)

meas_ctrl.settables([freq, flux_settable])
meas_ctrl.setpoints_grid((frequency_setpoints, np.linspace(0, 1, 3)))

rfs_ds = meas_ctrl.run("resonator flux spectroscopy")
rfs_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         out0_offset
Batched settable(s):
         freq
Batch size limit: 100

100% completed | elapsed time:      3s | time left:      0s  last batch size:    100
100% completed | elapsed time:      3s | time left:      0s  last batch size:    100
[37]:
<xarray.Dataset>
Dimensions:  (dim_0: 900)
Coordinates:
    x0       (dim_0) float64 7.68e+09 7.68e+09 7.68e+09 ... 7.72e+09 7.72e+09
    x1       (dim_0) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 1.0 1.0 1.0 1.0 1.0 1.0
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103859-138-ebba91
    name:                             resonator flux spectroscopy
    grid_2d:                          True
    grid_2d_uniformly_spaced:         True
    1d_2_settables_uniformly_spaced:  False
    xlen:                             300
    ylen:                             3
[38]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    rfs_ds = dh.load_dataset(tuid="20230308-235659-059-cf471e")
[39]:
rfs_analysis = ResonatorFluxSpectroscopyAnalysis(
    tuid=rfs_ds.attrs["tuid"], dataset=rfs_ds
)
rfs_analysis.run(fit_method="fast", sweetspot_index=0).display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_58_0.png
[40]:
# Update the flux sweetspot
flux_settable(rfs_analysis.quantities_of_interest["offset_0"].nominal_value)

Qubit-flux spectroscopy

[41]:
freq = ManualParameter(name="freq", unit="Hz", label="Frequency")
freq.batched = True

qubit_spec_sched_kwargs = dict(
    qubit_name=qubit.name,
    spec_pulse_frequencies=freq,
    spec_pulse_amp=0.25,
    spec_pulse_duration=48e-6,
    spec_pulse_port=qubit.ports.microwave(),
    spec_pulse_clock=qubit.name + ".01",
)

gettable = ScheduleGettable(
    quantum_device,
    schedule_function=two_tone_spec_sched_nco,
    schedule_kwargs=qubit_spec_sched_kwargs,
    real_imag=False,
    batched=True,
)

meas_ctrl.gettables(gettable)

show_args(qubit_spec_sched_kwargs, title="qubit_spec_sched_kwargs")
qubit_spec_sched_kwargs
==============================
qubit_name             = qubit
spec_pulse_frequencies = freq
spec_pulse_amp         = 0.25
spec_pulse_duration    = 4.8e-05
spec_pulse_port        = qubit:mw
spec_pulse_clock       = qubit.01
[42]:
set_drive_attenuation(quantum_device, qubit, out_att=60)

quantum_device.cfg_sched_repetitions(400)
center = qubit.clock_freqs.f01()
frequency_setpoints = np.linspace(center - 20e6, center + 20e6, 300)
meas_ctrl.settables([freq, flux_settable])
meas_ctrl.setpoints_grid((frequency_setpoints, np.linspace(0, 1, 3)))

qfs_ds = meas_ctrl.run("flux two-tone")
qfs_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
         out0_offset
Batched settable(s):
         freq
Batch size limit: 900

100% completed | elapsed time:      4s | time left:      0s  last batch size:    300
100% completed | elapsed time:      4s | time left:      0s  last batch size:    300
[42]:
<xarray.Dataset>
Dimensions:  (dim_0: 900)
Coordinates:
    x0       (dim_0) float64 5.616e+09 5.616e+09 ... 5.656e+09 5.656e+09
    x1       (dim_0) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 1.0 1.0 1.0 1.0 1.0 1.0
Dimensions without coordinates: dim_0
Data variables:
    y0       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
    y1       (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan
Attributes:
    tuid:                             20230630-103905-976-293275
    name:                             flux two-tone
    grid_2d:                          True
    grid_2d_uniformly_spaced:         True
    1d_2_settables_uniformly_spaced:  False
    xlen:                             300
    ylen:                             3
[43]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
    qfs_ds = dh.load_dataset(tuid="20230309-235354-353-9c94c5")
[44]:
qfs_analysis = QubitFluxSpectroscopyAnalysis(tuid=qfs_ds.attrs["tuid"], dataset=qfs_ds)
qfs_analysis.run().display_figs_mpl()
../../_images/applications_quantify_tuning_transmon_qubit_64_0.png
[45]:
# Update the flux sweetspot
flux_settable(qfs_analysis.quantities_of_interest["offset_0"].nominal_value)