Skip to content

Commit

Permalink
Merge pull request #468 from sandialabs/feature-irb
Browse files Browse the repository at this point in the history
Interleaved RB
  • Loading branch information
sserita authored Jul 25, 2024
2 parents 6a708e5 + dc99aba commit 722053c
Show file tree
Hide file tree
Showing 6 changed files with 759 additions and 188 deletions.
280 changes: 229 additions & 51 deletions jupyter_notebooks/Tutorials/algorithms/RB-CliffordRB.ipynb

Large diffs are not rendered by default.

37 changes: 9 additions & 28 deletions pygsti/protocols/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,11 +1311,17 @@ def __init__(self, sub_designs, all_circuits=None, qubit_labels=None, sub_design

if all_circuits is None:
all_circuits = []
if not interleave:
if interleave:
subdesign_circuit_lists = [sub_design.all_circuits_needing_data for sub_design in sub_designs.values()]
#zip_longest is like zip, but if the iterables are of different lengths it returns a specified fill value
#(default None) in place of the missing elements once an iterable has been exhausted.
for circuits in _itertools.zip_longest(*subdesign_circuit_lists):
for circuit in circuits:
if circuit is not None:
all_circuits.append(circuit)
else:
for des in sub_designs.values():
all_circuits.extend(des.all_circuits_needing_data)
else:
raise NotImplementedError("Interleaving not implemented yet")
_lt.remove_duplicates_in_place(all_circuits) # Maybe don't always do this?

if qubit_labels is None and len(sub_designs) > 0:
Expand Down Expand Up @@ -2545,23 +2551,6 @@ class ProtocolResultsDir(_TreeNode, _MongoSerializable):
2. Child :class:`ProtocolResultsDir` objects, obtained by indexing this
object directly using the name of the sub-directory.
Parameters
----------
data : ProtocolData
The data from which *all* the Results objects in this
ProtocolResultsDir are derived.
protocol_results : ProtocolResults, optional
An initial (single) results object to add. The name of the
results object is used as its key within the `.for_protocol`
dictionary. If None, then an empty results directory is created.
children : dict, optional
A dictionary of the :class:`ProtocolResultsDir` objects that are
sub-directories beneath this one. If None, then children are
automatically created based upon the tree given by `data`. (To
avoid creating any children, you can pass an empty dict here.)
"""
collection_name = "pygsti_results_directories"

Expand Down Expand Up @@ -2681,14 +2670,6 @@ def __init__(self, data, protocol_results=None, children=None):
"""
Create a new ProtocolResultsDir object.
This container object holds two things:
1. A `.for_protocol` dictionary of :class:`ProtocolResults` corresponding
to different protocols (keys are protocol names).
2. Child :class:`ProtocolResultsDir` objects, obtained by indexing this
object directly using the name of the sub-directory.
Parameters
----------
data : ProtocolData
Expand Down
Loading

0 comments on commit 722053c

Please sign in to comment.