-
Notifications
You must be signed in to change notification settings - Fork 18
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
Include ability to plot all decoding objects in one QEC round + misc. improvements #23
Conversation
- Add function "draw_mwpm_decoding" to viz.py, which, in one go, plots the stabilizer graph, matching graph, and the syndrome. - Add a draw option to "correct" in decoder.py that calls on draw_mwpm_decoding. - Simplify the decoding example considerably thanks to the previous changes. This also allows the user to plot the decoding objects that correspond to a given round of error correction rather than a separate one, assisting with debugging.
Codecov Report
@@ Coverage Diff @@
## main #23 +/- ##
==========================================
- Coverage 95.70% 95.63% -0.07%
==========================================
Files 32 32
Lines 1815 1811 -4
==========================================
- Hits 1737 1732 -5
- Misses 78 79 +1
Continue to review full report at Codecov.
|
- Change label cubes drawing argument to label stabilizers - Add label edges argument to draw_mwpm_decoding for allowing user to turn off edge weight labels - Allow user to turn off node labels on decoding graphs depending on label_stabilizers and label_boundary drawing arguments supplied to draw_mwpm_decoding
If the matching graph is not a networkx graph and yet user wants to draw it, first convert to a networkx graph
Before they were not displaying properly, since the node labels dictionary had tuples (x, y, z) for the boundary points, whereas in the matching graph they are of the form ((x, y, z), i), where i indicated the excitation number
…into decoding-plot
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 @ilan-tz! This contribution indeed simplifies the code for the decoding example. Just left some simple questions, other than that this looks good from my side. We'll wait for other reviewers comments.
One thing we can improve after merging is having all functions and methods that plot something return the figure and axis. This can be taken care of on PR #20 if we merge this one first.
We should try to ideally improve the slightly-reduced codecov score before merging this into the main (this is due to poorly-tested |
Context for changes
draw_mwpm_decoding
in theviz
module.draw
anddrawing_opts
argument to thecorrect
function in thedecoder
module.label_cubes
drawing argument insyndrome_plot
tolabel_stabilizers
.Example usage and tests
See the
decoding.py
example, e.g.(New part is the last two arguments).
Performance results justifying changes
Workflow actions and tests
Expected benefits and drawbacks
Expected benefits:
correct
function, which saves time and considerably simplifies thedecoding.py
example.draw
method of MatchingGraph is called (such a problem had already been resolved for stabilizer graphs).Possible drawbacks:
viz.py
file so as not to crowd the rest of the code and to avoid having to import plotting tools unnecessarily. These changes add amatplotlib
import statement and calls toviz
functions insidecorrect
, which negates some of the benefit of completely separating decoding and plotting. However, matplotlib is only imported if the draw argument is set to True, and nothing else happens incorrect
other than a one-line function call.draw_mwpm_decoding
. For example, settings to the stabilizer and matching graph drawings are the same.label_stabilizers
orlabel_boundary
to True in the drawing options individually turn on/off the stabilizer or boundary labels for the syndrome plot, but turn both of them on/off of the stabilizer and matching graphs.Related Github issues
Checklist and integration statements
black
,docformatter
andpylint
configurations.A
level. I also confirm that I have already merged other branches into this branch as required.README.md
as needed.CHANGELOG.md
following the template. I recognize that the developers may revisitCHANGELOG.md
and the versioning, and create a Special Release including my changes.