:py:mod:`pygsti.modelmembers.povms.composedpovm` ================================================ .. py:module:: pygsti.modelmembers.povms.composedpovm .. autoapi-nested-parse:: Defines the ComposedPOVM class Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: pygsti.modelmembers.povms.composedpovm.ComposedPOVM .. py:class:: ComposedPOVM(errormap, povm=None, mx_basis=None) Bases: :py:obj:`pygsti.modelmembers.povms.povm.POVM` TODO: update docstring A POVM that is effectively a *single* Lindblad-parameterized gate followed by a computational-basis POVM. Parameters ---------- errormap : MapOperator The error generator action and parameterization, encapsulated in a gate object. Usually a :class:`LindbladOp` or :class:`ComposedOp` object. (This argument is *not* copied, to allow ComposedPOVMEffects to share error generator parameters with other gates and spam vectors.) povm : POVM, optional A sub-POVM which supplies the set of "reference" effect vectors that `errormap` acts on to produce the final effect vectors of this LindbladPOVM. This POVM must be *static* (have zero parameters) and its evolution type must match that of `errormap`. If None, then a :class:`ComputationalBasisPOVM` is used on the number of qubits appropriate to `errormap`'s dimension. mx_basis : {'std', 'gm', 'pp', 'qt'} or Basis object The basis for this spam vector. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object). If None, then this is extracted (if possible) from `errormap`. Creates a new LindbladPOVM object. Parameters ---------- errormap : MapOperator The error generator action and parameterization, encapsulated in a gate object. Usually a :class:`LindbladOp` or :class:`ComposedOp` object. (This argument is *not* copied, to allow ComposedPOVMEffects to share error generator parameters with other gates and spam vectors.) povm : POVM, optional A sub-POVM which supplies the set of "reference" effect vectors that `errormap` acts on to produce the final effect vectors of this LindbladPOVM. This POVM must be *static* (have zero parameters) and its evolution type must match that of `errormap`. If None, then a :class:`ComputationalBasisPOVM` is used on the number of qubits appropriate to `errormap`'s dimension. mx_basis : {'std', 'gm', 'pp', 'qt'} or Basis object The basis for this spam vector. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object). If None, then this is extracted (if possible) from `errormap`. .. py:property:: parameter_labels An array of labels (usually strings) describing this model member's parameters. .. py:property:: num_params Get the number of independent parameters which specify this POVM. Returns ------- int the number of independent parameters. .. py:attribute:: error_map .. py:attribute:: matrix_basis .. py:attribute:: base_povm :value: 'None' .. py:method:: to_memoized_dict(mmg_memo) Create a serializable dict with references to other objects in the memo. Parameters ---------- mmg_memo: dict Memo dict from a ModelMemberGraph, i.e. keys are object ids and values are ModelMemberGraphNodes (which contain the serialize_id). This is NOT the same as other memos in ModelMember (e.g. copy, allocate_gpindices, etc.). Returns ------- mm_dict: dict A dict representation of this ModelMember ready for serialization This must have at least the following fields: module, class, submembers, params, state_space, evotype Additional fields may be added by derived classes. .. py:method:: keys() An iterator over the effect (outcome) labels of this POVM. .. py:method:: values() An iterator over the effect effect vectors of this POVM. .. py:method:: items() An iterator over the (effect_label, effect_vector) items in this POVM. .. py:method:: submembers() Get the ModelMember-derived objects contained in this one. Returns ------- list .. py:method:: set_gpindices(gpindices, parent, memo=None) Set the parent and indices into the parent's parameter vector that are used by this ModelMember object. Parameters ---------- gpindices : slice or integer ndarray The indices of this objects parameters in its parent's array. parent : Model or ModelMember The parent whose parameter array gpindices references. memo : dict, optional A memo dict used to avoid circular references. Returns ------- None .. py:method:: simplify_effects(prefix='') Creates a dictionary of simplified effect vectors. Returns a dictionary of effect POVMEffects that belong to the POVM's parent `Model` - that is, whose `gpindices` are set to all or a subset of this POVM's gpindices. Such effect vectors are used internally within computations involving the parent `Model`. Parameters ---------- prefix : str A string, usually identitying this POVM, which may be used to prefix the simplified gate keys. Returns ------- OrderedDict of POVMEffects .. py:method:: to_vector() Extract a vector of the underlying gate parameters from this POVM. Returns ------- numpy array a 1D numpy array with length == num_params(). .. py:method:: from_vector(v, close=False, dirty_value=True) Initialize this POVM using a vector of its parameters. Parameters ---------- v : numpy array The 1D vector of POVM parameters. Length must == num_params(). close : bool, optional Whether `v` is close to this POVM's current set of parameters. Under some circumstances, when this is true this call can be completed more quickly. dirty_value : bool, optional The value to set this object's "dirty flag" to before exiting this call. This is passed as an argument so it can be updated *recursively*. Leave this set to `True` unless you know what you're doing. Returns ------- None .. py:method:: transform_inplace(s) Update each POVM effect E as s^T * E. Note that this is equivalent to the *transpose* of the effect vectors being mapped as `E^T -> E^T * s`. Parameters ---------- s : GaugeGroupElement A gauge group element which specifies the "s" matrix (and it's inverse) used in the above similarity transform. Returns ------- None .. py:method:: depolarize(amount) Depolarize this POVM by the given `amount`. Parameters ---------- amount : float or tuple The amount to depolarize by. If a tuple, it must have length equal to one less than the dimension of the gate. All but the first element of each spam vector (often corresponding to the identity element) are multiplied by `amount` (if a float) or the corresponding `amount[i]` (if a tuple). Returns ------- None .. py:method:: errorgen_coefficient_labels(label_type='global') The elementary error-generator labels corresponding to the elements of :meth:`errorgen_coefficients_array`. Parameters ---------- label_type : str, optional (default 'global') String specifying which type of `ElementaryErrorgenLabel` to use as the keys for the returned dictionary. Allowed options are 'global' for `GlobalElementaryErrorgenLabel` and 'local' for `LocalElementaryErrorgenLabel`. Returns ------- tuple A tuple of (, [,)` tuples, where `termType` is `"H"` (Hamiltonian), `"S"` (Stochastic), or `"A"` (Affine). Hamiltonian and Affine terms always have a single basis label (so key is a 2-tuple) whereas Stochastic tuples have 1 basis label to indicate a *diagonal* term and otherwise have 2 basis labels to specify off-diagonal non-Hamiltonian Lindblad terms. Basis labels are integers starting at 0. Values are complex coefficients. basis : Basis A Basis mapping the basis labels used in the keys of `lindblad_term_dict` to basis matrices. .. py:method:: set_errorgen_coefficients(lindblad_term_dict, action='update', logscale_nonham=False, truncate=True) Sets the coefficients of terms in the error generator of this POVM. The dictionary `lindblad_term_dict` has tuple-keys describing the type of term and the basis elements used to construct it, e.g. `('H','X')`. Parameters ---------- lindblad_term_dict : dict Keys are `(termType, basisLabel1, )` tuples, where `termType` is `"H"` (Hamiltonian), `"S"` (Stochastic), or `"A"` (Affine). Hamiltonian and Affine terms always have a single basis label (so key is a 2-tuple) whereas Stochastic tuples have 1 basis label to indicate a *diagonal* term and otherwise have 2 basis labels to specify off-diagonal non-Hamiltonian Lindblad terms. Values are the coefficients of these error generators, and should be real except for the 2-basis-label case. action : {"update","add","reset"} How the values in `lindblad_term_dict` should be combined with existing error-generator coefficients. logscale_nonham : bool, optional Whether or not the values in `lindblad_term_dict` for non-hamiltonian error generators should be interpreted as error *rates* (of an "equivalent" depolarizing channel, see :meth:`errorgen_coefficients`) instead of raw coefficients. If True, then the non-hamiltonian coefficients are set to `-log(1 - d^2*rate)/d^2`, where `rate` is the corresponding value given in `lindblad_term_dict`. This is what is performed by the function :meth:`set_error_rates`. truncate : bool, optional Whether to allow adjustment of the errogen coefficients in order to meet constraints (e.g. to preserve CPTP) when necessary. If False, then an error is thrown when the given coefficients cannot be set as specified. Returns ------- None .. py:method:: errorgen_coefficients_array_deriv_wrt_params() The jacobian of :meth:`errogen_coefficients_array` with respect to this POVM's parameters. Returns ------- numpy.ndarray A 2D array of shape `(num_coeffs, num_params)` where `num_coeffs` is the number of coefficients of this operation's error generator and `num_params` is this operation's number of parameters.