Is your feature request related to a problem? Please describe.
It is difficult to instantiate models with entire blocks of error generators, e.g. all weight-2 Hamiltonian and stochastic errors, and weight-1 correlated/active errors.
Describe the solution you'd like
I'd like it to be easy to specify error generators with different support, type, and weight, something like selecting blocks out of Fig 2 of the taxonomy paper.
Maybe an dict of strings constructor for LindbladCoefficientBlocks? With plumbing up into modelconstruction functions?
Describe alternatives you've considered
My current best is something like this:
import itertools
import numpy as np
import pygsti
from pygsti.baseobjs.basis import Basis as _Basis
import pygsti.modelmembers.operations as _ops
from pygsti.modelmembers.operations.lindbladcoefficients import LindbladCoefficientBlock as _LindbladCBlock
qubit_labels = ('Q0','Q1','Q2','Q3')
state_space = pygsti.baseobjs.QubitSpace(qubit_labels)
pspec = pygsti.processors.QubitProcessorSpec(4,
['Gxpi2', 'Gxmpi2', 'Gypi2', 'Gympi2', 'Gcphase'], qubit_labels=qubit_labels,
availability={
'Gxpi2': [(q,) for q in qubit_labels],
'Gypi2': [(q,) for q in qubit_labels],
'Gxmpi2': [(q,) for q in qubit_labels],
'Gympi2': [(q,) for q in qubit_labels],
'Gcphase': [('Q0', 'Q1'), ('Q1', 'Q2'), ('Q2', 'Q3')]
})
ex_model = pygsti.models.create_explicit_model(pspec)
H2S2A1_model = ex_model.copy()
H2S2A1_model.operations.flags['auto_embed'] = False
pp_basis = _Basis.cast('pp', 4**4)
w1_lbls = [lbl for lbl in pp_basis.labels if sum([c != 'I' for c in lbl]) == 1]
w2_lbls = [lbl for lbl in pp_basis.labels if sum([c != 'I' for c in lbl]) == 2]
for lbl, op in H2S2A1_model.operations.items():
errgen_dict = {}
# Lindblad coefficient blocks
H12_block = _LindbladCBlock('ham', pp_basis, w1_lbls + w2_lbls, param_mode='elements')
S2_block = _LindbladCBlock('other_diagonal', pp_basis, w2_lbls, param_mode='cholesky')
SCA1_block = _LindbladCBlock('other', pp_basis, w1_lbls, param_mode='cholesky')
# Build op
errgen = _ops.LindbladErrorgen([H12_block, S2_block, SCA1_block], state_space=state_space)
H2S2A1_model.operations[lbl] = _ops.ComposedOp([
_ops.StaticUnitaryOp(op),
_ops.ExpErrorgenOp(errgen)
])
Is your feature request related to a problem? Please describe. It is difficult to instantiate models with entire blocks of error generators, e.g. all weight-2 Hamiltonian and stochastic errors, and weight-1 correlated/active errors.
Describe the solution you'd like I'd like it to be easy to specify error generators with different support, type, and weight, something like selecting blocks out of Fig 2 of the taxonomy paper. Maybe an dict of strings constructor for LindbladCoefficientBlocks? With plumbing up into modelconstruction functions?
Describe alternatives you've considered My current best is something like this: