Skip to content

improve intial parameters guess Lorentzian fit - #1492

Merged
RoyStegeman merged 6 commits into
mainfrom
review_resonator
May 15, 2026
Merged

improve intial parameters guess Lorentzian fit#1492
RoyStegeman merged 6 commits into
mainfrom
review_resonator

Conversation

@RoyStegeman

@RoyStegeman RoyStegeman commented May 11, 2026

Copy link
Copy Markdown
Member

closes #1408

The fits in #1408 that before failed now pass.

The background was made linear in an earlier PR. In this PR we heavily rely on the assumption of a linear background to make the guesses for the initial parameters so it is stable only up to a point where the background is linear enough.

Specifically what changed are the following things:

  • the linear background consisting of offset and slope is now estimated from the endpoints of the frequency domain. This linear function is subtracted before peak detection, so argmax/argmin operate on the residual signal.
  • sigma is now derived from the half-maximum width of the peak after subtracting the linear background from the data. Before the distance between argmax and argmin of the raw data was used, which is much less stable.
  • uncertainties are no longer passed to the fit function since uncertainties in a spectroscopy are largely unnecessary overhead. Bounds have been added to constrain the fit parameters.

Comment thread src/qibocal/protocols/utils.py
@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.38%. Comparing base (0db1245) to head (a5656ec).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1492      +/-   ##
==========================================
- Coverage   94.43%   94.38%   -0.06%     
==========================================
  Files         136      136              
  Lines       10662    10669       +7     
==========================================
+ Hits        10069    10070       +1     
- Misses        593      599       +6     
Flag Coverage Δ
unittests 94.38% <100.00%> (-0.06%) ⬇️

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

Files with missing lines Coverage Δ
src/qibocal/protocols/utils.py 92.03% <100.00%> (-0.37%) ⬇️

... and 4 files 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.

@RoyStegeman
RoyStegeman marked this pull request as ready for review May 12, 2026 14:30
@RoyStegeman
RoyStegeman requested review from a team May 12, 2026 14:30
@RoyStegeman RoyStegeman changed the title improve intial parameters guess resonator spectroscopy improve intial parameters guess Lorentzian fit May 12, 2026
@RoyStegeman
RoyStegeman requested a review from alecandido May 14, 2026 14:09

@alecandido alecandido left a comment

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.

The first two comments are stylistic.
The other two need to be addressed in a separate PR. But, if you agree with them, better to write them down in suitable issues immediately

Comment thread src/qibocal/protocols/utils.py Outdated
Comment thread src/qibocal/protocols/utils.py Outdated
Comment thread src/qibocal/protocols/utils.py Outdated
Comment thread src/qibocal/protocols/utils.py Outdated
@RoyStegeman
RoyStegeman requested a review from alecandido May 15, 2026 08:43
Comment thread src/qibocal/protocols/utils.py Outdated
@RoyStegeman
RoyStegeman requested a review from scarrazza May 15, 2026 09:59
@RoyStegeman
RoyStegeman added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit f8f1c8e May 15, 2026
39 checks passed
@RoyStegeman
RoyStegeman deleted the review_resonator branch May 15, 2026 10:23
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.

resonator spectroscopy fit sometimes fails

3 participants