-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add a projector observable to QiskitDevice #137
Add a projector observable to QiskitDevice #137
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 @wongwsvincent 🙂
This looks great, and likely doesn't need a unit test (unlike the Cirq device) since there is no new logic here.
I do have one question though, how come you added docstrings to some of the inherited methods? Not having docstrings here was intentional, since Sphinx will instead insert the docstrings from the parent class. This reduces the maintainability overhead :)
@@ -102,7 +102,7 @@ class QiskitDevice(QubitDevice, abc.ABC): | |||
that support returning the underlying quantum statevector""" | |||
|
|||
operations = set(_operation_map.keys()) | |||
observables = {"PauliX", "PauliY", "PauliZ", "Identity", "Hadamard", "Hermitian"} | |||
observables = {"PauliX", "PauliY", "PauliZ", "Identity", "Hadamard", "Hermitian", "Projector"} |
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.
💪
Codecov Report
@@ Coverage Diff @@
## master #137 +/- ##
=======================================
Coverage 99.29% 99.29%
=======================================
Files 7 7
Lines 284 284
=======================================
Hits 282 282
Misses 2 2
Continue to review full report at Codecov.
|
Co-authored-by: Josh Izaac <[email protected]>
@josh146 , I added docstrings here because I saw CodeFactor in the github workflow was complaining about not having docstrings under the functions. I'm not sure why the docstrings weren't inherited from the parent class, and I'm not familiar enough with Sphinx to understand why. The flagged issues can be found here. Could you give me a bit of help here? |
Thanks for flagging this @wongwsvincent --- it appears that Codefactor is incorrect here, and these particular methods do not need docstrings. Feel free to remove them, even if codefactor complains about the missing docstrings, I will be able to overwrite those :) |
Thanks for clarifying, @josh146 ! I have removed the docstrings. |
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 @wongwsvincent! Good to go now 💯
Context:
Adding a projector observable to QiskitDevice.
Description of the Change:
Adding
Projector
to the list of observables compatible with QiskitDevice inqiskit_device.py
.Related GitHub PR:
Work coherently with PR #1356