-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix guess.rb_decay not to raise an error against bad output #1336
Merged
nkanazawa1989
merged 3 commits into
qiskit-community:main
from
itoko:fix-guess-rb-decay
Jan 17, 2024
Merged
Fix guess.rb_decay not to raise an error against bad output #1336
nkanazawa1989
merged 3 commits into
qiskit-community:main
from
itoko:fix-guess-rb-decay
Jan 17, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
itoko
added
backport stable potential
The issue or PR might be minimal and/or import enough to backport to stable
Changelog: Bugfix
Include in the "Fixed" section of the changelog
labels
Dec 5, 2023
coruscating
reviewed
Dec 12, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me. @nkanazawa1989 are you okay with merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. One minor suggestion to the unittest :)
Co-authored-by: Naoki Kanazawa <[email protected]>
nkanazawa1989
approved these changes
Jan 17, 2024
mergify bot
pushed a commit
that referenced
this pull request
Jan 17, 2024
### Summary Fixed a bug in `guess.rb_decay` where it unintentionally raises an error if all y values are below the b value (that can happen in experiments on real devices). ### Details and comments Changed to return `0` as the initial guess of the decay parameter when all y values are below the b value, instead of raising an IndexError like ``` File "/qiskit-experiments/qiskit_experiments/curve_analysis/guess.py", line 406, in rb_decay return ((y[0] - b) / a) ** (1 / x[0]) IndexError: index 0 is out of bounds for axis 0 with size 0 ``` An alternative solution might be explicitly raising a QiskitError. But, if we want to raise an error for too bad data to fit, I think the fitter (not rb_decay) should raise an error because it should not be due to the failure of guessing initial parameter (that is the object of `rb_decay` function. --------- Co-authored-by: Naoki Kanazawa <[email protected]> (cherry picked from commit 0937bb4)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport stable potential
The issue or PR might be minimal and/or import enough to backport to stable
Changelog: Bugfix
Include in the "Fixed" section of the changelog
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a bug in
guess.rb_decay
where it unintentionally raises an error if all y values are below the b value (that can happen in experiments on real devices).Details and comments
Changed to return
0
as the initial guess of the decay parameter when all y values are below the b value, instead of raising an IndexError likeAn alternative solution might be explicitly raising a QiskitError. But, if we want to raise an error for too bad data to fit, I think the fitter (not rb_decay) should raise an error because it should not be due to the failure of guessing initial parameter (that is the object of
rb_decay
function.