qiboteam / qibocal

Quantum calibration, characterization and validation module for Qibo.
https://qibo.science
Apache License 2.0
28 stars 4 forks source link

Utility for automatically scaling `magnitude` to expectation values #817

Open marekgluza opened 2 months ago

marekgluza commented 2 months ago

When we execute a qibolab.Pulse and retrieve the readout magnitude platform.execute_pulse_sequence(ps, opts)[q7_ro.serial].magnitude we get rabi_exc_time_X_pulse_start

Proposed feature:

Expected output:

Potential use example: Last week we have run cross-resonance driving on q1,q2,q3 and the script provides output data for magnitudes which are stored and we get three_CR_010_201

The problem: Without autocalibration storing the output of a dedicated run of Rabi oscillation for each of the involved qubits then we have no estimate whether the minima of these readout traces of coupled qubits are hitting their respective $|1\rangle$ value or not. In the coupled case the evolution of initial $|0,0,0\rangle$ might not reach $\langle Z_k(t)\rangle =-1$ but just from this plot we don't know what was he minimal expectation value. (The data in the plot is useless if we don't have access to the min-max of each of the qubits because without min-max we don't know how to stretch and move the data for each qubit; should be automated anyway.)


@scarrazza can you add me and @khanhuyengiang to the qibocal team?

andrea-pasquale commented 2 months ago

Thanks @marekgluza for opening the issue. Our approach in order to go from voltages to probabilities is to perform a single shot classification experiment, which consists in generating a sequence of 0s and a sequence of 1s and then perform a fit in the IQ plane to classify 0s and 1s. Would it be possible in your case to adopt the same strategy?

khanhuyengiang commented 1 month ago

Thank you, @andrea-pasquale, for your response. We currently use a similar strategy for calibrating single-shot experiments. Our proposed feature addresses the arbitrary magnitude obtained using the SEQUENTIAL averaging method, where the Rabi oscillations already provide a clear sine curve from which we can infer expectation values of $1$ and $-1$.

This feature will:

  1. In SEQUENTIAL averaging mode, sweep the arbitrary magnitude of the readout for $\ket{0}$ and $\ket{1}$ for each qubit over time (alternatively, find the min and max of a Rabi pulse on each qubit).
  2. Store this magnitude as the baseline.
  3. Use this baseline to calibrate all SEQUENTIAL readouts, standardizing them from $-1$ to $1$ instead of a raw range (e.g., from 56000 to 62000).

Implementing this feature would be straightforward and intuitive. It will be particularly useful when running multiple qubits using SEQUENTIAL readout, making it easier to interpret qubit behavior from the processed output.

For example, the 3-qubit CR plots that Marek mentioned might show Q3 oscillating from $\ket{0}$ to $\ket{1}$, or from $\ket{0}$ to $\ket{+}$, but this is not evident from the raw measurement values:

three_CR_010_201

I have make a proof of concept code at this new branch, that can be run and tested on our hardware at NTU. Would it be reasonable to add this to qibocal?

andrea-pasquale commented 1 month ago

Thanks @khanhuyengiang for the reply. I think that this is the behavior intended for magnitude given that there is no post-processing applied. I had a quick look at the code and I understand the idea. It is not the standard procedure but I believe that it could work. Regarding this normalization, in qibocal we also provide a Rabi protocol where the output is already normalized https://github.com/qiboteam/qibocal/blob/main/src/qibocal/protocols/rabi/amplitude.py. We can do this by retrieving samples from the instrument: https://github.com/qiboteam/qibocal/blob/4c23ced7d5ee1e93d758e75179308a9d13c6da90/src/qibocal/protocols/rabi/amplitude.py#L94-L114 Could this work for you? I think that the outcome should be pretty much the same :)