Skip to content

Conversation

@jackraymond
Copy link
Contributor

Expand the embedding example.

Add example for anneal_offset and flux_biases shimming in multi-color annealing context.

This pull request replaces #29

Copy link
Member

@randomir randomir left a 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},
Copy link
Member

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:
Copy link
Member

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):

Suggested change
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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):
Copy link
Member

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.
Copy link
Member

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:
Copy link
Member

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
Copy link
Member

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:
Copy link
Member

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)
Copy link
Member

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants