-
Notifications
You must be signed in to change notification settings - Fork 121
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
feature: update circuit drawing #846
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #846 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 129 132 +3
Lines 8618 8814 +196
Branches 1928 1987 +59
==========================================
+ Hits 8618 8814 +196 ☔ 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.
Looks like the wrong character is being used. On mobile it shows up as ⏺️. I believe ● is the correct character.
Was using U+25CB and U+25CF. I could find the large white circle (U+25EF) but not the black one. Eventually, I switch to the character you pasted in your comment and U+25EF, but I still could not find the unicode number for the large black circle.
src/braket/circuits/text_diagram_builders/ascii_circuit_diagram.py
Outdated
Show resolved
Hide resolved
src/braket/circuits/text_diagram_builders/text_circuit_diagram.py
Outdated
Show resolved
Hide resolved
src/braket/circuits/text_diagram_builders/unicode_circuit_diagram.py
Outdated
Show resolved
Hide resolved
""" | ||
top = "" | ||
bottom = "" | ||
if symbol in ["C", "N", "SWAP"]: |
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'm not crazy about hard-coding these (again?)... couldn't we just have put in the correct symbol on line 131? For SWAP, why are we not just changing the symbol in the class, rather than here?
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'm concerned that gates like Cnot have harcoded ascii_symbol = ["C", "X"]
that will be passed through L124. If we want to keep AsciiCircuitDiagram and UnicodeCircuitDiagram living together, I believe it is easier to transform control qubit symbols as late as possible.
I think it is also better to transform SWAP later than earlier. If we change the ascii_symbol, we will need an exception in _draw_symbol
because we should avoid boxing the symbol x (which will look like an x gate then).
Issue #, if available:
N
,C
characters are not conventional to denote (neg)controlled qubits.Circuits can also look nicer by using box drawing characters.
Description of changes:
Testing done:
updated unit tests.
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.