qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Refactor state latex drawer

Open frankharkins opened this issue 2 years ago • 5 comments

Summary

This PR builds on #8273 and #8461.

In this PR I have:

  • (1219531a09233315981ecdcb12552c8d2562ece6, c4debbdf2b92289ffd01e743df5808559808bc32, 72e4fb7ec9e41453f1d91af8482e033daebf8931) Removed duplicated code that converts amplitudes to latex strings (visualization.array._num_to_latex and visualization.state_visualization._num_to_latex_ket)
  • (21d4b6bd2c288bc67b22a7ab9877c326cdb520aa, 1126a4fa735b3db03f05e06af74159544ab4d3ee) Reduced the amount of code in the drawers and hopefully cleared up the logic a bit
  • (bd64399c2295b910b107e0051b7ad47c7cf0d4c4) Cleaned up the output latex (fixes most of #8317)

frankharkins avatar Aug 16 '22 09:08 frankharkins

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core
  • @enavarro51
  • @ikkoham

qiskit-bot avatar Aug 16 '22 09:08 qiskit-bot

Pull Request Test Coverage Report for Build 2874353207

  • 34 of 39 (87.18%) changed or added relevant lines in 2 files are covered.
  • 183 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.01%) to 84.036%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/visualization/array.py 27 29 93.1%
qiskit/visualization/state_visualization.py 7 10 70.0%
<!-- Total: 34 39
Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/initializer.py 1 97.22%
qiskit/extensions/unitary.py 1 96.59%
qiskit/visualization/array.py 1 86.25%
qiskit/circuit/quantumcircuit.py 36 93.5%
qiskit/visualization/state_visualization.py 144 55.31%
<!-- Total: 183
Totals Coverage Status
Change from base Build 2862656180: -0.01%
Covered Lines: 56237
Relevant Lines: 66920

💛 - Coveralls

coveralls avatar Aug 16 '22 10:08 coveralls

Is this intended to supersede/obsolete #8273 and #8461? If so, was it in discussion with @1ucian0 and @ryanhill1?

jakelishman avatar Aug 17 '22 13:08 jakelishman

Not my intention, I assumed those PRs are close to ready-to-merge, so it made more sense to build on them instead of re-solving the same problems in main. I didn't speak to either author, but I imagine they'd want to see the PR through, so probably best to review & merge those first before turning to this. I can fix any merge conflicts.

frankharkins avatar Aug 17 '22 14:08 frankharkins

@1ucian0 - The fixes in this PR overlaps with some of the code in the 'noisy' PR #8174.

If this PR is allowed, then my original PR (linked above) shouldn't have been closed in the first place. It could've been linked to multiple issues, re-worded and reviewed with more fixes.

rishacha avatar Aug 17 '22 18:08 rishacha