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

test plot_state_hinton #3090

Closed
1ucian0 opened this issue Sep 10, 2019 · 4 comments
Closed

test plot_state_hinton #3090

1ucian0 opened this issue Sep 10, 2019 · 4 comments
Labels
good first issue Good for newcomers

Comments

@1ucian0
Copy link
Member

1ucian0 commented Sep 10, 2019

We dont have a test for plot_state_hinton in qiskit/visualization/state_visualization.py

@1ucian0 1ucian0 added the on hold Can not fix yet label Sep 10, 2019
@1ucian0
Copy link
Member Author

1ucian0 commented Sep 10, 2019

on hold until #2968

@1ucian0 1ucian0 removed the on hold Can not fix yet label Aug 31, 2020
@1ucian0 1ucian0 added the good first issue Good for newcomers label Sep 19, 2021
@SimoneGasperini
Copy link
Contributor

Hi @1ucian0! I would like to start contributing to Qiskit and this looks like a good first issue to begin with.

I read the contributions guidelines for testing visualization and I'm able to run the notebook test/ipynb/mpl_tester.ipynb in Binder. All the shown tests run successfuly, in particular I see the following result for tests about the Graph Matplotlib Drawer.
mlp_tests
However, not all the tests in test_graph_matplotlib_drawer.py seem to be considered here and I don't understand why. For instance, the test for the function plot_state_hinton is included in the file (lines 117-127):

def test_plot_state_hinton(self):
    """test plot_state_hinton"""
    circuit = QuantumCircuit(1)
    circuit.x(0)

    # getting the state using backend
    backend = BasicAer.get_backend("statevector_simulator")
    result = execute(circuit, backend).result()
    state = result.get_statevector(circuit)

    self.graph_state_drawer(state=state, output="hinton", filename="hinton.png")

but it does not appear in the notebook result as you can see in the image above. The same happens for all the tests which rely on the state_drawer function imported from qiskit.visualization.state_visualization. In the other 14 cases (related to plot_histogram or plot_gate_map or plot_coupling_map), the test are collected correctly and the results are shown in the notebook. Can you please help me figuring things out?

@smturro2
Copy link
Contributor

smturro2 commented Apr 6, 2022

Hi @1ucian0 I'm looking to tackle adding these tests in the MPL drawer, from what I see plot_state_hinton is already being tested and I can see it in the binder.
image
Were there specific additional tests you wanted?

@1ucian0
Copy link
Member Author

1ucian0 commented Jun 29, 2022

Thanks everyone for the heads up!

Indeed, this is already checked by snapshot testing. The next step is to add the snapshot tests as part of the CI/coverage, in the #6427 direction.

@1ucian0 1ucian0 closed this as completed Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: Done
Development

No branches or pull requests

3 participants