pyGSTi 0.9.12__cp38-cp38-win_amd64.whl → 0.9.13__cp38-cp38-win_amd64.whl
Sign up to get free protection for your applications and to get access to all the features.
- pyGSTi-0.9.13.dist-info/METADATA +185 -0
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/RECORD +211 -220
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/WHEEL +1 -1
- pygsti/_version.py +2 -2
- pygsti/algorithms/contract.py +1 -1
- pygsti/algorithms/core.py +62 -35
- pygsti/algorithms/fiducialpairreduction.py +95 -110
- pygsti/algorithms/fiducialselection.py +17 -8
- pygsti/algorithms/gaugeopt.py +2 -2
- pygsti/algorithms/germselection.py +87 -77
- pygsti/algorithms/mirroring.py +0 -388
- pygsti/algorithms/randomcircuit.py +165 -1333
- pygsti/algorithms/rbfit.py +0 -234
- pygsti/baseobjs/basis.py +94 -396
- pygsti/baseobjs/errorgenbasis.py +0 -132
- pygsti/baseobjs/errorgenspace.py +0 -10
- pygsti/baseobjs/label.py +52 -168
- pygsti/baseobjs/opcalc/fastopcalc.cp38-win_amd64.pyd +0 -0
- pygsti/baseobjs/opcalc/fastopcalc.pyx +2 -2
- pygsti/baseobjs/polynomial.py +13 -595
- pygsti/baseobjs/protectedarray.py +72 -132
- pygsti/baseobjs/statespace.py +1 -0
- pygsti/circuits/__init__.py +1 -1
- pygsti/circuits/circuit.py +753 -504
- pygsti/circuits/circuitconstruction.py +0 -4
- pygsti/circuits/circuitlist.py +47 -5
- pygsti/circuits/circuitparser/__init__.py +8 -8
- pygsti/circuits/circuitparser/fastcircuitparser.cp38-win_amd64.pyd +0 -0
- pygsti/circuits/circuitstructure.py +3 -3
- pygsti/circuits/cloudcircuitconstruction.py +27 -14
- pygsti/data/datacomparator.py +4 -9
- pygsti/data/dataset.py +51 -46
- pygsti/data/hypothesistest.py +0 -7
- pygsti/drivers/bootstrap.py +0 -49
- pygsti/drivers/longsequence.py +46 -10
- pygsti/evotypes/basereps_cython.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/chp/opreps.py +0 -61
- pygsti/evotypes/chp/statereps.py +0 -32
- pygsti/evotypes/densitymx/effectcreps.cpp +9 -10
- pygsti/evotypes/densitymx/effectreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/densitymx/effectreps.pyx +1 -1
- pygsti/evotypes/densitymx/opreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/densitymx/opreps.pyx +2 -2
- pygsti/evotypes/densitymx/statereps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/densitymx/statereps.pyx +1 -1
- pygsti/evotypes/densitymx_slow/effectreps.py +7 -23
- pygsti/evotypes/densitymx_slow/opreps.py +16 -23
- pygsti/evotypes/densitymx_slow/statereps.py +10 -3
- pygsti/evotypes/evotype.py +39 -2
- pygsti/evotypes/stabilizer/effectreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/stabilizer/effectreps.pyx +0 -4
- pygsti/evotypes/stabilizer/opreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/stabilizer/opreps.pyx +0 -4
- pygsti/evotypes/stabilizer/statereps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/stabilizer/statereps.pyx +1 -5
- pygsti/evotypes/stabilizer/termreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/stabilizer/termreps.pyx +0 -7
- pygsti/evotypes/stabilizer_slow/effectreps.py +0 -22
- pygsti/evotypes/stabilizer_slow/opreps.py +0 -4
- pygsti/evotypes/stabilizer_slow/statereps.py +0 -4
- pygsti/evotypes/statevec/effectreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/statevec/effectreps.pyx +1 -1
- pygsti/evotypes/statevec/opreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/statevec/opreps.pyx +2 -2
- pygsti/evotypes/statevec/statereps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/statevec/statereps.pyx +1 -1
- pygsti/evotypes/statevec/termreps.cp38-win_amd64.pyd +0 -0
- pygsti/evotypes/statevec/termreps.pyx +0 -7
- pygsti/evotypes/statevec_slow/effectreps.py +0 -3
- pygsti/evotypes/statevec_slow/opreps.py +0 -5
- pygsti/extras/__init__.py +0 -1
- pygsti/extras/drift/signal.py +1 -1
- pygsti/extras/drift/stabilityanalyzer.py +3 -1
- pygsti/extras/interpygate/__init__.py +12 -0
- pygsti/extras/interpygate/core.py +0 -36
- pygsti/extras/interpygate/process_tomography.py +44 -10
- pygsti/extras/rpe/rpeconstruction.py +0 -2
- pygsti/forwardsims/__init__.py +1 -0
- pygsti/forwardsims/forwardsim.py +50 -93
- pygsti/forwardsims/mapforwardsim.py +78 -20
- pygsti/forwardsims/mapforwardsim_calc_densitymx.cp38-win_amd64.pyd +0 -0
- pygsti/forwardsims/mapforwardsim_calc_densitymx.pyx +65 -66
- pygsti/forwardsims/mapforwardsim_calc_generic.py +91 -13
- pygsti/forwardsims/matrixforwardsim.py +72 -17
- pygsti/forwardsims/termforwardsim.py +9 -111
- pygsti/forwardsims/termforwardsim_calc_stabilizer.cp38-win_amd64.pyd +0 -0
- pygsti/forwardsims/termforwardsim_calc_statevec.cp38-win_amd64.pyd +0 -0
- pygsti/forwardsims/termforwardsim_calc_statevec.pyx +0 -651
- pygsti/forwardsims/torchfwdsim.py +265 -0
- pygsti/forwardsims/weakforwardsim.py +2 -2
- pygsti/io/__init__.py +1 -2
- pygsti/io/mongodb.py +0 -2
- pygsti/io/stdinput.py +6 -22
- pygsti/layouts/copalayout.py +10 -12
- pygsti/layouts/distlayout.py +0 -40
- pygsti/layouts/maplayout.py +103 -25
- pygsti/layouts/matrixlayout.py +99 -60
- pygsti/layouts/prefixtable.py +1534 -52
- pygsti/layouts/termlayout.py +1 -1
- pygsti/modelmembers/instruments/instrument.py +3 -3
- pygsti/modelmembers/instruments/tpinstrument.py +2 -2
- pygsti/modelmembers/modelmember.py +0 -17
- pygsti/modelmembers/operations/__init__.py +3 -4
- pygsti/modelmembers/operations/affineshiftop.py +206 -0
- pygsti/modelmembers/operations/composederrorgen.py +1 -1
- pygsti/modelmembers/operations/composedop.py +1 -24
- pygsti/modelmembers/operations/denseop.py +5 -5
- pygsti/modelmembers/operations/eigpdenseop.py +2 -2
- pygsti/modelmembers/operations/embeddederrorgen.py +1 -1
- pygsti/modelmembers/operations/embeddedop.py +0 -1
- pygsti/modelmembers/operations/experrorgenop.py +5 -2
- pygsti/modelmembers/operations/fullarbitraryop.py +1 -0
- pygsti/modelmembers/operations/fullcptpop.py +2 -2
- pygsti/modelmembers/operations/fulltpop.py +28 -6
- pygsti/modelmembers/operations/fullunitaryop.py +5 -4
- pygsti/modelmembers/operations/lindbladcoefficients.py +93 -78
- pygsti/modelmembers/operations/lindbladerrorgen.py +268 -441
- pygsti/modelmembers/operations/linearop.py +7 -27
- pygsti/modelmembers/operations/opfactory.py +1 -1
- pygsti/modelmembers/operations/repeatedop.py +1 -24
- pygsti/modelmembers/operations/staticstdop.py +1 -1
- pygsti/modelmembers/povms/__init__.py +3 -3
- pygsti/modelmembers/povms/basepovm.py +7 -36
- pygsti/modelmembers/povms/complementeffect.py +4 -9
- pygsti/modelmembers/povms/composedeffect.py +0 -320
- pygsti/modelmembers/povms/computationaleffect.py +1 -1
- pygsti/modelmembers/povms/computationalpovm.py +3 -1
- pygsti/modelmembers/povms/effect.py +3 -5
- pygsti/modelmembers/povms/marginalizedpovm.py +3 -81
- pygsti/modelmembers/povms/tppovm.py +74 -2
- pygsti/modelmembers/states/__init__.py +2 -5
- pygsti/modelmembers/states/composedstate.py +0 -317
- pygsti/modelmembers/states/computationalstate.py +3 -3
- pygsti/modelmembers/states/cptpstate.py +4 -4
- pygsti/modelmembers/states/densestate.py +10 -8
- pygsti/modelmembers/states/fullpurestate.py +0 -24
- pygsti/modelmembers/states/purestate.py +1 -1
- pygsti/modelmembers/states/state.py +5 -6
- pygsti/modelmembers/states/tpstate.py +28 -10
- pygsti/modelmembers/term.py +3 -6
- pygsti/modelmembers/torchable.py +50 -0
- pygsti/modelpacks/_modelpack.py +1 -1
- pygsti/modelpacks/smq1Q_ZN.py +3 -1
- pygsti/modelpacks/smq2Q_XXYYII.py +2 -1
- pygsti/modelpacks/smq2Q_XY.py +3 -3
- pygsti/modelpacks/smq2Q_XYI.py +2 -2
- pygsti/modelpacks/smq2Q_XYICNOT.py +3 -3
- pygsti/modelpacks/smq2Q_XYICPHASE.py +3 -3
- pygsti/modelpacks/smq2Q_XYXX.py +1 -1
- pygsti/modelpacks/smq2Q_XYZICNOT.py +3 -3
- pygsti/modelpacks/smq2Q_XYZZ.py +1 -1
- pygsti/modelpacks/stdtarget.py +0 -121
- pygsti/models/cloudnoisemodel.py +1 -2
- pygsti/models/explicitcalc.py +3 -3
- pygsti/models/explicitmodel.py +3 -13
- pygsti/models/fogistore.py +5 -3
- pygsti/models/localnoisemodel.py +1 -2
- pygsti/models/memberdict.py +0 -12
- pygsti/models/model.py +801 -68
- pygsti/models/modelconstruction.py +4 -4
- pygsti/models/modelnoise.py +2 -2
- pygsti/models/modelparaminterposer.py +1 -1
- pygsti/models/oplessmodel.py +1 -1
- pygsti/models/qutrit.py +15 -14
- pygsti/objectivefns/objectivefns.py +75 -140
- pygsti/objectivefns/wildcardbudget.py +2 -7
- pygsti/optimize/__init__.py +1 -0
- pygsti/optimize/arraysinterface.py +28 -0
- pygsti/optimize/customcg.py +0 -12
- pygsti/optimize/customlm.py +129 -323
- pygsti/optimize/customsolve.py +2 -2
- pygsti/optimize/optimize.py +0 -84
- pygsti/optimize/simplerlm.py +841 -0
- pygsti/optimize/wildcardopt.py +19 -598
- pygsti/protocols/confidenceregionfactory.py +28 -14
- pygsti/protocols/estimate.py +31 -14
- pygsti/protocols/gst.py +238 -142
- pygsti/protocols/modeltest.py +19 -12
- pygsti/protocols/protocol.py +9 -37
- pygsti/protocols/rb.py +450 -79
- pygsti/protocols/treenode.py +8 -2
- pygsti/protocols/vb.py +108 -206
- pygsti/protocols/vbdataframe.py +1 -1
- pygsti/report/factory.py +0 -15
- pygsti/report/fogidiagram.py +1 -17
- pygsti/report/modelfunction.py +12 -3
- pygsti/report/mpl_colormaps.py +1 -1
- pygsti/report/plothelpers.py +11 -3
- pygsti/report/report.py +16 -0
- pygsti/report/reportables.py +41 -37
- pygsti/report/templates/offline/pygsti_dashboard.css +6 -0
- pygsti/report/templates/offline/pygsti_dashboard.js +12 -0
- pygsti/report/workspace.py +2 -14
- pygsti/report/workspaceplots.py +328 -505
- pygsti/tools/basistools.py +9 -36
- pygsti/tools/edesigntools.py +124 -96
- pygsti/tools/fastcalc.cp38-win_amd64.pyd +0 -0
- pygsti/tools/fastcalc.pyx +35 -81
- pygsti/tools/internalgates.py +151 -15
- pygsti/tools/jamiolkowski.py +5 -5
- pygsti/tools/lindbladtools.py +19 -11
- pygsti/tools/listtools.py +0 -114
- pygsti/tools/matrixmod2.py +1 -1
- pygsti/tools/matrixtools.py +173 -339
- pygsti/tools/nameddict.py +1 -1
- pygsti/tools/optools.py +154 -88
- pygsti/tools/pdftools.py +0 -25
- pygsti/tools/rbtheory.py +3 -320
- pygsti/tools/slicetools.py +64 -12
- pyGSTi-0.9.12.dist-info/METADATA +0 -157
- pygsti/algorithms/directx.py +0 -711
- pygsti/evotypes/qibo/__init__.py +0 -33
- pygsti/evotypes/qibo/effectreps.py +0 -78
- pygsti/evotypes/qibo/opreps.py +0 -376
- pygsti/evotypes/qibo/povmreps.py +0 -98
- pygsti/evotypes/qibo/statereps.py +0 -174
- pygsti/extras/rb/__init__.py +0 -13
- pygsti/extras/rb/benchmarker.py +0 -957
- pygsti/extras/rb/dataset.py +0 -378
- pygsti/extras/rb/io.py +0 -814
- pygsti/extras/rb/simulate.py +0 -1020
- pygsti/io/legacyio.py +0 -385
- pygsti/modelmembers/povms/denseeffect.py +0 -142
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/LICENSE +0 -0
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/top_level.txt +0 -0
pygsti/algorithms/directx.py
DELETED
@@ -1,711 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Functions for generating Direct-(LGST, MC2GST, MLGST) models
|
3
|
-
"""
|
4
|
-
#***************************************************************************************************
|
5
|
-
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
6
|
-
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights
|
7
|
-
# in this software.
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
9
|
-
# in compliance with the License. You may obtain a copy of the License at
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0 or in the LICENSE file in the root pyGSTi directory.
|
11
|
-
#***************************************************************************************************
|
12
|
-
|
13
|
-
import warnings as _warnings
|
14
|
-
_warnings.warn("pygsti.algorithms.directx is deprecated and will be removed in pyGSTi 0.9.13")
|
15
|
-
|
16
|
-
from pygsti.algorithms import core as _core
|
17
|
-
from pygsti import baseobjs as _baseobjs
|
18
|
-
from pygsti.baseobjs import Label
|
19
|
-
from pygsti import circuits as _circuits
|
20
|
-
from pygsti import objectivefns as _objfns
|
21
|
-
from pygsti.modelmembers.operations import FullArbitraryOp as _FullArbitraryOp
|
22
|
-
|
23
|
-
|
24
|
-
def model_with_lgst_circuit_estimates(
|
25
|
-
circuits_to_estimate, dataset, prep_fiducials, meas_fiducials,
|
26
|
-
target_model, include_target_ops=True, op_label_aliases=None,
|
27
|
-
guess_model_for_gauge=None, circuit_labels=None, svd_truncate_to=None,
|
28
|
-
verbosity=0):
|
29
|
-
"""
|
30
|
-
Constructs a model that contains LGST estimates for `circuits_to_estimate`.
|
31
|
-
|
32
|
-
For each circuit in `circuits_to_estimate`, the constructed model
|
33
|
-
contains the LGST estimate for s as separate gate, labeled either by
|
34
|
-
the corresponding element of circuit_labels or by the tuple of s itself.
|
35
|
-
|
36
|
-
Parameters
|
37
|
-
----------
|
38
|
-
circuits_to_estimate : list of Circuits or tuples
|
39
|
-
The circuits to estimate using LGST
|
40
|
-
|
41
|
-
dataset : DataSet
|
42
|
-
The data to use for LGST
|
43
|
-
|
44
|
-
prep_fiducials : list of Circuits
|
45
|
-
Fiducial circuits used to construct an informationally complete
|
46
|
-
effective preparation.
|
47
|
-
|
48
|
-
meas_fiducials : list of Circuits
|
49
|
-
Fiducial circuits used to construct an informationally complete
|
50
|
-
effective measurement.
|
51
|
-
|
52
|
-
target_model : Model
|
53
|
-
A model used by LGST to specify which operation labels should be estimated,
|
54
|
-
a guess for which gauge these estimates should be returned in, and
|
55
|
-
used to simplify circuits.
|
56
|
-
|
57
|
-
include_target_ops : bool, optional
|
58
|
-
If True, the operation labels in target_model will be included in the
|
59
|
-
returned model.
|
60
|
-
|
61
|
-
op_label_aliases : dictionary, optional
|
62
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
63
|
-
corresponding to what that operation label should be expanded into before querying
|
64
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
65
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
66
|
-
|
67
|
-
guess_model_for_gauge : Model, optional
|
68
|
-
A model used to compute a gauge transformation that is applied to
|
69
|
-
the LGST estimates. This gauge transformation is computed such that
|
70
|
-
if the estimated gates matched the model given, then the gate
|
71
|
-
matrices would match, i.e. the gauge would be the same as
|
72
|
-
the model supplied. Defaults to the target_model.
|
73
|
-
|
74
|
-
circuit_labels : list of strings, optional
|
75
|
-
A list of labels in one-to-one correspondence with the
|
76
|
-
circuit in `circuits_to_estimate`. These labels are
|
77
|
-
the keys to access the operation matrices in the returned
|
78
|
-
Model, i.e. op_matrix = returned_model[op_label]
|
79
|
-
|
80
|
-
svd_truncate_to : int, optional
|
81
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
82
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
83
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
84
|
-
Defaults to dimension of `target_model`.
|
85
|
-
|
86
|
-
verbosity : int, optional
|
87
|
-
Verbosity value to send to `run_lgst(...)` call.
|
88
|
-
|
89
|
-
Returns
|
90
|
-
-------
|
91
|
-
Model
|
92
|
-
A model containing LGST estimates for all the requested
|
93
|
-
circuits and possibly the gates in target_model.
|
94
|
-
"""
|
95
|
-
opLabels = [] # list of operation labels for LGST to estimate
|
96
|
-
if op_label_aliases is None: aliases = {}
|
97
|
-
else: aliases = op_label_aliases.copy()
|
98
|
-
|
99
|
-
#Add circuits to estimate as aliases
|
100
|
-
if circuit_labels is not None:
|
101
|
-
assert(len(circuit_labels) == len(circuits_to_estimate))
|
102
|
-
for opLabel, opStr in zip(circuit_labels, circuits_to_estimate):
|
103
|
-
aliases[opLabel] = opStr.replace_layers_with_aliases(op_label_aliases)
|
104
|
-
opLabels.append(opLabel)
|
105
|
-
else:
|
106
|
-
for opStr in circuits_to_estimate:
|
107
|
-
newLabel = 'G' + '.'.join(map(str, tuple(opStr)))
|
108
|
-
aliases[newLabel] = opStr.replace_layers_with_aliases(op_label_aliases) # use circuit tuple as label
|
109
|
-
opLabels.append(newLabel)
|
110
|
-
|
111
|
-
#Add target model labels (not aliased) if requested
|
112
|
-
if include_target_ops and target_model is not None:
|
113
|
-
for targetOpLabel in target_model.operations:
|
114
|
-
if targetOpLabel not in opLabels: # very unlikely that this is false
|
115
|
-
opLabels.append(targetOpLabel)
|
116
|
-
|
117
|
-
return _core.run_lgst(dataset, prep_fiducials, meas_fiducials, target_model,
|
118
|
-
opLabels, aliases, guess_model_for_gauge,
|
119
|
-
svd_truncate_to, verbosity)
|
120
|
-
|
121
|
-
|
122
|
-
def direct_lgst_model(circuit_to_estimate, circuit_label, dataset,
|
123
|
-
prep_fiducials, meas_fiducials, target_model,
|
124
|
-
op_label_aliases=None, svd_truncate_to=None, verbosity=0):
|
125
|
-
"""
|
126
|
-
Constructs a model of LGST estimates for target gates and circuit_to_estimate.
|
127
|
-
|
128
|
-
Parameters
|
129
|
-
----------
|
130
|
-
circuit_to_estimate : Circuit or tuple
|
131
|
-
The single circuit to estimate using LGST
|
132
|
-
|
133
|
-
circuit_label : string
|
134
|
-
The label for the estimate of `circuit_to_estimate`.
|
135
|
-
i.e. op_matrix = returned_model[op_label]
|
136
|
-
|
137
|
-
dataset : DataSet
|
138
|
-
The data to use for LGST
|
139
|
-
|
140
|
-
prep_fiducials : list of Circuits
|
141
|
-
Fiducial circuits used to construct an informationally complete
|
142
|
-
effective preparation.
|
143
|
-
|
144
|
-
meas_fiducials : list of Circuits
|
145
|
-
Fiducial circuits used to construct an informationally complete
|
146
|
-
effective measurement.
|
147
|
-
|
148
|
-
target_model : Model
|
149
|
-
The target model used by LGST to extract operation labels and an initial gauge
|
150
|
-
|
151
|
-
op_label_aliases : dictionary, optional
|
152
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
153
|
-
corresponding to what that operation label should be expanded into before querying
|
154
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
155
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
156
|
-
|
157
|
-
svd_truncate_to : int, optional
|
158
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
159
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
160
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
161
|
-
Defaults to dimension of `target_model`.
|
162
|
-
|
163
|
-
verbosity : int, optional
|
164
|
-
Verbosity value to send to `run_lgst(...)` call.
|
165
|
-
|
166
|
-
Returns
|
167
|
-
-------
|
168
|
-
Model
|
169
|
-
A model containing LGST estimates of `circuit_to_estimate`
|
170
|
-
and the gates of `target_model`.
|
171
|
-
"""
|
172
|
-
return model_with_lgst_circuit_estimates(
|
173
|
-
[circuit_to_estimate], dataset, prep_fiducials, meas_fiducials, target_model,
|
174
|
-
True, op_label_aliases, None, [circuit_label], svd_truncate_to,
|
175
|
-
verbosity)
|
176
|
-
|
177
|
-
|
178
|
-
def direct_lgst_models(circuits, dataset, prep_fiducials, meas_fiducials, target_model,
|
179
|
-
op_label_aliases=None, svd_truncate_to=None, verbosity=0):
|
180
|
-
"""
|
181
|
-
Constructs a dictionary with keys == circuits and values == Direct-LGST Models.
|
182
|
-
|
183
|
-
Parameters
|
184
|
-
----------
|
185
|
-
circuits : list of Circuit or tuple objects
|
186
|
-
The circuits to estimate using LGST. The elements of this list
|
187
|
-
are the keys of the returned dictionary.
|
188
|
-
|
189
|
-
dataset : DataSet
|
190
|
-
The data to use for all LGST estimates.
|
191
|
-
|
192
|
-
prep_fiducials : list of Circuits
|
193
|
-
Fiducial circuits used to construct an informationally complete
|
194
|
-
effective preparation.
|
195
|
-
|
196
|
-
meas_fiducials : list of Circuits
|
197
|
-
Fiducial circuits used to construct an informationally complete
|
198
|
-
effective measurement.
|
199
|
-
|
200
|
-
target_model : Model
|
201
|
-
The target model used by LGST to extract operation labels and an initial gauge
|
202
|
-
|
203
|
-
op_label_aliases : dictionary, optional
|
204
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
205
|
-
corresponding to what that operation label should be expanded into before querying
|
206
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
207
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
208
|
-
|
209
|
-
svd_truncate_to : int, optional
|
210
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
211
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
212
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
213
|
-
Defaults to dimension of `target_model`.
|
214
|
-
|
215
|
-
verbosity : int, optional
|
216
|
-
Verbosity value to send to run_lgst(...) call.
|
217
|
-
|
218
|
-
Returns
|
219
|
-
-------
|
220
|
-
dict
|
221
|
-
A dictionary that relates each circuit to a Model containing the LGST
|
222
|
-
estimate of that circuit's action (as a SPAM-less operation sequence)
|
223
|
-
stored under the operation label "GsigmaLbl", along with LGST estimates
|
224
|
-
of the gates in `target_model`.
|
225
|
-
"""
|
226
|
-
printer = _baseobjs.VerbosityPrinter.create_printer(verbosity)
|
227
|
-
|
228
|
-
directLGSTmodels = {}
|
229
|
-
printer.log("--- Direct LGST precomputation ---")
|
230
|
-
with printer.progress_logging(1):
|
231
|
-
for i, sigma in enumerate(circuits):
|
232
|
-
printer.show_progress(i, len(circuits), prefix="--- Computing model for string -", suffix='---')
|
233
|
-
directLGSTmodels[sigma] = direct_lgst_model(
|
234
|
-
sigma, "GsigmaLbl", dataset, prep_fiducials, meas_fiducials, target_model,
|
235
|
-
op_label_aliases, svd_truncate_to, verbosity)
|
236
|
-
return directLGSTmodels
|
237
|
-
|
238
|
-
|
239
|
-
def direct_mc2gst_model(circuit_to_estimate, circuit_label, dataset,
|
240
|
-
prep_fiducials, meas_fiducials, target_model,
|
241
|
-
op_label_aliases=None, svd_truncate_to=None,
|
242
|
-
min_prob_clip_for_weighting=1e-4,
|
243
|
-
prob_clip_interval=(-1e6, 1e6), verbosity=0):
|
244
|
-
"""
|
245
|
-
Constructs a model of LSGST estimates for target gates and circuit_to_estimate.
|
246
|
-
|
247
|
-
Starting with a Direct-LGST estimate for circuit_to_estimate, runs LSGST
|
248
|
-
using the same strings that LGST would have used to estimate circuit_to_estimate
|
249
|
-
and each of the target gates. That is, LSGST is run with strings of the form:
|
250
|
-
|
251
|
-
1. prep_fiducial
|
252
|
-
2. meas_fiducial
|
253
|
-
3. prep_fiducial + meas_fiducial
|
254
|
-
4. prep_fiducial + single_gate + meas_fiducial
|
255
|
-
5. prep_fiducial + circuit_to_estimate + meas_fiducial
|
256
|
-
|
257
|
-
and the resulting Model estimate is returned.
|
258
|
-
|
259
|
-
Parameters
|
260
|
-
----------
|
261
|
-
circuit_to_estimate : Circuit
|
262
|
-
The single circuit to estimate using LSGST
|
263
|
-
|
264
|
-
circuit_label : string
|
265
|
-
The label for the estimate of `circuit_to_estimate`.
|
266
|
-
i.e. op_matrix = returned_mode[op_label]
|
267
|
-
|
268
|
-
dataset : DataSet
|
269
|
-
The data to use for LGST
|
270
|
-
|
271
|
-
prep_fiducials : list of Circuits
|
272
|
-
Fiducial circuits used to construct an informationally complete
|
273
|
-
effective preparation.
|
274
|
-
|
275
|
-
meas_fiducials : list of Circuits
|
276
|
-
Fiducial circuits used to construct an informationally complete
|
277
|
-
effective measurement.
|
278
|
-
|
279
|
-
target_model : Model
|
280
|
-
The target model used by LGST to extract operation labels and an initial gauge
|
281
|
-
|
282
|
-
op_label_aliases : dictionary, optional
|
283
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
284
|
-
corresponding to what that operation label should be expanded into before querying
|
285
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
286
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
287
|
-
|
288
|
-
svd_truncate_to : int, optional
|
289
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
290
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
291
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
292
|
-
Defaults to dimension of `target_model`.
|
293
|
-
|
294
|
-
min_prob_clip_for_weighting : float, optional
|
295
|
-
defines the clipping interval for the statistical weight used
|
296
|
-
within the chi^2 function (see chi2fn).
|
297
|
-
|
298
|
-
prob_clip_interval : 2-tuple, optional
|
299
|
-
(min,max) to clip probabilities to within Model probability
|
300
|
-
computation routines (see Model.bulk_fill_probs)
|
301
|
-
|
302
|
-
verbosity : int, optional
|
303
|
-
Verbosity value to send to run_lgst(...) and do_mc2gst(...) calls.
|
304
|
-
|
305
|
-
Returns
|
306
|
-
-------
|
307
|
-
Model
|
308
|
-
A model containing LSGST estimates of `circuit_to_estimate`
|
309
|
-
and the gates of `target_model`.
|
310
|
-
"""
|
311
|
-
direct_lgst = model_with_lgst_circuit_estimates(
|
312
|
-
[circuit_to_estimate], dataset, prep_fiducials, meas_fiducials, target_model,
|
313
|
-
True, op_label_aliases, None, [circuit_label], svd_truncate_to, verbosity)
|
314
|
-
|
315
|
-
# LEXICOGRAPHICAL VS MATRIX ORDER
|
316
|
-
circuits = prep_fiducials + meas_fiducials + [prepC + measC for prepC in prep_fiducials
|
317
|
-
for measC in meas_fiducials]
|
318
|
-
for opLabel in direct_lgst.operations:
|
319
|
-
circuits.extend([prepC + _circuits.Circuit((opLabel,)) + measC
|
320
|
-
for prepC in prep_fiducials for measC in meas_fiducials])
|
321
|
-
|
322
|
-
aliases = {} if (op_label_aliases is None) else op_label_aliases.copy()
|
323
|
-
aliases[circuit_label] = circuit_to_estimate.replace_layers_with_aliases(op_label_aliases)
|
324
|
-
|
325
|
-
obuilder = _objfns.Chi2Function.builder(regularization={'min_prob_clip_for_weighting': min_prob_clip_for_weighting},
|
326
|
-
penalties={'prob_clip_interval': prob_clip_interval})
|
327
|
-
bulk_circuits = _circuits.CircuitList(circuits, aliases)
|
328
|
-
_, direct_lsgst = _core.run_gst_fit_simple(dataset, direct_lgst, bulk_circuits, optimizer=None,
|
329
|
-
objective_function_builder=obuilder, resource_alloc=None,
|
330
|
-
verbosity=verbosity)
|
331
|
-
|
332
|
-
return direct_lsgst
|
333
|
-
|
334
|
-
|
335
|
-
def direct_mc2gst_models(circuits, dataset, prep_fiducials, meas_fiducials,
|
336
|
-
target_model, op_label_aliases=None,
|
337
|
-
svd_truncate_to=None, min_prob_clip_for_weighting=1e-4,
|
338
|
-
prob_clip_interval=(-1e6, 1e6), verbosity=0):
|
339
|
-
"""
|
340
|
-
Constructs a dictionary with keys == circuits and values == Direct-LSGST Models.
|
341
|
-
|
342
|
-
Parameters
|
343
|
-
----------
|
344
|
-
circuits : list of Circuit or tuple objects
|
345
|
-
The circuits to estimate using LSGST. The elements of this list
|
346
|
-
are the keys of the returned dictionary.
|
347
|
-
|
348
|
-
dataset : DataSet
|
349
|
-
The data to use for all LGST and LSGST estimates.
|
350
|
-
|
351
|
-
prep_fiducials : list of Circuits
|
352
|
-
Fiducial circuits used to construct an informationally complete
|
353
|
-
effective preparation.
|
354
|
-
|
355
|
-
meas_fiducials : list of Circuits
|
356
|
-
Fiducial circuits used to construct an informationally complete
|
357
|
-
effective measurement.
|
358
|
-
|
359
|
-
target_model : Model
|
360
|
-
The target model used by LGST to extract operation labels and an initial gauge
|
361
|
-
|
362
|
-
op_label_aliases : dictionary, optional
|
363
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
364
|
-
corresponding to what that operation label should be expanded into before querying
|
365
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
366
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
367
|
-
|
368
|
-
svd_truncate_to : int, optional
|
369
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
370
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
371
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
372
|
-
Defaults to dimension of `target_model`.
|
373
|
-
|
374
|
-
min_prob_clip_for_weighting : float, optional
|
375
|
-
defines the clipping interval for the statistical weight used
|
376
|
-
within the chi^2 function (see chi2fn).
|
377
|
-
|
378
|
-
prob_clip_interval : 2-tuple, optional
|
379
|
-
(min,max) to clip probabilities to within Model probability
|
380
|
-
computation routines (see Model.bulk_fill_probs)
|
381
|
-
|
382
|
-
verbosity : int, optional
|
383
|
-
Verbosity value to send to run_lgst(...) and do_mc2gst(...) calls.
|
384
|
-
|
385
|
-
Returns
|
386
|
-
-------
|
387
|
-
dict
|
388
|
-
A dictionary that relates each circuit to a Model containing the LGST
|
389
|
-
estimate of that circuit's action (as a SPAM-less operation sequence)
|
390
|
-
stored under the operation label "GsigmaLbl", along with LSGST estimates
|
391
|
-
of the gates in `target_model`.
|
392
|
-
"""
|
393
|
-
printer = _baseobjs.VerbosityPrinter.create_printer(verbosity)
|
394
|
-
directLSGSTmodels = {}
|
395
|
-
printer.log("--- Direct LSGST precomputation ---")
|
396
|
-
with printer.progress_logging(1):
|
397
|
-
for i, sigma in enumerate(circuits):
|
398
|
-
printer.show_progress(i, len(circuits), prefix="--- Computing model for string-", suffix='---')
|
399
|
-
directLSGSTmodels[sigma] = direct_mc2gst_model(
|
400
|
-
sigma,
|
401
|
-
Label('GsigmaLbl') if sigma.line_labels == ('*',) else Label('GsigmaLbl', sigma.line_labels),
|
402
|
-
dataset, prep_fiducials, meas_fiducials, target_model,
|
403
|
-
op_label_aliases, svd_truncate_to, min_prob_clip_for_weighting,
|
404
|
-
prob_clip_interval, verbosity)
|
405
|
-
|
406
|
-
return directLSGSTmodels
|
407
|
-
|
408
|
-
|
409
|
-
def direct_mlgst_model(circuit_to_estimate, circuit_label, dataset,
|
410
|
-
prep_fiducials, meas_fiducials, target_model,
|
411
|
-
op_label_aliases=None, svd_truncate_to=None, min_prob_clip=1e-6,
|
412
|
-
prob_clip_interval=(-1e6, 1e6), verbosity=0):
|
413
|
-
"""
|
414
|
-
Constructs a model of MLEGST estimates for target gates and circuit_to_estimate.
|
415
|
-
|
416
|
-
Starting with a Direct-LGST estimate for circuit_to_estimate, runs MLEGST
|
417
|
-
using the same strings that LGST would have used to estimate circuit_to_estimate
|
418
|
-
and each of the target gates. That is, MLEGST is run with strings of the form:
|
419
|
-
|
420
|
-
1. prep_fiducial
|
421
|
-
2. meas_fiducial
|
422
|
-
3. prep_fiducial + meas_fiducial
|
423
|
-
4. prep_fiducial + singleGate + meas_fiducial
|
424
|
-
5. prep_fiducial + circuit_to_estimate + meas_fiducial
|
425
|
-
|
426
|
-
and the resulting Model estimate is returned.
|
427
|
-
|
428
|
-
Parameters
|
429
|
-
----------
|
430
|
-
circuit_to_estimate : Circuit or tuple
|
431
|
-
The single circuit to estimate using LSGST
|
432
|
-
|
433
|
-
circuit_label : string
|
434
|
-
The label for the estimate of `circuit_to_estimate`.
|
435
|
-
i.e. `op_matrix = returned_model[op_label]`
|
436
|
-
|
437
|
-
dataset : DataSet
|
438
|
-
The data to use for LGST
|
439
|
-
|
440
|
-
prep_fiducials : list of Circuits
|
441
|
-
Fiducial circuits used to construct an informationally complete
|
442
|
-
effective preparation.
|
443
|
-
|
444
|
-
meas_fiducials : list of Circuits
|
445
|
-
Fiducial circuits used to construct an informationally complete
|
446
|
-
effective measurement.
|
447
|
-
|
448
|
-
target_model : Model
|
449
|
-
The target model used by LGST to extract operation labels and an initial gauge
|
450
|
-
|
451
|
-
op_label_aliases : dictionary, optional
|
452
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
453
|
-
corresponding to what that operation label should be expanded into before querying
|
454
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
455
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
456
|
-
|
457
|
-
svd_truncate_to : int, optional
|
458
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
459
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
460
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
461
|
-
Defaults to dimension of `target_model`.
|
462
|
-
|
463
|
-
min_prob_clip : float, optional
|
464
|
-
defines the minimum probability "patch point" used
|
465
|
-
within the logl function.
|
466
|
-
|
467
|
-
prob_clip_interval : 2-tuple, optional
|
468
|
-
(min,max) to clip probabilities to within Model probability
|
469
|
-
computation routines (see Model.bulk_fill_probs)
|
470
|
-
|
471
|
-
verbosity : int, optional
|
472
|
-
Verbosity value to send to run_lgst(...) and do_mlgst(...) calls.
|
473
|
-
|
474
|
-
Returns
|
475
|
-
-------
|
476
|
-
Model
|
477
|
-
A model containing MLEGST estimates of `circuit_to_estimate`
|
478
|
-
and the gates of `target_model`.
|
479
|
-
"""
|
480
|
-
direct_lgst = model_with_lgst_circuit_estimates(
|
481
|
-
[circuit_to_estimate], dataset, prep_fiducials, meas_fiducials, target_model,
|
482
|
-
True, op_label_aliases, None, [circuit_label], svd_truncate_to, verbosity)
|
483
|
-
|
484
|
-
# LEXICOGRAPHICAL VS MATRIX ORDER
|
485
|
-
circuits = prep_fiducials + meas_fiducials + [prepC + measC for prepC in prep_fiducials
|
486
|
-
for measC in meas_fiducials]
|
487
|
-
for opLabel in direct_lgst.operations:
|
488
|
-
circuits.extend([prepC + _circuits.Circuit((opLabel,)) + measC
|
489
|
-
for prepC in prep_fiducials for measC in meas_fiducials])
|
490
|
-
|
491
|
-
aliases = {} if (op_label_aliases is None) else op_label_aliases.copy()
|
492
|
-
aliases[circuit_label] = circuit_to_estimate.replace_layers_with_aliases(op_label_aliases)
|
493
|
-
|
494
|
-
obuilder = _objfns.PoissonPicDeltaLogLFunction.builder(regularization={'min_prob_clip': min_prob_clip},
|
495
|
-
penalties={'prob_clip_interval': prob_clip_interval})
|
496
|
-
bulk_circuits = _circuits.CircuitList(circuits, aliases)
|
497
|
-
_, direct_mlegst = _core.run_gst_fit_simple(dataset, direct_lgst, bulk_circuits, optimizer=None,
|
498
|
-
objective_function_builder=obuilder, resource_alloc=None,
|
499
|
-
verbosity=verbosity)
|
500
|
-
|
501
|
-
return direct_mlegst
|
502
|
-
|
503
|
-
|
504
|
-
def direct_mlgst_models(circuits, dataset, prep_fiducials, meas_fiducials, target_model,
|
505
|
-
op_label_aliases=None, svd_truncate_to=None, min_prob_clip=1e-6,
|
506
|
-
prob_clip_interval=(-1e6, 1e6), verbosity=0):
|
507
|
-
"""
|
508
|
-
Constructs a dictionary with keys == circuits and values == Direct-MLEGST Models.
|
509
|
-
|
510
|
-
Parameters
|
511
|
-
----------
|
512
|
-
circuits : list of Circuit or tuple objects
|
513
|
-
The circuits to estimate using MLEGST. The elements of this list
|
514
|
-
are the keys of the returned dictionary.
|
515
|
-
|
516
|
-
dataset : DataSet
|
517
|
-
The data to use for all LGST and LSGST estimates.
|
518
|
-
|
519
|
-
prep_fiducials : list of Circuits
|
520
|
-
Fiducial circuits used to construct an informationally complete
|
521
|
-
effective preparation.
|
522
|
-
|
523
|
-
meas_fiducials : list of Circuits
|
524
|
-
Fiducial circuits used to construct an informationally complete
|
525
|
-
effective measurement.
|
526
|
-
|
527
|
-
target_model : Model
|
528
|
-
The target model used by LGST to extract operation labels and an initial gauge
|
529
|
-
|
530
|
-
op_label_aliases : dictionary, optional
|
531
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
532
|
-
corresponding to what that operation label should be expanded into before querying
|
533
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
534
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
535
|
-
|
536
|
-
svd_truncate_to : int, optional
|
537
|
-
The Hilbert space dimension to truncate the operation matrices to using
|
538
|
-
a SVD to keep only the largest svdToTruncateTo singular values of
|
539
|
-
the I_tildle LGST matrix. Zero means no truncation.
|
540
|
-
Defaults to dimension of `target_model`.
|
541
|
-
|
542
|
-
min_prob_clip : float, optional
|
543
|
-
defines the minimum probability "patch point" used
|
544
|
-
within the logl function.
|
545
|
-
|
546
|
-
prob_clip_interval : 2-tuple, optional
|
547
|
-
(min,max) to clip probabilities to within Model probability
|
548
|
-
computation routines (see Model.bulk_fill_probs)
|
549
|
-
|
550
|
-
verbosity : int, optional
|
551
|
-
Verbosity value to send to run_lgst(...) and do_mlgst(...) calls.
|
552
|
-
|
553
|
-
Returns
|
554
|
-
-------
|
555
|
-
dict
|
556
|
-
A dictionary that relates each circuit to a Model containing the LGST
|
557
|
-
estimate of that circuit's action (as a SPAM-less operation sequence)
|
558
|
-
stored under the operation label "GsigmaLbl", along with MLEGST estimates
|
559
|
-
of the gates in `target_model`.
|
560
|
-
"""
|
561
|
-
printer = _baseobjs.VerbosityPrinter.create_printer(verbosity)
|
562
|
-
directMLEGSTmodels = {}
|
563
|
-
printer.log("--- Direct MLEGST precomputation ---")
|
564
|
-
with printer.progress_logging(1):
|
565
|
-
for i, sigma in enumerate(circuits):
|
566
|
-
printer.show_progress(i, len(circuits), prefix="--- Computing model for string ", suffix="---")
|
567
|
-
directMLEGSTmodels[sigma] = direct_mlgst_model(
|
568
|
-
sigma,
|
569
|
-
Label('GsigmaLbl') if sigma.line_labels == ('*',) else Label('GsigmaLbl', sigma.line_labels),
|
570
|
-
dataset, prep_fiducials, meas_fiducials, target_model,
|
571
|
-
op_label_aliases, svd_truncate_to, min_prob_clip,
|
572
|
-
prob_clip_interval, verbosity)
|
573
|
-
|
574
|
-
return directMLEGSTmodels
|
575
|
-
|
576
|
-
|
577
|
-
def focused_mc2gst_model(circuit_to_estimate, circuit_label, dataset,
|
578
|
-
prep_fiducials, meas_fiducials, start_model,
|
579
|
-
op_label_aliases=None, min_prob_clip_for_weighting=1e-4,
|
580
|
-
prob_clip_interval=(-1e6, 1e6), verbosity=0):
|
581
|
-
"""
|
582
|
-
Constructs a model containing a single LSGST estimate of `circuit_to_estimate`.
|
583
|
-
|
584
|
-
Starting with `start_model`, run LSGST with the same circuits that LGST
|
585
|
-
would use to estimate `circuit_to_estimate`. That is, LSGST is run with
|
586
|
-
strings of the form: prep_fiducial + circuit_to_estimate + meas_fiducial
|
587
|
-
and return the resulting Model.
|
588
|
-
|
589
|
-
Parameters
|
590
|
-
----------
|
591
|
-
circuit_to_estimate : Circuit or tuple
|
592
|
-
The single circuit to estimate using LSGST
|
593
|
-
|
594
|
-
circuit_label : string
|
595
|
-
The label for the estimate of `circuit_to_estimate`.
|
596
|
-
i.e. `op_matrix = returned_model[op_label]`
|
597
|
-
|
598
|
-
dataset : DataSet
|
599
|
-
The data to use for LGST
|
600
|
-
|
601
|
-
prep_fiducials : list of Circuits
|
602
|
-
Fiducial circuits used to construct an informationally complete
|
603
|
-
effective preparation.
|
604
|
-
|
605
|
-
meas_fiducials : list of Circuits
|
606
|
-
Fiducial circuits used to construct an informationally complete
|
607
|
-
effective measurement.
|
608
|
-
|
609
|
-
start_model : Model
|
610
|
-
The model to seed LSGST with. Often times obtained via LGST.
|
611
|
-
|
612
|
-
op_label_aliases : dictionary, optional
|
613
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
614
|
-
corresponding to what that operation label should be expanded into before querying
|
615
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
616
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
617
|
-
|
618
|
-
min_prob_clip_for_weighting : float, optional
|
619
|
-
defines the clipping interval for the statistical weight used
|
620
|
-
within the chi^2 function (see chi2fn).
|
621
|
-
|
622
|
-
prob_clip_interval : 2-tuple, optional
|
623
|
-
(min,max) to clip probabilities to within Model probability
|
624
|
-
computation routines (see Model.bulk_fill_probs)
|
625
|
-
|
626
|
-
verbosity : int, optional
|
627
|
-
Verbosity value to send do_mc2gst(...) call.
|
628
|
-
|
629
|
-
Returns
|
630
|
-
-------
|
631
|
-
Model
|
632
|
-
A model containing LSGST estimate of `circuit_to_estimate`.
|
633
|
-
"""
|
634
|
-
circuits = [prepC + circuit_to_estimate + measC for prepC in prep_fiducials for measC in meas_fiducials]
|
635
|
-
|
636
|
-
obuilder = _objfns.Chi2Function.builder(regularization={'min_prob_clip_for_weighting': min_prob_clip_for_weighting},
|
637
|
-
penalties={'prob_clip_interval': prob_clip_interval})
|
638
|
-
bulk_circuits = _circuits.CircuitList(circuits, op_label_aliases)
|
639
|
-
_, focused_lsgst = _core.run_gst_fit_simple(dataset, start_model, bulk_circuits, optimizer=None,
|
640
|
-
objective_function_builder=obuilder, resource_alloc=None,
|
641
|
-
verbosity=verbosity)
|
642
|
-
|
643
|
-
focused_lsgst.operations[circuit_label] = _FullArbitraryOp(
|
644
|
-
focused_lsgst.sim.product(circuit_to_estimate)) # add desired string as a separate labeled gate
|
645
|
-
return focused_lsgst
|
646
|
-
|
647
|
-
|
648
|
-
def focused_mc2gst_models(circuits, dataset, prep_fiducials, meas_fiducials,
|
649
|
-
start_model, op_label_aliases=None,
|
650
|
-
min_prob_clip_for_weighting=1e-4,
|
651
|
-
prob_clip_interval=(-1e6, 1e6), verbosity=0):
|
652
|
-
"""
|
653
|
-
Constructs a dictionary with keys == circuits and values == Focused-LSGST Models.
|
654
|
-
|
655
|
-
Parameters
|
656
|
-
----------
|
657
|
-
circuits : list of Circuit or tuple objects
|
658
|
-
The circuits to estimate using LSGST. The elements of this list
|
659
|
-
are the keys of the returned dictionary.
|
660
|
-
|
661
|
-
dataset : DataSet
|
662
|
-
The data to use for all LGST and LSGST estimates.
|
663
|
-
|
664
|
-
prep_fiducials : list of Circuits
|
665
|
-
Fiducial circuits used to construct an informationally complete
|
666
|
-
effective preparation.
|
667
|
-
|
668
|
-
meas_fiducials : list of Circuits
|
669
|
-
Fiducial circuits used to construct an informationally complete
|
670
|
-
effective measurement.
|
671
|
-
|
672
|
-
start_model : Model
|
673
|
-
The model to seed LSGST with. Often times obtained via LGST.
|
674
|
-
|
675
|
-
op_label_aliases : dictionary, optional
|
676
|
-
Dictionary whose keys are operation label "aliases" and whose values are tuples
|
677
|
-
corresponding to what that operation label should be expanded into before querying
|
678
|
-
the dataset. Defaults to the empty dictionary (no aliases defined)
|
679
|
-
e.g. opLabelAliases['Gx^3'] = ('Gx','Gx','Gx')
|
680
|
-
|
681
|
-
min_prob_clip_for_weighting : float, optional
|
682
|
-
defines the clipping interval for the statistical weight used
|
683
|
-
within the chi^2 function (see chi2fn).
|
684
|
-
|
685
|
-
prob_clip_interval : 2-tuple, optional
|
686
|
-
(min,max) to clip probabilities to within Model probability
|
687
|
-
computation routines (see Model.bulk_fill_probs)
|
688
|
-
|
689
|
-
verbosity : int, optional
|
690
|
-
Verbosity value to send to do_mc2gst(...) call.
|
691
|
-
|
692
|
-
Returns
|
693
|
-
-------
|
694
|
-
dict
|
695
|
-
A dictionary that relates each circuit to a Model containing the
|
696
|
-
LSGST estimate of that circuit's action, stored under the
|
697
|
-
operation label "GsigmaLbl".
|
698
|
-
"""
|
699
|
-
|
700
|
-
printer = _baseobjs.VerbosityPrinter.create_printer(verbosity)
|
701
|
-
focusedLSGSTmodels = {}
|
702
|
-
printer.log("--- Focused LSGST precomputation ---")
|
703
|
-
with printer.progress_logging(1):
|
704
|
-
for i, sigma in enumerate(circuits):
|
705
|
-
printer.show_progress(i, len(circuits), prefix="--- Computing model for string", suffix='---')
|
706
|
-
focusedLSGSTmodels[sigma] = focused_mc2gst_model(
|
707
|
-
sigma,
|
708
|
-
Label('GsigmaLbl') if sigma.line_labels == ('*',) else Label('GsigmaLbl', sigma.line_labels),
|
709
|
-
dataset, prep_fiducials, meas_fiducials, start_model,
|
710
|
-
op_label_aliases, min_prob_clip_for_weighting, prob_clip_interval, verbosity)
|
711
|
-
return focusedLSGSTmodels
|