State-classification workflow¶
This notebook covers both binary and ternary readout classification.
Start with a standard ge experiment for the 2-state classifier, then
move to ge-ef-cr mode when you want to resolve |g>, |e>, and |f>.
1. Build a 2-state classifier¶
Start from the ordinary ge configuration and collect the readout
clusters for |g> and |e>.
import numpy as np
import qubex as qx
exp_ge = qx.Experiment(
system_id="YOUR_SYSTEM_ID",
muxes=[0],
# config_dir="/path/to/qubex-config/config",
# params_dir="/path/to/qubex-config/params/YOUR_SYSTEM_ID",
)
2. Connect to the setup¶
Connect before you collect any state clusters.
exp_ge.connect()
3. Check the waveform¶
Use a waveform check to confirm that the readout path is stable before classification.
waveform_result = exp_ge.check_waveform()
4. Prepare the ge pulse set¶
Measure a baseline Rabi oscillation, calibrate the half-pi pulse, and save the note before building the 2-state classifier.
rabi_result = exp_ge.obtain_rabi_params()
hpi_result = exp_ge.calibrate_hpi_pulse()
exp_ge.calib_note.save()
5. Measure the 2-state clusters¶
Collect the |g> and |e> readout distributions for the two-state classifier.
binary_distributions = exp_ge.measure_state_distribution(
exp_ge.qubit_labels,
n_states=2,
)
6. Build the 2-state classifier¶
Fit the classifier from the measured two-state clusters.
binary_classifier = exp_ge.build_classifier(
exp_ge.qubit_labels,
n_states=2,
n_shots=10000,
)
7. Create an Experiment in ge-ef-cr mode¶
Open a second experiment in ge-ef-cr mode for three-state classification.
ge-ef-cr assigns control channels in the order ge, ef, and cr, so
it is the mode you want when you need direct access to the |f> manifold.
If the active AWG profile leaves a control port with only one channel, that
port resolves to ge only, so you cannot drive EF on that qubit.
exp_gef = qx.Experiment(
system_id="YOUR_SYSTEM_ID",
muxes=[0],
configuration_mode="ge-ef-cr",
# config_dir="/path/to/qubex-config/config",
# params_dir="/path/to/qubex-config/params/YOUR_SYSTEM_ID",
)
8. Connect the ge-ef-cr session¶
Connect the second session before you push the ge-ef-cr layout to hardware.
exp_gef.connect()
9. Configure the ge-ef-cr layout¶
Call configure() so the control hardware applies the ge-ef-cr channel
layout before you prepare |f> and collect ternary clusters.
[!CAUTION]
configure()changes the state of the control instruments. On shared systems, it can affect other users who are using the same hardware. Also, if a control port has only one AWG channel, that port staysge-only and EF drive is not available there.
exp_gef.configure()
10. Measure the EF Rabi oscillation¶
Use the EF Rabi scan to confirm that the |f> manifold can be prepared reliably.
ef_rabi_result = exp_gef.obtain_ef_rabi_params(
exp_gef.qubit_labels,
time_range=np.arange(0, 201, 4),
n_shots=1024,
)
11. Calibrate the EF half-pi pulse¶
Calibrate the EF half-pi pulse before collecting the three-state clusters.
ef_hpi_result = exp_gef.calibrate_ef_hpi_pulse(
exp_gef.qubit_labels,
n_rotations=1,
)
12. Measure the 3-state clusters¶
Collect the |g>, |e>, and |f> distributions for ternary classification.
ternary_distributions = exp_gef.measure_state_distribution(
exp_gef.qubit_labels,
n_states=3,
)
13. Build the 3-state classifier¶
Fit the ternary classifier from the measured three-state clusters.
ternary_classifier = exp_gef.build_classifier(
exp_gef.qubit_labels,
n_states=3,
n_shots=1000,
)