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

Structural change to mpl circuit drawer to use class NodeData #10478

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

enavarro51
Copy link
Contributor

Summary

Switch to using NodeData class

Details and comments

Following on #10207 and from a suggestion by @jakelishman, this PR switches to using a NodeData class for storing data used in the drawing elements of a circuit and keyed on the node id. So a previous use such as node_data[node]["width"] is now node_data[node].width. This improves the readability of the code, provides for descriptions of the attributes in one place, and allows removal of several initialization checks.

@enavarro51 enavarro51 requested review from a team and nonhermitian as code owners July 23, 2023 22:28
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

@coveralls
Copy link

Pull Request Test Coverage Report for Build 5638946759

  • 42 of 88 (47.73%) changed or added relevant lines in 1 file are covered.
  • 24 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.02%) to 85.907%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/visualization/circuit/matplotlib.py 42 88 47.73%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 91.14%
qiskit/visualization/circuit/matplotlib.py 3 50.73%
crates/qasm2/src/parse.rs 18 96.18%
Totals Coverage Status
Change from base Build 5631006520: -0.02%
Covered Lines: 73016
Relevant Lines: 84994

💛 - Coveralls

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.

Thanks Edwin, this makes that whole node_data object a bit less magical - much easier to see what's actually known about each node, and to have a common place to see documentation / comments on the different parts.

@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: None Do not include in changelog mod: visualization qiskit.visualization labels Jul 24, 2023
@jakelishman jakelishman added this to the 0.25.0 milestone Jul 24, 2023
@jakelishman jakelishman added this pull request to the merge queue Jul 24, 2023
Merged via the queue into Qiskit:main with commit cab90ca Jul 24, 2023
mergify bot pushed a commit that referenced this pull request Jul 24, 2023
github-merge-queue bot pushed a commit that referenced this pull request Jul 24, 2023
(cherry picked from commit cab90ca)

Co-authored-by: Edwin Navarro <enavarro@comcast.net>
to24toro pushed a commit to to24toro/qiskit-terra that referenced this pull request Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog mod: visualization qiskit.visualization 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.

4 participants