Skip to content
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

Small bugfix in resilience validation #1632

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

gadial
Copy link
Collaborator

@gadial gadial commented Apr 23, 2024

Summary

Fixes a bug in ResilienceOptionsV2 where validation misses a corner case where pec_mitigation is False although pec options were passed.

Details and comments

The bug results from the check any(asdict(self.pec).values()) which attempts to deduce whether any pec options were passed. Since some valid options are treated as False by Python, this check might fail. An example was added to the unit tests:

{"resilience": {"pec": {"max_overhead": None, "noise_gain": 0}}},

Where both the None and the 0 values are valid options (requiring pec_mitigation=True) but both are treated as False by Python.

The simple solution is to explicitly compare the values to Unset and the check passes in there is any value different than Unset.

The same fix was performed for zne and measure_noise_learning options.

@gadial gadial requested a review from kt474 April 23, 2024 08:36
@kt474 kt474 added the Changelog: Bugfix Include in the Fixed section of the changelog label Apr 23, 2024
@kt474 kt474 added this to the 0.24.0 milestone Apr 23, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8817820953

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 83.662%

Totals Coverage Status
Change from base Build 8817572387: 0.01%
Covered Lines: 6273
Relevant Lines: 7498

💛 - Coveralls

@kt474 kt474 merged commit e0b0733 into Qiskit:main Apr 24, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the Fixed section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants