-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/example expansion: anneal_offset and embedding examples #31
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
base: main
Are you sure you want to change the base?
Feature/example expansion: anneal_offset and embedding examples #31
Conversation
randomir
left a comment
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.
The embedding example is in a decent shape, but the shimming one doesn't run currently, and some clean-up is required. Also, please add release notes.
| solver: dict | str | None = None, | ||
| detector_line: int = 0, | ||
| source_line: int = 3, | ||
| biclique_target_lines: set = {0, 3}, |
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.
Avoid mutable default values, even in examples.
| } | ||
|
|
||
| def loop_pos(n, n_range): | ||
| if type(n) is tuple: |
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.
Less strict (allows tuple subclasses):
| if type(n) is tuple: | |
| if isinstance(n, tuple): |
| draw_parallel_embeddings(T, embeddings=[emb], S=S, node_color=node_color) | ||
|
|
||
| print( | ||
| "Identify nodes that are each attached to atleast one source and one" |
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.
| "Identify nodes that are each attached to atleast one source and one" | |
| "Identify nodes that are each attached to at least one source and one" |
| m = 8 | ||
| print( | ||
| "Embed a K_{m,m} on two lines, with detectors on the other four lines." | ||
| f"m={m} for this example." |
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.
| f"m={m} for this example." | |
| f" m={m} for this example." |
| target_graph = nx.from_edgelist([(i, j) for i in range(m) for j in range(m, 2 * m)]) | ||
| S, Snode_to_td = make_tds_graph(target_graph, sourced_nodes=[]) # No source nodes. | ||
|
|
||
| def T_line_assignments(n: int): |
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.
Best to avoid function redefinition in the same scope (for clarity/readability).
| solver: Name of the solver, or dictionary of characteristics. | ||
| line_detector: The integer index of the detector line. | ||
| line_source: The integer index of the source line. | ||
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.
Missing a few args here.
| print('A variety of plots are shown to demonstrate heuristic correction of ' | ||
| 'flux_biases on detectors, and target qubit frequency ' | ||
| 'desynchronization, from small amounts of data. ') | ||
| if args.delay_max_fit is None: |
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.
args undefined.
| import argparse | ||
|
|
||
| import pickle | ||
| import pandas as pd |
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.
Should add pandas to examples/requirements.txt.
| qpu_parameters["x_schedule_delays"][ | ||
| line_detector | ||
| ] = 0.1 # Documented limit. | ||
| with open("DebugForBrendand.pkl", "wb") as f: |
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.
?
| if use_cache: | ||
| os.makedirs(os.path.dirname(fn_cache), exist_ok=True) | ||
| with open(fn_cache, "wb") as f: | ||
| pickle.dump((flux_biases, flux_history, mag_history), f) |
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.
File system side-effects should be documents. Maybe even provide a flag to turn them off (or default to off).
Expand the embedding example.
Add example for anneal_offset and flux_biases shimming in multi-color annealing context.
This pull request replaces #29