Skip to content

Commit c431fc3

Browse files
author
Corey Ostrove
committed
Rework Gate and SPAM table error bars
Rework the SPAM and Gate table error bar handling, and re-implement the ability to split off real and imaginary parts for gates. Additionally, add the target HS vector as a column to the SPAM table.
1 parent fdbb18e commit c431fc3

File tree

3 files changed

+187
-146
lines changed

3 files changed

+187
-146
lines changed

pygsti/report/factory.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ def _create_master_switchboard(ws, results_dict, confidence_level,
274274
if confidence_level is not None:
275275
switchBd.add("cri", (0, 1, 2))
276276
switchBd.add("cri_gaugeinv", (0, 1))
277+
switchBd.add("cri_target_and_final", (0, 1, 2))
277278

278279
for d, dslbl in enumerate(dataset_labels):
279280
results = results_dict[dslbl]
@@ -435,6 +436,7 @@ def _create_master_switchboard(ws, results_dict, confidence_level,
435436
for il, l in enumerate(gauge_opt_labels):
436437
if l in est.models:
437438
switchBd.cri[d, i, il] = None # default
439+
switchBd.cri_target_and_final[d, i, il] = [None, None] #default
438440
crf = _get_viewable_crf(est, lbl, l, printer - 2)
439441

440442
if crf is not None:
@@ -445,8 +447,13 @@ def _create_master_switchboard(ws, results_dict, confidence_level,
445447
region_type = "normal" if misfit_sigma <= nmthreshold \
446448
else "non-markovian"
447449
switchBd.cri[d, i, il] = crf.view(confidence_level, region_type)
450+
#Now that we have identifies the gauge-optimization with the CRI
451+
#add this to the switchboard.
452+
switchBd.cri_target_and_final[d,i,il] = [None, crf.view(confidence_level, region_type)]
453+
else:
454+
switchBd.cri[d, i, il] = NA
455+
switchBd.cri_target_and_final[d, i, il] = NA
448456

449-
else: switchBd.cri[d, i, il] = NA
450457

451458
# "Gauge Invariant Representation" model
452459
# If we can't compute CIs for this, ignore SILENTLY, since any

pygsti/report/section/gauge.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,21 +252,23 @@ class GaugeVariantsRawSection(_Section):
252252
def final_gates_box_table(workspace, switchboard=None, confidence_level=None, ci_brevity=1, **kwargs):
253253
return workspace.GatesTable(
254254
switchboard.mdl_target_and_final, ['Target', 'Estimated'], 'boxes',
255-
_cri(1, switchboard, confidence_level, ci_brevity)
255+
_cri_target_and_final(1, switchboard, confidence_level, ci_brevity)
256256
)
257257

258258
@_Section.figure_factory(4)
259259
def final_model_brief_spam_table(workspace, switchboard=None, confidence_level=None, ci_brevity=1, **kwargs):
260260
return workspace.SpamTable(
261261
switchboard.mdl_target_and_final, ['Target', 'Estimated'], 'boxes',
262-
_cri(1, switchboard, confidence_level, ci_brevity), include_hs_vec=True
262+
_cri_target_and_final(1, switchboard, confidence_level, ci_brevity), include_hs_vec=True
263263
)
264264

265265

266266
# Helper functions
267267
def _cri(el, switchboard, confidence_level, ci_brevity):
268268
return switchboard.cri if confidence_level is not None and ci_brevity <= el else None
269269

270+
def _cri_target_and_final(el, switchboard, confidence_level, ci_brevity):
271+
return switchboard.cri_target_and_final if confidence_level is not None and ci_brevity <= el else [None, None]
270272

271273
def _cri_gauge_inv(el, switchboard, confidence_level, ci_brevity):
272274
return switchboard.cri_gaugeinv if confidence_level is not None and ci_brevity <= el else None

0 commit comments

Comments
 (0)