Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

add quantum volume plotter for individual trials #489

Merged
merged 29 commits into from
Sep 30, 2020
Merged

add quantum volume plotter for individual trials #489

merged 29 commits into from
Sep 30, 2020

Conversation

HuangJunye
Copy link
Contributor

Summary

Add quantum volume plotter for individual trials

Details and comments

Fixes #224 :

  1. add plot_qv_trial() method for plotting individual trails leveraging on plot_histogram() from Terra
  2. ideal and exp values are plotted in an overlapping way as suggested in Volume plotter for individual trials #224
  3. shows experimental heavy output probability on the legend
  4. plots median probability dashed line
  5. use figsize kwarg to control figure size. It's useful for showing results for larger QV circuits.

Examples:

qv_fitter.plot_qv_trial(depth=4, trial_index=0, figsize=(7,5))

plot_qv_trial

qv_fitter.plot_qv_trial(depth=6, trial_index=0, figsize=(20,10))

plot_qv_trial_large

@HuangJunye
Copy link
Contributor Author

Suggest reviewer: @dcmckayibm

@HuangJunye
Copy link
Contributor Author

@ShellyGarion The errors are similar to other PRs that I submitted: No module named 'qiskit.circuit.library.template_circuits'. I assume this is due to some bugs in Terra. Is this resolved? Can I re-run tests without adding new commits?

@mtreinish
Copy link
Collaborator

@ShellyGarion The errors are similar to other PRs that I submitted: No module named 'qiskit.circuit.library.template_circuits'. I assume this is due to some bugs in Terra. Is this resolved? Can I re-run tests without adding new commits?

This was caused by: Qiskit/qiskit#5058 which has been fixed. You just need to push the update branch (which is a requirement prior to merging anyway) and that will trigger a new ci run. I've done that here so that should resolve that issue.

Copy link
Collaborator

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a release note for this new plotter function. See: https://github.com/Qiskit/qiskit-ignis/blob/master/CONTRIBUTING.md#release-notes for more details.

@HuangJunye
Copy link
Contributor Author

@mtreinish Thanks for fixing the Terra error. Release note is added.

Copy link
Contributor

@ShellyGarion ShellyGarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a small misprint

---
features:
- |
Add :meth:`qiskit.ignis.verification.quantum_volume.QVFitter.plot_qv_trial` for plotting individual trails leveraging on :meth:`qiskit.visualization.plot_histogram` from Qiskit Terra.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor misprint: trails --> trials

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you!

ShellyGarion
ShellyGarion previously approved these changes Sep 17, 2020
dcmckayibm
dcmckayibm previously approved these changes Sep 18, 2020
@HuangJunye
Copy link
Contributor Author

Thanks for the approval! @dcmckayibm and @ShellyGarion

ax1.legend()
ax1.set_title(f'Quantum Volume {2**depth}, Trial #{trial_index}', fontsize=14)

plt.close(fig) # close additional figure
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated in the same way as in #495 and #493

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed that. I have made the changes.

@chriseclectic
Copy link
Collaborator

@HuangJunye this has some conflicts from the other PRs that need fixing

@HuangJunye
Copy link
Contributor Author

@HuangJunye this has some conflicts from the other PRs that need fixing

I fixed the conflicts. Please let me know if it is still not able to merge.

mtreinish
mtreinish previously approved these changes Sep 28, 2020
ax1.set_title(f'Quantum Volume {2**depth}, Trial #{trial_index}', fontsize=14)

# Only close mpl figures in jupyter with inline backends
if fig:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this if fig is necessary since we always set it to a Figure object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. I copied this code from plot_histogram and over there fig = None if ax is provided, but this is not the case here. Shall I change it? https://github.com/Qiskit/qiskit-terra/blob/eb73c4a79704ca4ad2da1600f7f1220dadcfb842/qiskit/visualization/counts_visualization.py#L128

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HuangJunye if its not needed here I say change it, then this looks ready to merge!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chriseclectic I have made the changes and all checks have passed. I think it's ready to merge!

@chriseclectic chriseclectic merged commit 30e3511 into qiskit-community:master Sep 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Volume plotter for individual trials
5 participants