Defines the _BasePOVM class (a base class for other POVMs, not to be used independently)

Module Contents



The base behavior for both UnconstrainedPOVM and TPPOVM

class pygsti.modelmembers.povms.basepovm._BasePOVM(effects, evotype=None, state_space=None, preserve_sum=False)

Bases: pygsti.modelmembers.povms.povm.POVM

The base behavior for both UnconstrainedPOVM and TPPOVM


Returns a sequence of any sub-ModelMember objects contained in this one.

Sub-members are processed by other ModelMember methods (e.g. unlink_parent and set_gpindices) as though the parent object is just a container for these sub-members and has no parameters of its own. Member objects that contain other members and possess their own independent parameters should implement the appropriate ModelMember functions (usually just allocate_gpindices, using the base implementation as a reference).


list or tuple

to_memoized_dict(self, mmg_memo)

Create a serializable dict with references to other objects in the memo.


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.).


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.

__setitem__(self, key, value)

Set self[key] to value.

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.


prefix (str) – A string, usually identitying this POVM, which may be used to prefix the simplified gate keys.


OrderedDict of POVMEffects

property num_params(self)

Get the number of independent parameters which specify this POVM.


int – the number of independent parameters.


Extract a vector of the underlying gate parameters from this POVM.


numpy array – a 1D numpy array with length == num_params().

from_vector(self, v, close=False, dirty_value=True)

Initialize this POVM using a vector of its 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.



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


s (GaugeGroupElement) – A gauge group element which specifies the “s” matrix (and it’s inverse) used in the above similarity transform.

depolarize(self, amount)

Depolarize this POVM by the given amount.


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).