Closed coreyostrove closed 11 months ago
This is fixed on the egn-updates
branch by commit b65dfd47463d389bea32ab1cdc86b1eeaecb09f6. Maybe we want to merge this into develop
at some point.
Awesome! Thanks, @enielse!
Closed with release of 0.9.12.
There is currently no error handling in place for gracefully managing the case where a user requests a single-parameter wildcard fit using the diamond distance without having cvxopt and cvxpy installed. Doing so results in the error:
/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/tools/optools.py:383: UserWarning: CVXPY failed: The solver CVXOPT is not installed. - diamonddist returning -2! _warnings.warn("CVXPY failed: %s - diamonddist returning -2!" % str(e)) /homeuser/Documents/GST/gst/lib/python3.11/site-packages/pygsti/objectivefns/wildcardbudget.py:369: RuntimeWarning: divide by zero encountered in scalar divide betaA = (1.0 - alphaA * sum_fA - sum_qC) / sum_fB Traceback (most recent call last):
File "/home/user/Documents/DTC/dtc/lib/python3.11/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec exec(code, globals, locals)
File "/home/user/Documents/GST/2Q_GST_Designs_LV_Group/GST_MPI_Example.py", line 96, in
results = gst_protocol.run(data, comm=comm,
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/protocols/gst.py", line 1700, in run result = gst.run(data, memlimit, comm)
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/protocols/gst.py", line 1357, in run return _add_gaugeopt_and_badfit(ret, self.name, target_model,
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/protocols/gst.py", line 1791, in _add_gaugeopt_and_badfit _add_badfit_estimates(results, estlbl, badfit_options, optimizer, resource_alloc, printer, gaugeopt_suite= gaugeopt_suite)
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/protocols/gst.py", line 1983, in _add_badfit_estimates budget = _compute_wildcard_budget_1d_model(base_estimate, objfn_cache, mdc_objfn, parameters,
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/protocols/gst.py", line 2134, in _compute_wildcard_budget_1d_model _opt.wildcardopt.optimize_wildcard_bisect_alpha(budget_to_optimize, mdc_objfn, two_dlogl_threshold, redbox_threshold, printer,
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/optimize/wildcardopt.py", line 464, in optimize_wildcard_bisect_alpha if is_feasible(_np.array([guess], 'd')):
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/optimize/wildcardopt.py", line 452, in is_feasible budget.update_probs(initial_probs, current_probs, objfn.freqs, objfn.layout, percircuit_budget_deriv,
File "/home/user/Documents/GST/gst/lib/python3.11/site-packages/pygsti/objectivefns/wildcardbudget.py", line 373, in update_probs assert(sum_fB > 0), 'sum_fB = %g <= 0! %s qvec=%s fvec=%s' % (sum_fB, str(circ), str(qvec), str(fvec))
We obviously should add code for detecting this case. The thing I think would be worth discussing is whether we want the fallback behavior to be exclusion of the wildcard fit, or if we should have it fall back to something like the trace distance which does approximate the diamond distance instead. I think the former is probably better, as it is probably better not to calculate anything than to create a situation where someone misses the fact that the metric changed and accidentally misreports something.