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
Testing mpl images for graphs #6672
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.
Thanks for the work so far @singhmeet11! I've left a few comments 😄
test/ipynb/mpl_results_graph.py
Outdated
@@ -0,0 +1,200 @@ | |||
# This code is part of Qiskit. |
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.
I'm confused about why a whole new file was created for this? There is a lot of duplicated code here, I think it would be better to try integrate the graph results into the existing mpl_results.py
file if possible
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.
@javabster I tried to actually use only one file results.py
but because I am creating two files inside the mpl
folder( circuit
and graph
) and the path to specific folders inside these have to be provided in order for the file to work properly, I was not able to integrate the whole code into one file.
How about I remove the folders graph
and circuit
and store all the data in the same .json
file and same references
folder(like there won't be any different references and .py files for graph and circuit images). Then only one file will be able to do all the work.
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.
I think it can be worked into one file using the specific file names required, I will push a commit shortly to show you what I mean 😄
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.
Ok I've pushed some changes and it looks like it works now with just the original results.py
so this file can be deleted
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.
Yeah, thanks I was kinda stuck there.
@javabster sorry I forgot to add the link to this PR and I will look into the comments that you have posted in a day or two. Thanks |
@javabster So I have successfully added the tests for
So basically the environment that binder is running needs seaborn (I actually used pip to install it and the .ipynb file runs fine) But I don't think adding pip install in the mpl_circuit file will look clean so where do I add the pip install command for seaborn? The other problem- I also added a test for |
@javabster I have added tests for the 6 main plots, |
@singhmeet11 This looks nice. I like the white space separator between the circuit images and the visualizations. And I'd agree you're not trying to catch simulator problems, just the visuals. |
@javabster The tests run fine too now. Yayy |
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 is great work thanks @singhmeet11! Just one tiny addition, otherwise lgtm 🚀
Co-authored-by: Abby Mitchell <abby.s.mitchell@gmail.com>
@javabster Thanks! I think this is ready to be merged now. Wait, what does dismissing stale review mean ?? |
it just means that the commit you pushed mean my previous comment was outdated. Nothing to worry about 😄 |
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 is great! Thanks!
Summary
As of now there is no testing module for graph images. This issue will be resolved by this PR and is motivated from issue #6397.
Details and comments
List of changes and additions for creating the tests for graphs.
filename
. Made changes inqiskit/visualization/state_visualization.py
so that we can save.png
usingstate_drawer
. (This has only been implemented forplot_bloch_multivector
for now).Graphs
andCircuit
inqiskit-terra\test\ipynb\mpl
. These house the reference images along with thetesting.py
files. Made this for clarification and because this resolved an issue I was facing withresults.py
andmpl_results_graph.py
.mpl_results_graph.py
is identical toresults.py
with a few modifications for the file names.test_graph_matplotlib_drawer.py
works similar totest_circuit_matplotlib_drawer.py
. Originally I changed it a bit, but with the modifications tostate_visualization.py
this works properly.The test works properly when run via Binder -
The added test for
plot_bloch_multivector
can be seen above