-
Notifications
You must be signed in to change notification settings - Fork 575
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 active wire notches to matplotlib drawings #1954
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #1954 +/- ##
==========================================
+ Coverage 96.86% 98.80% +1.94%
==========================================
Files 225 225
Lines 17123 17144 +21
==========================================
+ Hits 16586 16939 +353
+ Misses 537 205 -332
Continue to review full report at Codecov.
|
def test_decimals(): | ||
"""Test decimals changes operation labelling""" | ||
def test_decimals(self): | ||
"""Test decimals changes operation labelling""" | ||
|
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.
From this test I understand that if I have RX(2)
, in the final drawing I should see RX(2)
, however, when I run it I only see RX
.
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.
(Just a question, I didn't want to modify the code.)
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.
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.
From the documentation:
decimals (int): How many decimal points to include when formatting operation parameters.
Default ``None`` will omit parameters from operation labels.
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.
Ah ok, I was waiting by default to see it, but you're right 👍🙂
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 love the way it looks! 😍I just left a small comment to make sure.
I think it's very cool! 🚀
[sc-12054] |
Currently for multiwire gates,
qml.drawer.MPLDrawer
draws a box covering everything from the minimum wire to the maximum wire. This makes it impossible to tell which gates are actually used by the gate and which ones just happen to be placed between active wires.This PR adds fancy boxes (rounded edges) at the edge of the gate box on the active wires. If all the "covered" wires are active, then no notches are drawn. Notches on active wires are only drawn if inactive wires exist.
It can be turned off via the keyword argument
active_wire_notches = False
toqml.draw_mpl
,qml.drawer.tape_mpl
, andqml.drawer.MPLDrawer.box_gate
.