Skip to content

Feature/vz error amp#533

Open
paulQM wants to merge 4 commits into
mainfrom
feature/vz-error-amp
Open

Feature/vz error amp#533
paulQM wants to merge 4 commits into
mainfrom
feature/vz-error-amp

Conversation

@paulQM

@paulQM paulQM commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

PR Summary: CZ phase compensation with error amplification

Branch: feature/vz-error-amp
Base: main (ab66cf09)
Commits: 4

Commit Message
c3e17440 feat: add files
12330449 rename files and add parameter
8053e8f4 feat: improve analysis with sinc fit
f4ff5b53 chore: remove local VS Code settings from repo

Summary

This PR adds a new CZ calibration node (33b) that calibrates residual single-qubit (local Z) phase shifts from the CZ macro using error amplification: the CZ gate is repeated 1…N times before a final virtual frame rotation, which makes small phase errors easier to resolve than the standard single-CZ Ramsey sequence in node 33a.

It also renames the existing phase-compensation node from 33_cz_phase_compensation.py33a_cz_phase_compensation.py to make room for the new variant in the CZ calibration numbering scheme.


What’s new

Node 33b — 33b_cz_phase_compensation_error_amp.py

  • Runs a Ramsey-like sequence (x90 → N×CZ → x90) separately on control and target qubits.
  • Sweeps an additional virtual frame rotation on top of the stored phase_shift_control / phase_shift_target.
  • Sweeps number of CZ operations (default 1–8) to amplify phase error before readout.
  • Supports state discrimination or raw IQ readout.
  • Updates QUAM state by adding the fitted compensation frame to the existing phase shifts (modulo 1).

Calibration utilities — calibration_utils/cz_phase_compensation_error_amp/

New package mirroring the structure of the standard cz_phase_compensation utilities:

Module Role
parameters.py Node parameters: shots, frame sweep (frame_range, num_frames), number_of_operations, CZ macro type, state discrimination
analysis.py Averages signal over repetitions, fits a sinc model to locate the optimal compensation frame; falls back to parabolic peak refinement if the sinc fit fails
plotting.py 2×N panel figure (control / target per qubit pair) with mean curve, sinc overlay, and fitted optimum
__init__.py Public exports

Analysis model:

f(frame) = B + A · sinc(w · (frame − frame₀) / π)

For each qubit (control and target), the signal is averaged over number_of_operations, then the peak position gives the residual phase to compensate. Fit success requires both control and target fits to succeed.

Rename — node 33a

  • 33_cz_phase_compensation.py33a_cz_phase_compensation.py
  • Node name updated to 33a_cz_phase_compensation (99% content preserved; standard single-CZ phase compensation unchanged in behavior).

File changes

Change Path
Added calibration_utils/cz_phase_compensation_error_amp/ (4 files)
Added calibrations/CZ_calibrations/33b_cz_phase_compensation_error_amp.py
Renamed 33_cz_phase_compensation.py33a_cz_phase_compensation.py
Modified calibrations/1Q_calibrations/07_iq_blobs.py

Stats: 7 files changed, +705 / −3 lines (vs main).


Comparison: 33a vs 33b

33a (standard) 33b (error amp)
CZ repetitions 1 1…N (default 8)
Frame sweep Full 0→1 cycle Narrow window around 0 (default ±0.05 in 2π units)
Analysis Sinusoidal Ramsey fit Sinc fit on mean-over-N curve
State update Subtract fitted phase Add fitted phase

Use 33a for coarse or routine compensation; use 33b when residual phases are small and need amplification to measure reliably.


Notes / review items

  1. 07_iq_blobs.py — Includes a local debug override (node.parameters.qubits = ["qD3", "qA6"]) and a trailing # %% cell marker. Consider reverting before merge if these are not intentional for the repo.
  2. Sign convention — 33b adds fitted phase to stored compensation; 33a subtracts. This matches the different experiment geometry (amplified error vs direct Ramsey phase) but is worth confirming against hardware validation.

Test plan

  • Run 33a on a qubit pair and confirm behavior is unchanged after the rename (node name / GUI registration).
  • Run 33b with use_state_discrimination=True on a calibrated pair; verify sinc fits succeed and plots show control/target peaks.
  • Confirm phase_shift_control / phase_shift_target update correctly in QUAM state after a successful 33b run.
  • Re-run a simple 2Q check (e.g. conditional phase or RB) to verify improved compensation vs pre-calibration.
  • Test fallback path: intentionally use a narrow frame_range or noisy data and confirm parabolic fallback still returns a finite phase.
  • Optional: run with use_state_discrimination=False and confirm IQ → voltage conversion and analysis still work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant