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

Fix plot_error_map with BackendProperties set or BackendV2 #7880

Merged
merged 4 commits into from
Apr 4, 2022

Conversation

mtreinish
Copy link
Member

Summary

In #7814 we updated the plot_error_map() error to be more general and
also work with BackendV2 instead of assuming it's a BaseBackend or
BackendV1 backend. However, as part of that refactor 2 errors were
accidently introduced preventing the function from being used. First in
the BackendV2 path we were incorrectly handling the backend name to use
for the plot title. Secondly, in the BaseBackend/BackendV1 path the
readout error array loop was incorrectly constructed resulting in the
array being larger than expected causing an error. This commit fixes
both conditions so that we can correctly plot the result.

Details and comments

Fixes #7879

In Qiskit#7814 we updated the plot_error_map() error to be more general and
also work with BackendV2 instead of assuming it's a BaseBackend or
BackendV1 backend. However, as part of that refactor 2 errors were
accidently introduced preventing the function from being used. First in
the BackendV2 path we were incorrectly handling the backend name to use
for the plot title. Secondly, in the BaseBackend/BackendV1 path the
readout error array loop was incorrectly constructed resulting in the
array being larger than expected causing an error. This commit fixes
both conditions so that we can correctly plot the result.

Fixes Qiskit#7879
@mtreinish mtreinish requested review from a team, nonhermitian and nkanazawa1989 as code owners April 4, 2022 15:26
@mtreinish mtreinish added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog labels Apr 4, 2022
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

The changeset looks good to me - it looks pretty straightforward. Given that we broke simple functionality in an update here, is there some simple regression test we can add for the future?

@mtreinish
Copy link
Member Author

Heh, yeah the complete lack of test coverage for this function is how this slipped in the first place. I'll add some tests

@coveralls
Copy link

coveralls commented Apr 4, 2022

Pull Request Test Coverage Report for Build 2091796475

  • 11 of 13 (84.62%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 83.931%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/visualization/gate_map.py 11 13 84.62%
Totals Coverage Status
Change from base Build 2091035120: 0.2%
Covered Lines: 54134
Relevant Lines: 64498

💛 - Coveralls

This commit adds test coverage for plot_error_map. The reason the issues
around this function slipped in was a complete lack of test coverage.
This adds some basic tests with both the BackendV1 and BackendV2 test
paths to ensure we have some coverage for the function.
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

The tests look fine, and it'll be good to get the increased coverage too. I think you'll want a bugfix release note before merge?

@mtreinish mtreinish changed the title Fix plot_error_map Fix plot_error_map with BackendProperties set or BackendV2 Apr 4, 2022
@mergify mergify bot merged commit d430e4d into Qiskit:main Apr 4, 2022
mergify bot pushed a commit that referenced this pull request Apr 4, 2022
* Fix plot_error_map

In #7814 we updated the plot_error_map() error to be more general and
also work with BackendV2 instead of assuming it's a BaseBackend or
BackendV1 backend. However, as part of that refactor 2 errors were
accidently introduced preventing the function from being used. First in
the BackendV2 path we were incorrectly handling the backend name to use
for the plot title. Secondly, in the BaseBackend/BackendV1 path the
readout error array loop was incorrectly constructed resulting in the
array being larger than expected causing an error. This commit fixes
both conditions so that we can correctly plot the result.

Fixes #7879

* Add tests for plot_error_map

This commit adds test coverage for plot_error_map. The reason the issues
around this function slipped in was a complete lack of test coverage.
This adds some basic tests with both the BackendV1 and BackendV2 test
paths to ensure we have some coverage for the function.

* Add release note

(cherry picked from commit d430e4d)
mergify bot added a commit that referenced this pull request Apr 4, 2022
…7887)

* Fix plot_error_map

In #7814 we updated the plot_error_map() error to be more general and
also work with BackendV2 instead of assuming it's a BaseBackend or
BackendV1 backend. However, as part of that refactor 2 errors were
accidently introduced preventing the function from being used. First in
the BackendV2 path we were incorrectly handling the backend name to use
for the plot title. Secondly, in the BaseBackend/BackendV1 path the
readout error array loop was incorrectly constructed resulting in the
array being larger than expected causing an error. This commit fixes
both conditions so that we can correctly plot the result.

Fixes #7879

* Add tests for plot_error_map

This commit adds test coverage for plot_error_map. The reason the issues
around this function slipped in was a complete lack of test coverage.
This adds some basic tests with both the BackendV1 and BackendV2 test
paths to ensure we have some coverage for the function.

* Add release note

(cherry picked from commit d430e4d)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
@mtreinish mtreinish deleted the fix-plot-error-map branch April 5, 2022 16:00
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 stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plot_error_map fails
3 participants