Ramsey Correction: calibration and analysis#

Ramsey fringes are used to precisely correct the qubit clock frequency and to measure dephasing (\(T_2\)) by observing interference between two π/2 pulses separated by a variable delay. By adding a known artificial detuning (implemented as a phase shift of the second π/2), and measuring the oscillation frequency versus that artificial detuning, one can determine the true frequency offset of the qubit and compute a correction to the stored clock frequency. This can also be done for 12 operations with the only difference being the 1 state being initialized.

Two variants are shown below: the second π/2 pulse can be applied on either the X or the Y axis.

Code structure#

Measurement class: RamseyDetuningsMeasurement#

The RamseyDetuningsMeasurement class builds schedules for multiplexed Ramsey experiments across many qubits.

Method: schedule_function#

The schedule_function generates an experimental schedule for performing Ramsey experiments. The sequence involves:

  1. Reset: Reset all qubits to a known state.

  2. Initialize Qubit: Initialize the qubit to state 0 or 1, depending on which qubit frequency you want to attain.

  3. Delay Sweeping: sweep τ in the sequence π/2 pulse → idle (τ) → π/2 pulse with recovery phase

  4. Measurement: Capture the qubit response at each point and reset the qubit.

Parameters:

  • artificial_detunings: dict[str, np.ndarray] — per-qubit array of applied artificial detunings (Hz).

  • ramsey_delays: dict[str, np.ndarray] — per-qubit array of delays τ (s).

  • repetitions: int — number of averages/repetitions per point (default 1024).

  • qubit_state: int — which manifold to operate on (0 for \(0\leftrightarrow 1\), 1 for \(1\leftrightarrow 2\)).

  • sequence: "x90_x90" | "x90_y90" (default "x90_y90" at the schedule level) — which pulse sequence is actually run: "x90_x90" uses a second π/2 pulse at the same phase as the first (the original, sign-blind sequence: the population response is an even cos(2π·detuning·t), so a single trace cannot recover the detuning’s sign); "x90_y90" rotates the second pulse 90° (Rxy(θ=90, φ=90) for the \(0\leftrightarrow 1\) manifold), making the response sign-carrying instead. See the analysis section below for how this choice changes the fit.

Returns:

  • A Schedule object representing an experiment schedule that, when executed, produces a 2D dataset with coords [detuning, delay]

artificial_detunings, ramsey_delays, repetitions and sequence above are the acquisition fields of RamseyParameters (see Parameter field categories) — changing any of them requires re-running on hardware. Note that RamseyParameters.sequence itself defaults to "x90_x90" (to match every dataset recorded before this field existed); the actual forward default for new acquisitions is set per-node in nodes.yaml, which pins sequence: "x90_y90".

Analysis class: RamseyDetuningsAnalysis#

The RamseyDetuningsAnalysis class handles both the per-qubit fit and the figure generation. The standard figure displays, for each qubit, the measured detuning as a function of the artificial detuning with the fitted response. An additional figure is shown for each qubit, showing all the Ramsey fringes for different artificial detunings.

The analysis takes the multiplexed Ramsey data and extracts fitted instantaneous detunings for each artificial detuning, then performs a linear mapping between artificial detuning and fitted detuning. From that linear fit the true frequency correction is computed. Each point in this fit is extracted from fitting the Ramsey fringes to a damped-sinusoid model.

Quality check in analysis and error propagation#

The three thresholds below are analysis fields of RamseyParameters (see Parameter field categories) — safe to change and re-apply to already-saved data during a bragi_quantum.gui reanalysis.

  • \(R^2\) of each Ramsey fringe fit: If the \(R^2\) of the fit is below min_r_squared_detune_fit (default 0.85), the fit is discarded and not used in the linear fit. This value may need to be optimized depending on the noise level of the measurements. A \(\chi^2\) test cannot be used here since there is no error associated with each point in the Ramsey fringe.

  • Minimum error on fitted detuning: Since each point in the Ramsey fringe fit does not have an associated error, the fit error is estimated from the standard error of the fit parameters. A minimum relative error of minimum_relative_error_from_fits (default 2%) of the fitted detuning value is enforced to avoid overconfidence in the linear fit. This is probably still an optimistic error estimate and may need to be adjusted based on experimental conditions.

  • \(R^2\) of the linear fit: The reduced \(\chi^2\) of the fitted-detuning-vs-artificial-detuning line is also computed and shown on the plot, but it does not gate success. As with resonator spectroscopy, there is no real per-point error on each fitted detuning to anchor a \(\chi^2\) scale to, so the gate instead uses min_r_squared_line_fit (default 0.9): if the line fit’s \(R^2\) falls below this threshold, the frequency correction is not applied and the node for the specific qubit is marked as failed.

  • analysis_sequence: "x90_x90" | "x90_y90" | None (default None) — reanalysis-time override of which fit strategy to use (see below), independent of the recorded sequence; falls back to sequence when unset. Since this only changes post-processing, it can be changed and re-applied to already-saved data during a bragi_quantum.gui reanalysis without a hardware re-run.

Sign resolution and the two fit strategies#

Because of the periodic cosine fit, a Ramsey trace alone cannot always tell a positive detuning from a negative one — how much information is available depends on which sequence was run, so the analysis picks one of two fit strategies based on effective_sequence = parameters.analysis_sequence or parameters.sequence:

  • "x90_y90": the second pulse’s 90° phase offset pins the response’s phase near a fixed value (±π/2), independent of the detuning’s sign — so each trace’s own initial slope (relative to that phase pin) tells you which side of zero its detuning is on. RamseyModel.guess() reads this off the data directly to seed the fit with the correct sign, and a signed LinearFitModel line fit is then used across all detuning points.

  • "x90_x90" (the default, matching legacy datasets): no per-trace sign information exists at all, so the fitted detuning is bounded ≥0 for every point. Instead of a signed line, a FoldedLinearFitModel (a V-shaped/folded fit, mirroring |detuning| about zero) is fit across the artificial-detuning axis; its vertex gives the frequency correction without ever needing to resolve an individual trace’s sign.

Both models live in bragi_quantum.experiments.utils.analysis_models, alongside the per-detuning RamseyModel (a damped sinusoid) used for every individual Ramsey trace regardless of sequence.

QOI class: RamseyBaseQOI#

  • frequency / frequency_error: the frequency correction (Hz) — the linear (or folded-linear) fit’s zero crossing (or vertex).

  • chi2: the linear fit’s reduced chi-squared (informational; does not gate success — see above).

  • r_squared: the linear fit’s \(R^2\), which does gate success via min_r_squared_line_fit.

Ramsey01QOI/Ramsey12QOI route frequency/frequency_error onto the device’s clock_freqs.f01/f12 (and the matching clock_freqs:f01/f12 Redis key); chi2/r_squared are carried on the QOI object for the plot but not persisted to the device model or Redis.