Upgrade the Qubit Spectroscopy experiment to the latest version taken from the CS_installations repo#530
Upgrade the Qubit Spectroscopy experiment to the latest version taken from the CS_installations repo#530ohad-lev-qm wants to merge 3 commits into
Conversation
…rentzian fit and quality "gates" - Update node 03a_qubit_spectroscopy and calibration_utils.qubit_spectroscopy together - Replace peaks_dips with Lorentzian + linear-background curve_fit - Add smart peak init, refit window, and R²/FWHM/contrast quality gates - Expose new fit-quality parameters on the node - Refresh plot panels with fit overlays and failed-fit indicators - Skip QUAM updates for qubits whose fits do not pass
Deepakkhurrana
left a comment
There was a problem hiding this comment.
Thanks for the update! :)
The analysis upgrade (Lorentzian fit, quality gates, skipping bad QUAM updates) is solid, but the PR adds a lot of noise by treating this like a “v2 migration” instead of a straight improvement to 03a. “v2 / legacy / replaces peaks_dips” is repeated across the node, GUI description, and every utils file even though there’s no parallel old node to keep. I’d trim the node back to the usual thin orchestration pattern, drop the versioning language, keep implementation detail in utils only, and avoid exporting internal helpers (fit_qubit_peak, etc.) unless something else actually needs them.
| @@ -1,154 +1,527 @@ | |||
| """Analysis utilities for qubit spectroscopy calibration (v2). | |||
There was a problem hiding this comment.
I think we should remove v2 here as well.
| @@ -1,11 +1,13 @@ | |||
| """Node utilities for qubit spectroscopy calibration.""" | |||
There was a problem hiding this comment.
This is not subject of this PR but Why do we need this file I wonder? IT is a very simple function which can live inside paramter.py
| @@ -1,87 +1,217 @@ | |||
| """Plotting utilities for qubit spectroscopy calibration (v2). | |||
|
|
|||
| Per-qubit panel keeps the dual-axis (absolute RF + detuning) layout from the | |||
There was a problem hiding this comment.
Lets not say legacy here, I think these nodes are always under update. And also we are overwriting the node so not sure how to access legacy.
| _MIN_HEIGHT_INCH = 6.0 | ||
|
|
||
|
|
||
| def _setup_grid_figure(grid) -> None: |
There was a problem hiding this comment.
Not sure what this means here? Why did we have to pass so many hardcoded params for plots?
| grid.fig.tight_layout(pad=1.5, w_pad=2.0, h_pad=2.0) | ||
|
|
||
|
|
||
| def _apply_tick_fontsize(ax: Axes, size: int = _FS_TICK) -> None: |
There was a problem hiding this comment.
Is this really needed, can be inline. Also for other helpers, I think we should make it inline if it is used once.
| process_raw_dataset, | ||
| fit_raw_data, | ||
| log_fitted_results, | ||
| lorentzian_peak_linbg, |
There was a problem hiding this comment.
Do we need to import them out of the module? Does any other node need them?
feat(qubit-spectroscopy): upgrade node 03a_qubit_spectroscopy with Lorentzian fit and "quality gates".
Summary
Upgrade node
03a_qubit_spectroscopyandcalibration_utils.qubit_spectroscopywith a so-called "v2" analysis features taken from theCS_installationsrepo. The QUA sequence is unchanged; post-processing, plotting, and QUAM update behavior are improved.Replace the legacy
peaks_dipspath with an explicit Lorentzian + linear-backgroundcurve_fit, including smart peak initialization (Savgol +find_peaks), a refit window, and anfwhm_floor_hzguard against fake-narrow noise-spike fits.Add R² / FWHM / contrast "quality gates" and new node parameters (
r2_threshold,max_fwhm_mhz,min_contrast); failed fits setnode.outcomesto"failed"and are skipped inupdate_state.Refresh plot panels with a window-clipped fit overlay, a values box for QUAM-bound outputs, and clear failed-fit indicators; apply per-qubit saturation amplitude bound checks.
Plotting demo
Before:

After:
