-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update qsphere plots to show state labels and phases #4384
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely makes the q sphere easier to understand - thanks! There are a couple of things I think need adjusting but looks good.
Radians should be default. This is what is used everywhere else in qiskit. |
Default is now radians |
CI passed here: https://github.com/Qiskit/qiskit-terra/runs/668101667 the checks api looks like it just got stuck. Going to merge this |
I wasn't able to use these 2 parameters on the Qiskit version that is loaded on the IBM Q Experience: |
Is this feature included in the latest 0.19.6 version? I am not able to use it. |
@HuangJunye This change has not been included in a terra release yet. Qiskit 0.19.6 has terra 0.14.2 which does not have this PR. This will be included in the next release 0.15.0 |
@mtrrinish Thanks for the reply! Can’t wait to get this feature. It’s so handy for my presentations! I’ll use the unstable version for now :) |
Theplot_state_qsphere visualization currently shows quantum states without state labels and phase angles. This makes things difficult to interpret when many basis states are being visualized, especially in the case of multiple qubits. This PR does three things: -- Adds basis state labels to each blob by default. Can be disabled using argument show_state_labels -- Adds a show_state_phases argument to enable showing phases next to each basis state -- Adds a use_degrees argument which allows switching to degrees when desired * update qsphere plots to show state labels and phases, switch to degrees * remove whitespace for style and lint tests, add docstrings * add use_degrees and fix 180 degrees overlap with phase circle * changed default to radians * remove stray print, clean up code, default radians * add release note * remove prelude section from release notes Co-authored-by: Jay Gambetta <jay.gambetta@us.ibm.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Hi @mtreinish, I just read that the mentioned changes are already included. Please could you confirm it? Many thanks |
Hi @pifparfait -- the meta package isn't done yet, but the subpackages are. So you probably want to do |
@aasfaw got it!!! many thanks!! |
Hi @pragyakatyayan -- I wrote the PR thinking that the state labels are only shown for states that have non-zero weight. Otherwise, if you show them all the time, then you might end up in situations where the image gets very crowded for many qubits. One option to do what you want is to open a new PR with a new argument to |
Thanks @aasfaw, I am on it. The only doubt left is that in the snapshot I submitted shows the label and phase for state |11>, which had zero weight. The experiment I was doing was aimed at getting |01> and |10> with 50% probabilities each, so both |00> and |11> had zero weights. Hence, I got confused when label/phase representation was visible for |11> but not for |00>. I'll dive into it a little deeper, may be I find what led to this particular case. |
Summary
The
plot_state_qsphere
visualization currently shows quantum states without state labels and phase angles. This makes things difficult to interpret when many basis states are being visualized, especially in the case of multiple qubits. This PR does three things:-- Adds basis state labels to each blob by default. Can be disabled using argument
show_state_labels
-- Adds a
show_state_phases
argument to enable showing phases next to each basis state-- Adds a
use_degrees
argument which allows switching to degrees when desiredDetails and comments
Previous:
This PR:
show_state_phases = True
show_state_phases = True, use_degrees = True