Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report compatibility with map simulator #329

Closed
coreyostrove opened this issue Jul 10, 2023 · 2 comments
Closed

Report compatibility with map simulator #329

coreyostrove opened this issue Jul 10, 2023 · 2 comments
Assignees
Labels
bug A bug or regression

Comments

@coreyostrove
Copy link
Contributor

coreyostrove commented Jul 10, 2023

When generating a GST report for a model with the map forward simulator I encountered the following error related to the calculation of a certain gauge invariant error metric

> Traceback (most recent call last):
  File "2023-07-09_3Q_GST_Per_Germ_Global_FPR_Report_Generation.py", line 49, in <module>
    report.write_html('3Q_GST_Report_07_09_2023')
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/report.py", line 174, in write_html
    qtys = self._build(build_options)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/report.py", line 89, in _build
    qtys.update(section.render(self._workspace, **full_params))
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/section/__init__.py", line 78, in render
    return {
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/section/__init__.py", line 79, in <dictcomp>
    k: v(workspace, brevity=brevity, **kwargs)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/section/gauge.py", line 124, in final_gates_vs_target_table_gauge_invgerms
    return workspace.GatesVsTargetTable(
  File "<string>", line 2, in factoryfn
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/workspacetables.py", line 1183, in __init__
    super(GatesVsTargetTable, self).__init__(ws, self._create, model,
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/workspace.py", line 2056, in __init__
    self.ws.switched_compute(self.tablefn, *self.initargs)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/workspace.py", line 713, in switched_compute
    key, result = self.smartCache.cached_compute(fn, argVals)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/baseobjs/smartcache.py", line 312, in cached_compute
    self.cache[key] = fn(*arg_vals, **kwargs)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/workspacetables.py", line 1233, in _create
    qty = _reportables.evaluate_opfn_by_name(
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/reportables.py", line 2499, in evaluate_opfn_by_name
    return evaluate(fn(model, target_model, gl), confidence_region_info)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/reportables.py", line 96, in evaluate
    return _make_reportable_qty_or_dict(model_fn.evaluate(model_fn.base_model))
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/modelfunction.py", line 464, in evaluate
    return fn(model, *self.args, **self.kwargs)
  File "/home/ciostro/Per_Germ_Global_FPR/pygsti_per_germ_global_fpr/pygsti/report/reportables.py", line 744, in circuit_eigenvalue_diamondnorm
    A = model_a.sim.product(circuit)  # "gate"
AttributeError: 'MapForwardSimulator' object has no attribute 'product'

To Reproduce
Generate a GST fit using a target seed model that uses the map forward simulator. Construct a standard report and write the report to html.

Here is a minimal working example :

import pygsti
from pygsti.modelpacks import smq1Q_XY
from pygsti.data.datasetconstruction import simulate_data
from pygsti.protocols import ProtocolData, StandardGST
from pygsti.report import construct_standard_report

target_model = smq1Q_XY.target_model('full TP')
target_model.sim = 'map'
datagen_model = target_model.copy()
datagen_model = datagen_model.depolarize(op_noise= 1e-2)
edesign = smq1Q_XY.create_gst_experiment_design(16)
ds = simulate_data(datagen_model, circuit_list=edesign.all_circuits_needing_data, num_samples=100)
data = ProtocolData(edesign=edesign, dataset=ds)
gst_proto = StandardGST('full TP', target_model=target_model)
results = gst_proto.run(data)
report = construct_standard_report(results)
report.write_html('test_map_report')

Expected behavior
The choice of forward simulator should not impact the report generation process, but if it is unavoidable then there should be logic for detecting and changing the simulator internally.

Environment (please complete the following information):

  • pyGSTi version 0.9.11.1
  • python version 3.8
  • OS Ubuntu 20.04 LTS
@coreyostrove coreyostrove added the bug A bug or regression label Jul 10, 2023
@coreyostrove coreyostrove self-assigned this Jul 10, 2023
@sserita
Copy link
Contributor

sserita commented Oct 18, 2023

This should be fixed with the addition of product to the map forward simulator in PR #350.

@sserita sserita added the fixed but not in release yet Bug has been fixed, but isn't in an official release yet (just exists on a development branch) label Oct 18, 2023
@sserita
Copy link
Contributor

sserita commented Nov 29, 2023

Closed with release of 0.9.12.

@sserita sserita closed this as completed Nov 29, 2023
@sserita sserita removed the fixed but not in release yet Bug has been fixed, but isn't in an official release yet (just exists on a development branch) label Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants