Skip to content

Commit

Permalink
Update decoding_graph.py
Browse files Browse the repository at this point in the history
linting
  • Loading branch information
hetenyib authored Mar 11, 2024
1 parent 3b4efe6 commit 39a78d8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/qiskit_qec/decoders/decoding_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ def get_error_probs(
else:
return error_probs

def weight_syndrome_graph(self, counts: dict = {}, method: str = METHOD_SPITZ,
error_probs: dict = {}):
def weight_syndrome_graph(
self, counts: dict = {}, method: str = METHOD_SPITZ, error_probs: dict = {}
):
"""Generate weighted syndrome graph from result counts.
Args:
Expand All @@ -313,21 +314,23 @@ def weight_syndrome_graph(self, counts: dict = {}, method: str = METHOD_SPITZ,
method (string): Method to used for calculation. Supported
methods are 'spitz' (default) and 'naive'.
error_probs (dict): probability that the syndrome contains the node pair
of a given edge. Overridden by counts if both are given.
of a given edge. Overridden by counts if both are given.
Additional information:
Uses `counts` to estimate the probability of the errors that
create the pairs of nodes in graph. The edge weights are then
replaced with the corresponding -log(p/(1-p).
"""

if counts!={}:
if counts != {}:
error_probs = self.get_error_probs(counts, method=method)
elif error_probs!={}:
elif error_probs != {}:
error_probs = error_probs
else:
raise NotImplementedError("No information provided to reweight the graph."+
"Specify either counts or error_probs.")
raise NotImplementedError(
"No information provided to reweight the graph."
+ "Specify either counts or error_probs."
)

boundary_nodes = []
for n, node in enumerate(self.graph.nodes()):
Expand Down

0 comments on commit 39a78d8

Please sign in to comment.