-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add Wigner Function Functionality and Documentation. #132
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
Conversation
Add wigner functions
@diego-plan9 Just a quick check - have we done everything we were supposed to please? |
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! |
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.
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
andtomography.py
respectively. wigner_function
should be renamed toplot_wigner_function
and the orignalplot_wigner_function
should be renamed toplot_wigner_data
- Once moving the
plot_wigner_function
to the vizualization module you can add an option to theplot_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): |
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'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 |
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.
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: |
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.
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: |
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'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 |
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 these functions should be moved into the tomography.py module rather than being in their own module
@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? |
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.
Looks good to me! @diego-plan9
Great thank you!
Please can we also add Todd Tilma to the author list on the readme? Does this need a new pull request?
…Sent from my iPhone
On 10 Nov 2017, at 23:44, Christopher Wood <notifications@github.com<mailto:notifications@github.com>> wrote:
@chriseclectic approved this pull request.
Looks good to me! @diego-plan9<https://github.com/diego-plan9>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#132 (review)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ARe0Y9x1IhhSFoNh43NDtgJl7PCkGsrmks5s1N_LgaJpZM4QHFTy>.
|
It's looking good to me as well - thanks @markjeveritt for the contribution, and @chriseclectic for the review! |
* Add note about working with multiple repositories * Update multiple repository instructions * Fix install.rst
* 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
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
Checklist: