Skip to content

Upgrade the Qubit Spectroscopy experiment to the latest version taken from the CS_installations repo#530

Open
ohad-lev-qm wants to merge 3 commits into
mainfrom
feature/update_node__qubit_spec_vs_flux
Open

Upgrade the Qubit Spectroscopy experiment to the latest version taken from the CS_installations repo#530
ohad-lev-qm wants to merge 3 commits into
mainfrom
feature/update_node__qubit_spec_vs_flux

Conversation

@ohad-lev-qm

@ohad-lev-qm ohad-lev-qm commented Jun 17, 2026

Copy link
Copy Markdown

feat(qubit-spectroscopy): upgrade node 03a_qubit_spectroscopy with Lorentzian fit and "quality gates".

Summary

Upgrade node 03a_qubit_spectroscopy and calibration_utils.qubit_spectroscopy with a so-called "v2" analysis features taken from the CS_installations repo. The QUA sequence is unchanged; post-processing, plotting, and QUAM update behavior are improved.

  • Replace the legacy peaks_dips path with an explicit Lorentzian + linear-background curve_fit, including smart peak initialization (Savgol + find_peaks), a refit window, and an fwhm_floor_hz guard 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 set node.outcomes to "failed" and are skipped in update_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:
figures amplitude

After:
figures amplitude

…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 Deepakkhurrana left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove v2 here as well.

@@ -1,11 +1,13 @@
"""Node utilities for qubit spectroscopy calibration."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to import them out of the module? Does any other node need them?

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.

2 participants