pygsti.modelmembers.povms.marginalizedpovm

Defines the MarginalizedPOVM class

Module Contents

Classes

MarginalizedPOVM

A POVM whose effects are the sums of sets of effect vectors in a parent POVM.

class pygsti.modelmembers.povms.marginalizedpovm.MarginalizedPOVM(povm_to_marginalize, all_sslbls, sslbls_after_marginalizing)

Bases: pygsti.modelmembers.povms.povm.POVM

A POVM whose effects are the sums of sets of effect vectors in a parent POVM.

Namely the effects of the parent POVN whose labels have the same character at certain “marginalized” indices are summed together.

Parameters
  • povm_to_marginalize (POVM) – The POVM to marginalize (the “parent” POVM).

  • all_sslbls (StateSpaceLabels or tuple) – The state space labels of the parent POVM, which should have as many labels (factors) as the parent POVM’s outcome/effect labels have characters.

  • sslbls_after_marginalizing (tuple) – The subset of all_sslbls that should be kept after marginalizing.

to_memoized_dict(self, 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.

classmethod _from_memoized_dict(cls, mm_dict, serial_memo)

For subclasses to implement. Submember-existence checks are performed, and the gpindices of the return value is set, by the non-underscored :method:`from_memoized_dict` implemented in this class.

_is_similar(self, other, rtol, atol)

Returns True if other model member (which it guaranteed to be the same type as self) has the same local structure, i.e., not considering parameter values or submembers

submembers(self)

Get the ModelMember-derived objects contained in this one.

Returns

list

marginalize_effect_label(self, elbl)

Removes the “marginalized” characters from elbl, resulting in a marginalized POVM effect label.

Parameters

elbl (str) – Effect label (typically of the parent POVM) to marginalize.

__contains__(self, key)

For lazy creation of effect vectors

__iter__(self)

Implement iter(self).

__len__(self)

Return len(self).

keys(self)

An iterator over the effect (outcome) labels of this POVM.

values(self)

An iterator over the effect POVM effect vectors of this POVM.

items(self)

An iterator over the (effect_label, effect_vector) items in this POVM.

__getitem__(self, key)

For lazy creation of effect vectors

__reduce__(self)

Needed for OrderedDict-derived classes (to set dict items)

simplify_effects(self, 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

__str__(self)

Return str(self).