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

#8202 plot_bloch_vector optional parameter & allowing initialize state in visualize_transition & minor issue #8211

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

poig
Copy link
Contributor

@poig poig commented Jun 21, 2022

Summary

Closes #8202
adding optional argument allowed for matplotlib.patches.FancyArrowPatch to plot_bloch_vector
Closes #8194
document qiskit.extensions.StatePreparation to qiskit.circuit.library.data_preparation.StatePreparation
Closes #8206
allowing initialize state in visualize_transition.

from qiskit import QuantumCircuit
import numpy as np
from qiskit.visualization import plot_bloch_multivector, visualize_transition
from qiskit.quantum_info import Statevector, random_statevector
ran_sv = random_statevector(2)
qc = QuantumCircuit(1)
qc.initialize(ran_sv.data,0)
qc.h(0)
qc.x(0)
qc.ry(np.pi/2,0)
display(qc.draw('mpl'))

image
plot_bloch_multivector(qc,ls="dotted")
image
visualize_transition(qc,trace=True)
image

Details and comments

not sure if doing everything correctly
do visualize_transition need a test?

@qiskit-bot
Copy link
Collaborator

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.

@poig poig requested review from a team, nonhermitian and nkanazawa1989 as code owners June 21, 2022 02:27
@poig poig changed the title #8202 plot_bloch_vector optional parameter #8202 plot_bloch_vector optional parameter & minor documentation issue Jun 21, 2022
@poig poig changed the title #8202 plot_bloch_vector optional parameter & minor documentation issue #8202 plot_bloch_vector optional parameter & minor issue Jun 21, 2022
@coveralls
Copy link

coveralls commented Jun 21, 2022

Pull Request Test Coverage Report for Build 2533203377

  • 10 of 24 (41.67%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.01%) to 84.267%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/visualization/bloch.py 7 8 87.5%
qiskit/visualization/transition_visualization.py 0 13 0.0%
Files with Coverage Reduction New Missed Lines %
qiskit/visualization/transition_visualization.py 1 10.95%
Totals Coverage Status
Change from base Build 2529092568: -0.01%
Covered Lines: 54898
Relevant Lines: 65148

💛 - Coveralls

@HuangJunye HuangJunye added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jun 21, 2022
@poig poig changed the title #8202 plot_bloch_vector optional parameter & minor issue #8202 plot_bloch_vector optional parameter & allowing initialize state in visualize_transition & minor issue Jun 23, 2022
@javabster
Copy link
Contributor

Hi @poig thanks for your contribution and sorry for the slow review on this PR, I think because it is attempting to address a few different issues it fell through the cracks and it probably would have been better to split this into 2 PRs (one for the documentation fix and another for the visualisation feature).

Generally this is looking good, but to move forward I think the visualize_transition piece should be removed from this PR, as the visualise_transition() function is likely to be removed at some point (see #9355)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Contributor MIA
5 participants