Skip to content

Commit

Permalink
Fix repetition code decoder test (#407)
Browse files Browse the repository at this point in the history
* fix rep test

* lintng
  • Loading branch information
quantumjim authored Nov 6, 2023
1 parent efff153 commit aebaa93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/qiskit_qec/circuits/repetition_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def string2raw_logicals(self, string):
Returns:
list: Raw values for logical operators that correspond to nodes.
"""
return _separate_string(self._process_string(string))[0]
return string.split(" ", maxsplit=1)[0][-1]

def check_nodes(self, nodes, ignore_extra_boundary=False, minimal=False):
"""
Expand Down
4 changes: 2 additions & 2 deletions test/code_circuits/test_rep_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def clustering_decoder_test(
# now run them all and check it works
for c, code in enumerate(codes):
decoding_graph = DecodingGraph(code)
if c == 3 and Decoder is UnionFindDecoder:
if c >= 0 and Decoder is UnionFindDecoder:
decoder = Decoder(code, decoding_graph=decoding_graph, use_peeling=False)
else:
decoder = Decoder(code, decoding_graph=decoding_graph)
Expand All @@ -555,7 +555,7 @@ def clustering_decoder_test(
for j, z_logical in enumerate(decoder.measured_logicals):
error = corrected_z_logicals[j] != 1
if error:
error_num = string.count("0")
error_num = string.split(" ", maxsplit=1)[0].count("0")
if error_num < min_error_num:
min_error_num = error_num
min_error_string = string
Expand Down

0 comments on commit aebaa93

Please sign in to comment.