Skip to content

Commit

Permalink
added in standard deviation to RB plot
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanh6 committed Sep 6, 2023
1 parent 7c99765 commit 74b8018
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions pygsti/protocols/rb.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ class BinaryRBDesign(_vb.BenchmarkingDesign):
def __init__(self, pspec, clifford_compilations, depths, circuits_per_depth, qubit_labels=None, layer_sampling='mixed1q2q',
sampler='edgegrab', samplerargs=[0.25, ],
addlocal=False, lsargs=(),
citerations=20, compilerargs=(), idle_name='Gc0', partitioned=False, descriptor='A BiRB experiment',
descriptor='A BiRB experiment',
add_default_protocol=False, seed=None, verbosity=1, num_processes=1):

if qubit_labels is None: qubit_labels = tuple(pspec.qubit_labels)
Expand All @@ -939,10 +939,8 @@ def __init__(self, pspec, clifford_compilations, depths, circuits_per_depth, qub
circuits_per_depth, l, lnum + 1, len(depths), lseed))

args_list = [(pspec, clifford_compilations, l)] * circuits_per_depth
kwargs_list = [dict(idle_name=idle_name, qubit_labels=qubit_labels, layer_sampling=layer_sampling, sampler=sampler, samplerargs=samplerargs,
kwargs_list = [dict(qubit_labels=qubit_labels, layer_sampling=layer_sampling, sampler=sampler, samplerargs=samplerargs,
addlocal=addlocal, lsargs=lsargs,
citerations=citerations, compilerargs=compilerargs,
partitioned=partitioned,
seed=lseed + i) for i in range(circuits_per_depth)]
#results = [_rc.create_direct_rb_circuit(*(args_list[0]), **(kwargs_list[0]))] # num_processes == 1 case
results = _tools.mptools.starmap_with_kwargs(_rc.create_binary_rb_circuit, circuits_per_depth,
Expand All @@ -961,18 +959,16 @@ def __init__(self, pspec, clifford_compilations, depths, circuits_per_depth, qub
signs.append(signs_at_depth)

self._init_foundation(depths, circuit_lists, measurements, signs, circuits_per_depth, qubit_labels, layer_sampling,
sampler, samplerargs, idle_name, addlocal, lsargs, citerations, compilerargs, partitioned, descriptor,
sampler, samplerargs, addlocal, lsargs, descriptor,
add_default_protocol)

def _init_foundation(self, depths, circuit_lists, measurements, signs, circuits_per_depth, qubit_labels, layer_sampling,
sampler, samplerargs, idle_name, addlocal, lsargs, citerations, compilerargs, partitioned, descriptor,
sampler, samplerargs, addlocal, lsargs, descriptor,
add_default_protocol):
super().__init__(depths, circuit_lists, signs, qubit_labels, remove_duplicates=False)
self.measurements = measurements
self.signs = signs
self.circuits_per_depth = circuits_per_depth
self.citerations = citerations
self.compilerargs = compilerargs
self.descriptor = descriptor
self.layer_sampling = layer_sampling
if isinstance(sampler, str):
Expand All @@ -982,8 +978,7 @@ def _init_foundation(self, depths, circuit_lists, measurements, signs, circuits_
self.samplerargs = samplerargs
self.addlocal = addlocal
self.lsargs = lsargs
self.partitioned = partitioned
self.idle_name = idle_name


if add_default_protocol:
if randomizeout:
Expand Down Expand Up @@ -1361,11 +1356,11 @@ def plot(self, fitkey=None, decay=True, success_probabilities=True, size=(8, 5),
a = self.fits[fitkey].estimates['a']
b = self.fits[fitkey].estimates['b']
p = self.fits[fitkey].estimates['p']
#_plt.plot(lengths, a + b * p**lengths,
# label='Fit, r = {:.2} +/- {:.1}'.format(self.fits[fitkey].estimates['r'],
# self.fits[fitkey].stds['r']))
_plt.plot(lengths, a + b * p**lengths,
label='Fit, r = {:.2}'.format(self.fits[fitkey].estimates['r']))
label='Fit, r = {:.2} +/- {:.1}'.format(self.fits[fitkey].estimates['r'],
self.fits[fitkey].stds['r']))
#_plt.plot(lengths, a + b * p**lengths,
# label='Fit, r = {:.2}'.format(self.fits[fitkey].estimates['r']))

if success_probabilities:
all_success_probs_by_depth = [data_per_depth[depth] for depth in self.depths]
Expand Down

0 comments on commit 74b8018

Please sign in to comment.