Skip to content

Commit b1e93ea

Browse files
committed
report generation
1 parent 23de0cb commit b1e93ea

File tree

1 file changed

+49
-16
lines changed

1 file changed

+49
-16
lines changed

pygsti/report/factory.py

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,13 +1197,36 @@ def construct_standard_report(results, title="auto",
11971197
- idt_idle_oplabel : Label, optional
11981198
The label identifying the idle gate (for use with idle tomography).
11991199
1200+
- skip_sections : tuple[str], optional
1201+
Contains names of standard report sections that should be skipped
1202+
in this particular report. Strings will be cast to lowercase,
1203+
stripped of white space, and then mapped to omitted Section classes
1204+
as follows
1205+
{
1206+
'summary' : SummarySection,
1207+
'goodness' : GoodnessSection,
1208+
'colorbox' : GoodnessColorBoxPlotSection,
1209+
'invariantgates' : GaugeInvariantsGatesSection,
1210+
'invariantgerms' : GaugeInvariantsGermsSection,
1211+
'variant' : GaugeVariantSection,
1212+
'variantraw' : GaugeVariantsRawSection,
1213+
'variantdecomp' : GaugeVariantsDecompSection,
1214+
'varianterrorgen' : GaugeVariantsErrorGenSection,
1215+
'input' : InputSection,
1216+
'meta' : MetaSection,
1217+
'help' : HelpSection
1218+
}
1219+
1220+
A KeyError will be raised if skip_sections contains a string
1221+
that is not in the keys of the above dict (after casting to
1222+
lower case and stripping white space).
1223+
12001224
verbosity : int, optional
12011225
How much detail to send to stdout.
12021226
12031227
Returns
12041228
-------
1205-
Workspace
1206-
The workspace object used to create the report
1229+
Report
12071230
"""
12081231

12091232
printer = _VerbosityPrinter.create_printer(verbosity, comm=comm)
@@ -1265,20 +1288,30 @@ def construct_standard_report(results, title="auto",
12651288
flags.add('CombineRobust')
12661289

12671290
# build section list
1268-
sections = [
1269-
_section.SummarySection(),
1270-
_section.GoodnessSection(),
1271-
_section.GoodnessColorBoxPlotSection(),
1272-
_section.GaugeInvariantsGatesSection(),
1273-
_section.GaugeInvariantsGermsSection(),
1274-
_section.GaugeVariantSection(),
1275-
_section.GaugeVariantsRawSection(),
1276-
_section.GaugeVariantsDecompSection(),
1277-
_section.GaugeVariantsErrorGenSection(),
1278-
_section.InputSection(),
1279-
_section.MetaSection(),
1280-
_section.HelpSection()
1281-
]
1291+
possible_sections = {
1292+
'summary' : _section.SummarySection(),
1293+
'goodness' : _section.GoodnessSection(),
1294+
'colorbox' : _section.GoodnessColorBoxPlotSection(),
1295+
'invariantgates' : _section.GaugeInvariantsGatesSection(),
1296+
'invariantgerms' : _section.GaugeInvariantsGermsSection(),
1297+
'variant' : _section.GaugeVariantSection(),
1298+
'variantraw' : _section.GaugeVariantsRawSection(),
1299+
'variantdecomp' : _section.GaugeVariantsDecompSection(),
1300+
'varianterrorgen' : _section.GaugeVariantsErrorGenSection(),
1301+
'input' : _section.InputSection(),
1302+
'meta' : _section.MetaSection(),
1303+
'help' : _section.HelpSection()
1304+
}
1305+
1306+
skip_sections = advanced_options.get('skip_sections', tuple())
1307+
if skip_sections:
1308+
if isinstance(skip_sections, str):
1309+
skip_sections = [skip_sections]
1310+
skip_sections = [s.lower().replace(' ','') for s in skip_sections]
1311+
for s in skip_sections:
1312+
possible_sections.pop(s)
1313+
sections = list(possible_sections.values())
1314+
# ^ This whole process won't affect ordering of objects in "sections".
12821315

12831316
if 'ShowScaling' in flags:
12841317
sections.append(_section.GoodnessScalingSection())

0 commit comments

Comments
 (0)