-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 display of internal circuits for IfElseOps and WhileLoopOps to mpl circuit drawer #10170
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…erra into pre_control_flow_mpl
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 5258853096
💛 - Coveralls |
enavarro51
changed the title
[WIP] Add display of internal circuits for IfElseOps to mpl circuit drawer
Add display of internal circuits for IfElseOps to mpl circuit drawer
May 29, 2023
enavarro51
changed the title
Add display of internal circuits for IfElseOps to mpl circuit drawer
Add display of internal circuits for IfElseOps and WhileLoopOps to mpl circuit drawer
Jun 2, 2023
…rra into display_mpl_if_else
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds display of the circuits inside
IfElseOps
to thempl
circuit drawerDetails and comments
UPDATED: Now boxes properly fold onto the next line and no longer a WIP.
UPDATE 2: Added WhileLoopOps
This PR is intended to be merged after #10096. It should accomplish the following
IfElseOp
s should display EXACTLY as they do in main.IfElseOp
or throughqc.if_test
all if-else should display with a box with the if and else circuits inside.Testers Wanted!
Since the circuits inside the if-else can be very large and complex, it's difficult to test all the scenarios. If you have a qiskit-terra development environment on your local system, just create a new branch out of main, and copy
visualization/circuit/utils.py
andvisualization/circuit/matplotlib.py
into the branch. Things to test,if_test
examples with and withoutelse
and using different kinds and complexities of circuits.fold=-1
to the draw command initially to test 2. This will do no folding.fold
to a small number and see that the circuits properly wrap.To do
Futures
switch
,for
, andwhile
control flow ops.Using fold=7, the above circuit looks like this,
Directly instantiating the
IfElseOp
instead of usingif_test
also works.