-
Notifications
You must be signed in to change notification settings - Fork 604
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
Adding new feature wire_options to draw_mpl function #6486
Conversation
Dear @dwierichs, I made necessary changes here for the test cases, documentation, and source code. However, I am not so familiar with the format check here. Sorry maybe I need some additional help on it. |
Hi @zazabap, |
Thanks a lot for the help! I have reformatted the modified files and commit again, I think now it is ready for review. I resolved all the format check and unit test today @dwierichs . |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6486 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 455 455
Lines 43193 43232 +39
=======================================
+ Hits 42909 42948 +39
Misses 284 284 ☔ View full report in Codecov by Sentry. |
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.
Amazing addition @zazabap !
Looking forward to getting this feature in! 💯
I had some comments, in particular the documentation update should be moved to the docstrings of the respective functions, and the criterion with which we determine whether something is a per-wire option needs to be modified.
Thanks again, and let me know any questions you might have!
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Co-authored-by: David Wierichs <[email protected]>
Dear @dwierichs , I think now everything is updated and ready to merge. Please let me know if there are further questions or requests. |
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.
@zazabap Thanks for the stamina with this contribution! 🎉
I will request a second review internally and then we can go ahead and merge :)
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.
Some minor comments
Co-authored-by: Astral Cai <[email protected]>
Co-authored-by: Astral Cai <[email protected]>
This reverts commit 27ac0d2.
This reverts commit 373f217.
Hi @zazabap |
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.
Thank you for your contribution!
**Context:** On the level of mid-scale algorithms, it might be nice to differentiate between different "types" of wires, for example by coloring them differently, or giving them distinct line styles. As an example, in PennyLaneAI/qml#1185 on preparing matrix product states, there are auxiliary bond qubits and physical qubits, and coloring them differently would be a neat thing to do. **Description of the Change:** Update the output wire_options that could change the line style and color for circuit output. ```python @qml.qnode(qml.device("default.qubit")) def node(x): for w in range(5): qml.Hadamard(w) return qml.expval(qml.PauliZ(0) @ qml.PauliY(1)) # Make all wires cyan and bold, # except for wires 2 and 6, which are dashed and another color wire_options = {"color": "cyan", "linewidth": 5, 2: {"linestyle": "--", "color": "red"}, 6: {"linestyle": "--", "color": "orange"} } _,ax = qml.draw_mpl(node, wire_options=wire_options)(0.52) ``` **Benefits:** When complicated sates and quantum circuits diagram are created, wires could be marked with different selections. **Possible Drawbacks:** N/A **Related GitHub Issues:** #6165 --------- Co-authored-by: David Wierichs <[email protected]> Co-authored-by: ringo-but-quantum <> Co-authored-by: Astral Cai <[email protected]> Co-authored-by: Christina Lee <[email protected]>
Context:
On the level of mid-scale algorithms, it might be nice to differentiate between different "types" of wires, for example by coloring them differently, or giving them distinct line styles. As an example, in PennyLaneAI/qml#1185 on preparing matrix product states, there are auxiliary bond qubits and physical qubits, and coloring them differently would be a neat thing to do.
Description of the Change:
Update the output wire_options that could change the line style and color for circuit output.
Benefits:
When complicated sates and quantum circuits diagram are created, wires could be marked with different selections.
Possible Drawbacks:
N/A
Related GitHub Issues:
#6165