Skip to content

Conversation

markjeveritt
Copy link
Contributor

@markjeveritt markjeveritt commented Oct 26, 2017

Removed duplicate files as suggested by @diego-plan9.

Description

Please see the examples/jupyter/ notebook for description of added functionality.

Motivation and Context

How Has This Been Tested?

By old fashion testing code example (not unit testing as we are still not confident with this technique in python)

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • [] I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@markjeveritt
Copy link
Contributor Author

@diego-plan9 Just a quick check - have we done everything we were supposed to please?

@diego-plan9
Copy link
Member

Thanks for the contribution, @markjeveritt ! The new changes seems indeed on the right track, but hopefully Chris will be able to review it more in depth and provide feedback eventually - thanks for your patience in the meantime!

Copy link
Member

@chriseclectic chriseclectic left a comment

Choose a reason for hiding this comment

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

Hi Mark,

Thanks for resubmitting, this looks great and the changes I have requested are mostly organisational.

In summary:

  • The example notebook / figures shouldn't go here, but rather in the qiskit-tutorials repository where they will have greater visibility.
  • Rather than have these two modules being separate I think its more natural to put them in the existing modules visualization.py and tomography.py respectively.
  • wigner_function should be renamed to plot_wigner_function and the orignal plot_wigner_function should be renamed to plot_wigner_data
  • Once moving the plot_wigner_function to the vizualization module you can add an option to the plot_state function to plot the wigner function with
...
elif method="wigner":
    plot_wigner_state(rho)
...

With regards to putting them in the existing modules, your module introduction string (and in particular the references) should be moved into the relevant function doc strings.

In your example notebook you can then update it rather than importing the full modules to just import the functions you will be using. Eg

from qiskit.tools.visualization import plot_wigner function
```

from mpl_toolkits.mplot3d import Axes3D


def wigner_function(rho, res=100):
Copy link
Member

@chriseclectic chriseclectic Nov 9, 2017

Choose a reason for hiding this comment

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

I'd suggest changing rho to state here as it can be a vector or density matrix.
In addition this function breaks if the input is a list. This can be fixed by adding

def wigner_function(state, res=100):
    ## ....
    state = np.array(state)
    if state.ndim == 1:
        state = np.outer(state, state)

@@ -0,0 +1,264 @@
"""

Wigner Function Visualization Module
Copy link
Member

Choose a reason for hiding this comment

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

These functions should be moved inside the visualization.py module rather than be seperate.

I also think it makes more sense to rename the wigner_function function to plot_wigner_function, and to rename what you've called plot_wigner_function to plot_wigner_data since it plots the output from the wigner_data function in the tomography module.

- A single point in phase space
- An NxN array plotted as a plaquette

References:
Copy link
Member

Choose a reason for hiding this comment

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

You can move these reference into the function description for plot_wigner_function and/or wigner_function when moving into the visualization.py module

Plots Wigner results in appropriate format

Args:
wigner_results:
Copy link
Member

Choose a reason for hiding this comment

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

I'd change wigner_results to wigner_data and mention in the description that this is the output returned from the wigner_data` function.

@@ -0,0 +1,114 @@
"""

Wigner Function Tomography Module
Copy link
Member

Choose a reason for hiding this comment

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

I think these functions should be moved into the tomography.py module rather than being in their own module

@markjeveritt
Copy link
Contributor Author

@chriseclectic we think we have addressed all the changes you requested. There is a new pull request in the tutorial for the Jupiter notebook and we have edited the content in this repo as detailed above. Have we missed anything please?

Copy link
Member

@chriseclectic chriseclectic 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 to me! @diego-plan9

@markjeveritt
Copy link
Contributor Author

markjeveritt commented Nov 11, 2017 via email

@diego-plan9
Copy link
Member

It's looking good to me as well - thanks @markjeveritt for the contribution, and @chriseclectic for the review!

@diego-plan9 diego-plan9 merged commit a0205ce into Qiskit:master Nov 13, 2017
taalexander pushed a commit to taalexander/qiskit-terra that referenced this pull request May 2, 2019
* Add note about working with multiple repositories

* Update multiple repository instructions

* Fix install.rst
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
* Add wigner functionw

* Adding new wigner function files

* Delete exampleCircuit.png

* Delete wigner_function_tomography.py

* Delete wigner_function_visualisation.py

* Delete wigner_functions.ipynb

* Delete blochSphere.png

* Update wigner_functions.ipynb

* files deleted and merged as requested. Jupyter Notebook will be moved to QISKIT/qiskit-tutorial

* two other image files deleted

* updated visualization.py to include Wigner fucntion code

* added author names due to Wigner function capability

* Update README.md

* alphabetically ordered Authors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants