Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.26k stars 2.37k forks source link

plot_bloch_vector(coords = 'spherical') modifies input coordinate list after function call #9965

Open mrvee-qC-bee opened 1 year ago

mrvee-qC-bee commented 1 year ago

Environment

What is happening?

plot_bloch_vector(coords = 'spherical') modifies input coordinate list to spherical after function call when specifying coords = 'spherical'. This behaviour may not be desirable or atleast is not documented anywhere

image (67)

How can we reproduce the issue?

from qiskit.visualization import plot_bloch_vector

coords = [1, 1, 1]
print("Before plot_bloch_vector()", coords)

# Print and plot results
plot_bloch_vector(coords, coord_type="spherical")

print("After plot_bloch_vector()", coords)

What should happen?

There should be no change in input coordinate list irrespective of mode or at least the behaviour should be documented if it was desired

Any suggestions?

Culprit seems to be around here:

https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/visualization/state_visualization.py#L241-L245

Shoutout to @vabarbosa for catching the lines above^

Ak-ash22 commented 1 year ago

Hello!... I am new to the contributing community here. Is this issue still available to work on?

jakelishman commented 1 year ago

@Ak-ash22: in this case, the author has put in a PR themselves (#9966). If you're looking for issues to contribute to, have a look at the "good first issues" tag for some places that might be unassigned.