See also
A Jupyter notebook version of this tutorial can be downloaded here
.
Coupled qubits characterization
The experiments of this tutorial are meant to be executed with a Qblox Cluster controlling a flux-tunable 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. In this case, example data is loaded from the "./example_data/"
directory.
Hardware 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 2-qubit system (we name the qubits q0
and q1
), with dedicated flux-control lines.
The hardware setup is as follows, by cluster slot: 1. QCM-RF - Drive line for q0
using fixed 80 MHz IF. - Drive line for q1
using fixed 80 MHz IF. 2. QCM - Flux line for q0
. - Flux line for q1
. 6. QRM-RF - Shared readout line for q0
/q1
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": "q0:mw",
"clock": "q0.01",
"interm_freq": 80e6,
"mixer_amp_ratio": 1.0,
"mixer_phase_error_deg": 0.0,
}
],
},
"complex_output_1": {
"output_att": 0,
"dc_mixer_offset_I": 0.0,
"dc_mixer_offset_Q": 0.0,
"portclock_configs": [
{
"port": "q1:mw",
"clock": "q1.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": "q0:fl", "clock": "cl0.baseband"}]
},
"real_output_1": {
"portclock_configs": [{"port": "q1: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": "q0:res",
"clock": "q0.ro",
"mixer_amp_ratio": 1.0,
"mixer_phase_error_deg": 0.0,
},
{
"port": "q1:res",
"clock": "q1.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
import matplotlib.pyplot as plt
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 quantify_scheduler.helpers.collections import find_port_clock_path
from utils.tutorial_analysis_classes import (
QubitFluxSpectroscopyAnalysis,
QubitSpectroscopyAnalysis,
ResonatorFluxSpectroscopyAnalysis,
ConditionalOscillationAnalysis
)
from utils.tutorial_utils import (
set_drive_attenuation,
set_readout_attenuation,
show_args,
show_parameters
)
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.
Experiment setup
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]:
# Close QCoDeS instruments with conflicting names
for name in ["device_2q", "q0", "q1"]:
try:
Instrument.find_instrument(name).close()
except KeyError as kerr:
pass
q0 = BasicTransmonElement("q0")
q0.measure.acq_channel(0)
q1 = BasicTransmonElement("q1")
q1.measure.acq_channel(1)
quantum_device = QuantumDevice("device_2q")
quantum_device.hardware_config(hardware_cfg)
quantum_device.add_element(q0)
quantum_device.add_element(q1)
Set calibrations
This tutorial explicitly only deals with 2-qubit experiments. As such, we assume that both the qubits and their resonators have already been characterized. For information on how to do this, please see the single transmon qubit tutorial. In order to use this tutorial on your own system, you must first change the calibrated values to match your own system.
For the sake of this tutorial, we will use some template values for both qubits.
[7]:
# ============ READOUT ============ #
q0.reset.duration(100e-6)
q0.measure.acq_delay(100e-9)
q0.measure.pulse_amp(0.05)
q0.measure.pulse_duration(2e-6)
q0.measure.integration_time(1.9e-6)
q1.reset.duration(100e-6)
q1.measure.acq_delay(100e-9)
q1.measure.pulse_amp(0.05)
q1.measure.pulse_duration(2e-6)
q1.measure.integration_time(1.9e-6)
q0.clock_freqs.readout(7.6e9)
q1.clock_freqs.readout(7.7e9)
# ============ DRIVE ============ #
q0.rxy.amp180(0.1)
q0.rxy.motzoi(0.05)
q0.rxy.duration(40e-9)
q1.rxy.amp180(0.1)
q1.rxy.motzoi(0.05)
q1.rxy.duration(40e-9)
q0.clock_freqs.f01(5.1e9)
q1.clock_freqs.f01(5.2e9)
show_parameters(q0,q1)
Type Unit q0 q1
Parameter
pulse_type measure SquarePulse SquarePulse
pulse_amp measure 0.05 0.05
pulse_duration measure (s) 0.000002 0.000002
acq_channel measure (#) 0 1
acq_delay measure (s) 0.0000001 0.0000001
integration_time measure (s) 0.0000019 0.0000019
reset_clock_phase measure True True
acq_weights_a measure None None
acq_weights_b measure None None
acq_weights_sampling_rate measure None None
acq_weight_type measure SSB SSB
duration reset (s) 0.0001 0.0001
f01 clock_freqs (Hz) 5100000000.0 5200000000.0
f12 clock_freqs (Hz) NaN NaN
readout clock_freqs (Hz) 7600000000.0 7700000000.0
amp180 rxy 0.1 0.1
motzoi rxy 0.05 0.05
duration rxy (s) 0.00000004 0.00000004
microwave ports q0:mw q1:mw
flux ports q0:fl q1:fl
readout ports q0:res q1:res
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
.
[8]:
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.
[9]:
# Enter your own dataset directory here!
dh.set_datadir(Path("example_data").resolve())
Configure external flux control
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-control line.
# e.g. nullify external flux by setting current to 0 A
cluster.module2.out0_current(0.0)
Here we are nullifying the external flux on both qubits.
[10]:
def find_flux_settable(qubit : BasicTransmonElement) -> callable:
"""
Return flux port voltage offset for qubit.
"""
path = find_port_clock_path(quantum_device.hardware_config(), qubit.ports.flux(), "cl0.baseband")
module = getattr(cluster, path[1].split("_")[1])
settable = getattr(module, f"out{path[2].split('_')[-1]}_offset")
return settable
flux_settables = { q.name : find_flux_settable(q) for q in (q0, q1)}
for flux_settable in flux_settables.values():
flux_settable(0.0)
show_args(flux_settables)
q0 = cluster0_module2_out0_offset
q1 = cluster0_module2_out1_offset
[11]:
flux_settables[q0.name](0.0) # enter your own value here for qubit 0
flux_settables[q1.name](0.0) # enter your own value here for qubit 1
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).
[12]:
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(10)
Set attenuation
We ought to make sure that our excitation and readout pulses have the appropriate power. Since we are assuming that the qubits and resonators have already been individually characterised, we use the same attenuation that we used in the single transmon qubit tutorial.
[13]:
set_readout_attenuation(quantum_device, q0, out_att=50, in_att = 0)
set_readout_attenuation(quantum_device, q1, out_att=50, in_att = 0)
set_drive_attenuation(quantum_device, q0, out_att=18)
set_drive_attenuation(quantum_device, q1, out_att=18)
Experiments
As in the single qubit tuneup tutorial, the sweep setpoints for all experiments in this section are only examples. The sweep setpoints should be changed to match your own system. In this section we assume that each individual qubit has already been characterized, and that they have been biased to their sweetspots.
We will examine the flux response of the 2-qubit system. By “flux response” we mean the measured response of the system when the parameterization of a flux pulse is varied.
We consider two separate experiments which have their own separate parameterizations, they are:
Controlled phase calibration (a.k.a. two-qubit Chevron experiment)
Used to measure coupling strength between the two qubits.
Used to find the location of the \(|11\rangle \leftrightarrow |02\rangle\) avoided crossing.
Conditional oscillations
Used to measure the conditional phase of the controlled phase gate.
Used to estimate leakage to \(|02\rangle\).
Can also be used to measure single-qubit phases on the individual qubits.
In both of these experiments, we apply the flux pulse on the flux-control line of q1
(on top of the sweetspot bias) which we take to be the qubit with the higher frequency, i.e. \(\omega_1\) > \(\omega_0\).
Controlled phase calibration
[14]:
from typing import Optional, Union
import numpy as np
from numpy.typing import NDArray
from quantify_scheduler.operations.gate_library import Measure, Reset, X
from quantify_scheduler.operations.pulse_library import SquarePulse
from quantify_scheduler.schedules.schedule import Schedule
def cphase_calibration_sched(
lf_qubit: str,
hf_qubit: str,
amplitudes: Union[float, NDArray],
duration: float,
flux_port: Optional[str] = None,
repetitions: int = 1,
) -> Schedule:
"""
Make a controlled phase calibration schedule to measure coupling of a qubit pair.
This experiment provides information about the location
of the ket 11 <-> ket 02 avoided crossing and distortions in the
flux-control line.
Schedule sequence
.. centered:: Reset -- ket 11 -- SquarePulse(amp, dur) -- Measure
.. note::
This schedule uses a unipolar square flux pulse, which will cause
distortions and leakage. For a high quality controlled phase
gate, distortions should be corrected for by modelling and
subsequently inverting the transfer function of the
flux-control line.
See e.g. https://doi.org/10.1103/PhysRevLett.123.150501 for
more information.
Parameters
----------
lf_qubit
The name of a qubit, e.g., "q0", the qubit with lower frequency.
hf_qubit
The name of coupled qubit, the qubit with the higher frequency.
amplitudes
Unitless array (or scalar) of the flux pulse amplitude(s).
duration
A scalar specifying the flux pulse duration in s.
flux_port
An optional string for a flux port. Default is hf_qubit flux port.
repetitions
The amount of times the Schedule will be repeated.
Returns
-------
:
An experiment schedule.
"""
sched = Schedule("cphase_calib", repetitions)
# Ensure amplitudes is an iterable when passing a float
amplitudes = np.asarray(amplitudes)
amplitudes = amplitudes.reshape(amplitudes.shape or (1,))
# Set flux port
flux_port = flux_port if flux_port is not None else f"{hf_qubit}:fl"
for acq_index, amp in enumerate(amplitudes):
# Reset to |00>
sched.add(Reset(lf_qubit, hf_qubit), label=f"Reset #{acq_index}")
# Prepare |11>
exc_lf = sched.add(X(lf_qubit), label=f"X({lf_qubit}) #{acq_index}")
sched.add(
X(hf_qubit),
ref_op=exc_lf,
ref_pt="start",
label=f"X({hf_qubit}) #{acq_index}",
)
# Go to |11> <=> |02> avoided crossing and come back
sched.add(
SquarePulse(
amp=amp,
duration=duration,
port=flux_port,
clock="cl0.baseband",
),
label=f"SquarePulse({flux_port}) #{acq_index}",
)
# Measure system
sched.add(
Measure(lf_qubit, hf_qubit, acq_index=acq_index),
label=f"Measure({lf_qubit},{hf_qubit}) #{acq_index}",
)
return sched
[15]:
duration = ManualParameter(name="dur", unit="Hz", label="Duration of flux pulse")
amplitude = ManualParameter(name="amp", unit="", label="Amplitude of flux pulse")
amplitude.batched = True
duration.batched = False
cphase_calibration_sched_kwargs = dict(
lf_qubit = q0.name,
hf_qubit = q1.name,
amplitudes=amplitude,
duration=duration
)
gettable = ScheduleGettable(
quantum_device,
schedule_function=cphase_calibration_sched,
schedule_kwargs=cphase_calibration_sched_kwargs,
real_imag=False,
data_labels = ["Magnitude lf qubit", "Phase lf qubit", "Magnitude hf qubit", "Phase hf qubit"],
batched=True,
num_channels=2
)
meas_ctrl.gettables(gettable)
show_args(cphase_calibration_sched_kwargs, "cphase_calibration_sched_kwargs")
cphase_calibration_sched_kwargs
=============
lf_qubit = q0
hf_qubit = q1
amplitudes = amp
duration = dur
[16]:
quantum_device.cfg_sched_repetitions(400)
duration_setpoints = np.arange(4e-9, 100e-9, 4e-9)
amplitude_setpoints = np.linspace(0.05, 0.2, 100)
meas_ctrl.settables([duration, amplitude])
meas_ctrl.setpoints_grid((duration_setpoints, amplitude_setpoints))
cphase_calib_ds = meas_ctrl.run("controlled phase calibration")
cphase_calib_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
dur
Batched settable(s):
amp
Batch size limit: 1024
100% completed | elapsed time: 14s | time left: 0s last batch size: 100
100% completed | elapsed time: 14s | time left: 0s last batch size: 100
[16]:
<xarray.Dataset> Dimensions: (dim_0: 2400) Coordinates: x0 (dim_0) float64 4e-09 4e-09 4e-09 4e-09 ... 9.6e-08 9.6e-08 9.6e-08 x1 (dim_0) float64 0.05 0.05152 0.05303 0.05455 ... 0.197 0.1985 0.2 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 y2 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan y3 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan Attributes: tuid: 20230719-140401-116-7bf864 name: controlled phase calibration grid_2d: True grid_2d_uniformly_spaced: True 1d_2_settables_uniformly_spaced: False xlen: 24 ylen: 100
[17]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
# NOTE: This dataset uses an old version of quantify which specified amplitude in volts.
cphase_calib_ds = dh.to_gridded_dataset(dh.load_dataset(tuid="20230509-120110-134-51b044"))
[18]:
fig, axs = plt.subplots(1,2, figsize=plt.figaspect(1/2))
# plot only magnitude data of both channels for simplicity
cphase_calib_ds.y0.plot(ax = axs[0])
cphase_calib_ds.y2.plot(ax = axs[1])
axs[0].set_title("Low freq. qubit (q0)")
axs[1].set_title("High freq. qubit (q1)")
fig.suptitle("Controlled phase calibration")
fig.tight_layout()
Conditional oscillations
[19]:
from typing import Union, Optional, Literal
from numpy.typing import NDArray
from quantify_scheduler import Schedule
from quantify_scheduler.operations.gate_library import Measure, Reset, X, Rxy, X90
from quantify_scheduler.operations.pulse_library import SquarePulse, SuddenNetZeroPulse
def conditional_oscillation_sched(
target_qubit : str,
control_qubit : str,
phases: Union[float, NDArray],
variant: Literal["OFF", "ON"],
snz_A : float,
snz_B : float,
snz_scale : float,
snz_dur : float,
snz_t_phi : float,
snz_t_integral_correction : float,
flux_port: Optional[str] = None,
repetitions: int = 1,
) -> Schedule:
"""
Make a conditional oscillation schedule to measure conditional phase.
Parameters
----------
target_qubit
The name of a qubit, e.g., "q0", the qubit with lower frequency.
control_qubit
The name of coupled qubit, the qubit with the higher frequency.
phases
An array (or scalar) of recovery phases in degrees.
variant
A string specifying whether to excite the control qubit.
snz_A
Unitless amplitude of the main square pulse.
snz_B
Unitless scaling correction for the final sample of the first
square and first sample of the second square pulse.
snz_scale
Amplitude scaling correction factor of the negative arm of the net-zero pulse.
snz_dur
The total duration of the two half square pulses.
snz_t_phi
The idling duration between the two half pulses.
snz_t_integral_correction
The duration in which any non-zero pulse amplitude needs to be corrected.
flux_port
An optional string for a flux port. Default is hf_qubit flux port.
repetitions
The amount of times the Schedule will be repeated.
Returns
-------
:
An experiment schedule.
"""
sched = Schedule(f"ConditionalOscillation({variant})", repetitions)
# Ensure phases is an iterable when passing a float
phases = np.asarray(phases)
phases = phases.reshape(phases.shape or (1,))
# Ensure that variant is uppercase for switch
variant = str.upper(variant)
if variant not in {"OFF", "ON"}:
raise ValueError(f"Schedule variant should be 'OFF' or 'ON'.")
# Set flux port
flux_port = flux_port if flux_port is not None else f"{control_qubit}:fl"
for acq_index, phi in enumerate(phases):
# Reset to |00>
sched.add(Reset(target_qubit, control_qubit))
# Apply a pi/2 pulse on the target qubit
targ_eq_ref = sched.add(X90(target_qubit))
if variant == "ON":
# Also apply a pi pulse on the control qubit
sched.add(X(control_qubit), ref_op=targ_eq_ref, ref_pt="start")
# Go to |11> <=> |02> avoided crossing on positive & negative sides
# using the SuddenNetZeroPulse
sched.add(
SuddenNetZeroPulse(
amp_A=snz_A,
amp_B=snz_B,
net_zero_A_scale=snz_scale,
t_pulse=snz_dur,
t_phi=snz_t_phi,
t_integral_correction=snz_t_integral_correction,
port=flux_port,
clock="cl0.baseband",
)
)
# Apply a pi/2 recovery pulse on the target qubit
targ_rec_ref = sched.add(Rxy(theta=90.0, phi=phi, qubit=target_qubit))
if variant == "ON":
# Also apply a pi pulse on the control qubit
sched.add(X(control_qubit), ref_op=targ_rec_ref, ref_pt="start")
# Measure system
sched.add(Measure(target_qubit, control_qubit, acq_index=acq_index))
return sched
[20]:
phase = ManualParameter(name="ph", unit="deg", label="Recovery phase")
flux_pulse_amplitude = ManualParameter(name="A", unit="", label="Flux pulse amplitude")
scaling_correction = ManualParameter(name="B", unit="", label="Scaling correction")
phase.batched = True
flux_pulse_amplitude.batched = False
scaling_correction.batched = False
conditional_oscillation_sched_kwargs = dict(
target_qubit = q0.name,
control_qubit = q1.name,
phases = phase,
snz_A = flux_pulse_amplitude,
snz_B = scaling_correction,
snz_scale = 1.0,
snz_dur = 40e-9,
snz_t_phi = 4e-9,
snz_t_integral_correction = 0.0
)
gettable_off = ScheduleGettable(
quantum_device,
conditional_oscillation_sched,
schedule_kwargs=conditional_oscillation_sched_kwargs | {"variant":"OFF"},
real_imag=False,
batched=True,
num_channels=2,
)
gettable_on = ScheduleGettable(
quantum_device,
conditional_oscillation_sched,
schedule_kwargs=conditional_oscillation_sched_kwargs | {"variant":"ON"},
real_imag=False,
batched=True,
num_channels=2,
)
meas_ctrl.gettables((gettable_off, gettable_on))
show_args(conditional_oscillation_sched_kwargs, title="conditional_oscillation_sched_kwargs")
conditional_oscillation_sched_kwargs
==============================
target_qubit = q0
control_qubit = q1
phases = ph
snz_A = A
snz_B = B
snz_scale = 1.0
snz_dur = 4e-08
snz_t_phi = 4e-09
snz_t_integral_correction = 0.0
[21]:
quantum_device.cfg_sched_repetitions(400)
meas_ctrl.settables([phase, flux_pulse_amplitude, scaling_correction])
meas_ctrl.setpoints_grid((
np.linspace(0.0, 360.0, 60),
[0.8],
[0.5]
))
cond_osc_ds = meas_ctrl.run("conditional oscillation")
cond_osc_ds
Starting batched measurement...
Iterative settable(s) [outer loop(s)]:
A, B
Batched settable(s):
ph
Batch size limit: 60
100% completed | elapsed time: 0s | time left: 0s last batch size: 60
100% completed | elapsed time: 0s | time left: 0s last batch size: 60
[21]:
<xarray.Dataset> Dimensions: (dim_0: 60) Coordinates: x0 (dim_0) float64 0.0 6.102 12.2 18.31 ... 341.7 347.8 353.9 360.0 x1 (dim_0) float64 0.8 0.8 0.8 0.8 0.8 0.8 ... 0.8 0.8 0.8 0.8 0.8 0.8 x2 (dim_0) float64 0.5 0.5 0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5 0.5 0.5 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 y2 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan y3 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan y4 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan y5 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan y6 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan y7 (dim_0) float64 nan nan nan nan nan nan ... nan nan nan nan nan nan Attributes: tuid: 20230719-140415-992-3ab215 name: conditional oscillation grid_2d: False grid_2d_uniformly_spaced: False 1d_2_settables_uniformly_spaced: False
[22]:
# If on dummy, override with old data for analysis
if dev_id == "dummy_cluster":
cond_osc_ds = dh.to_gridded_dataset(dh.load_dataset(tuid="20230509-164908-713-788626"))
[23]:
cond_osc_analysis = ConditionalOscillationAnalysis(tuid = cond_osc_ds.attrs["tuid"], dataset=cond_osc_ds)
cond_osc_analysis.run().display_figs_mpl()
[ ]: