Skip to content

Improving flux fitting by using different mask#1229

Merged
alecandido merged 11 commits into
mainfrom
improve_mask
Dec 16, 2025
Merged

Improving flux fitting by using different mask#1229
alecandido merged 11 commits into
mainfrom
improve_mask

Conversation

@andrea-pasquale

@andrea-pasquale andrea-pasquale commented Aug 12, 2025

Copy link
Copy Markdown
Contributor

In this PR I'm trying to improve the performance of the fit by doing the following:

  1. Adding more parameters (in this way we avoid to rely on outdated parameters from the JSON files) + using a slight different formula
  2. Instead of using a mask based on the confidence interval I'm using a different approach where after averaging the signal for each column (which should compensate any unwanted noise) I'm just calculating the peaks using find_peaks with a suitable prominence.

Here is how the fitting are looking now: http://login.qrccluster.com:9000/f4DP80QOStCzwaBP2XQxAQ==/
Compared to before where the fitting was failing: http://login.qrccluster.com:9000/x9YShaUsRU6rRJRAnmRd1w==/

I've also decided to remove the information related to the phase since it is not relevant for the fit. If we can confirm this I can refactor also the acquisition to simplify it removing the phase.

@codecov

codecov Bot commented Aug 12, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.70130% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.81%. Comparing base (dbdeaa0) to head (a5a7c5f).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
...ocols/flux_dependence/resonator_flux_dependence.py 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1229   +/-   ##
=======================================
  Coverage   97.81%   97.81%           
=======================================
  Files         132      132           
  Lines       10039    10041    +2     
=======================================
+ Hits         9820     9822    +2     
  Misses        219      219           
Flag Coverage Δ
unittests 97.81% <98.70%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...bocal/protocols/flux_dependence/qubit_crosstalk.py 98.43% <100.00%> (-0.03%) ⬇️
...protocols/flux_dependence/qubit_flux_dependence.py 98.26% <100.00%> (-0.02%) ⬇️
src/qibocal/protocols/flux_dependence/utils.py 100.00% <100.00%> (+1.61%) ⬆️
...s/qubit_spectroscopies/qubit_power_spectroscopy.py 100.00% <100.00%> (ø)
...ols/resonator_spectroscopies/resonator_punchout.py 100.00% <100.00%> (ø)
src/qibocal/protocols/utils.py 91.90% <100.00%> (+0.43%) ⬆️
...ocols/flux_dependence/resonator_flux_dependence.py 98.24% <90.90%> (-0.15%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andrea-pasquale

Copy link
Copy Markdown
Contributor Author

I took the opportunity to refactor and modify slightly the plots. Here are two examples
Screenshot 2025-08-13 at 11 49 05
Screenshot 2025-08-13 at 11 48 51

Comment thread src/qibocal/protocols/flux_dependence/qubit_flux_dependence.py Outdated
Comment thread src/qibocal/protocols/flux_dependence/utils.py Outdated
@andrea-pasquale andrea-pasquale added this to the Protocols milestone Aug 19, 2025
@andrea-pasquale andrea-pasquale marked this pull request as ready for review October 7, 2025 08:43
Comment thread src/qibocal/protocols/utils.py Outdated
Comment on lines +710 to +711
unique_bias = np.unique(y)
unique_freq = np.unique(x)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Defining these at the beginning of the function, you could use them even in the reshape.


for qubit in targets:
natives = platform.natives.single_qubit[qubit]
charging_energy[qubit] = platform.calibration.single_qubits[

@lballerio lballerio Dec 11, 2025

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.

same as lines 143-144-145, remove for redundancy?

("phase", np.float64),
]
)
"""Custom dtype for resonator flux dependence."""

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.

typo in the comment: correct:

"""Custom dtype for qubit flux dependence."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"""Custom dtype for resonator flux dependence."""
"""Custom dtype for qubit flux dependence."""

@lballerio lballerio 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.

All changes in protocols are minor changes, mainly the elaboration of phase data of the measured signal is deleted, and only the magnitude is processed.
Parent class FluxFrequencySweepParameters is defined as a parent class for all single protocols, but in general all the input parameters are maintained for each protocol.

This branch was tested with qubit_flux experiment, when a problem in extract_feature arose for pathological cases for qubit_flux experiment: before merging to main see stabilize-extract-feature branch for stabilizing extract_feature

@alecandido alecandido added this pull request to the merge queue Dec 16, 2025
Merged via the queue into main with commit dbd2354 Dec 16, 2025
39 checks passed
@alecandido alecandido deleted the improve_mask branch December 16, 2025 12:55
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.

3 participants