pygsti.modelmembers.modelmembergraph
¶
Modelmember dependency graph related utility functions
Module Contents¶
Classes¶
A directed acyclic graph of dependencies of ModelMembers 

A basic graph node object for ModelMembers 
 class pygsti.modelmembers.modelmembergraph.ModelMemberGraph(mm_dicts)¶
Bases:
object
A directed acyclic graph of dependencies of ModelMembers
 classmethod load_modelmembers_from_serialization_dict(cls, sdict)¶
Create a nested dictionary of model members from a previously serialized graph.
 Parameters
sdict (dict) – Flat dict of the ModelMemberGraph that was serialized by a prior call to :method:`ModelMemberGraph.create_serialization_dict`.
 Returns
dict
 is_similar(self, other, rtol=1e05, atol=1e08)¶
Comparator between two ModelMemberGraph objects for structure only.
 Parameters
other (ModelMemberGraph) – Dependency graph to compare to
rtol (float) – Relative and absolute tolerances used to check if floating point values are “equal”.
atol (float) – Relative and absolute tolerances used to check if floating point values are “equal”.
 Returns
bool – True if both ModelMemberGraphs have identical modelmember structure/parameterization
 is_equivalent(self, other, rtol=1e05, atol=1e08)¶
Comparator between two ModelMemberGraph objects for structure and values.
 Parameters
other (ModelMemberGraph) – Dependency graph to compare to
rtol (float) – Relative and absolute tolerances used to check if parameter values are “equal”.
atol (float) – Relative and absolute tolerances used to check if parameter values are “equal”.
 Returns
bool – True if similar_to AND parameter vectors match
 _dfs_comparison(self, other, check_params, rtol=1e05, atol=1e08)¶
Helper function for comparators implementing DFS traversal.
 Parameters
other (ModelMemberGraph) – Dependency graph to compare to
check_params (bool) – Whether to check the parameter values (True) or not
rtol (float) – Relative and absolute tolerances used to check if numerical values are “equal”.
atol (float) – Relative and absolute tolerances used to check if numerical values are “equal”.
 Returns
bool – True if graphs match (structure/parameterization must match, param values must also match if check_params is True)
 create_serialization_dict(self)¶
Serialize the ModelMemberGraph object.
Calls underlying to_memoized_dict on each ModelMember, as well as adding necessary metadata for the collection of ModelMembers  e.g., OrderedMemberDict keys for root nodes.
 Returns
sdict (dict) – Flat dict of the ModelMemberGraph for serialization. Keys are serialize_ids, values are derefernced dicts for each individual ModelMember.
 print_graph(self, indent=2)¶
 class pygsti.modelmembers.modelmembergraph.MMGNode(mm: pygsti.modelmembers.modelmember.ModelMember, mm_memo)¶
Bases:
object
A basic graph node object for ModelMembers