Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumjim authored Feb 1, 2022
1 parent 50fadfd commit d68a0e8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/repetiton_codes/test_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
"""Run codes and decoders."""

import unittest
import retworkx as rx

import sys
sys.path.append('../../')
import qiskit_qec
from qiskit_qec.circuits.repetition_code import RepetitionCodeCircuit as RepetitionCode
from qiskit_qec.decoders.graph_decoder import GraphDecoder

import retworkx as rx

from qiskit import execute, Aer, QuantumCircuit
from qiskit.providers.aer.noise import NoiseModel
from qiskit.providers.aer.noise.errors import pauli_error, depolarizing_error
from qiskit.providers.aer.noise.errors import depolarizing_error

from qiskit_qec.circuits.repetition_code import RepetitionCodeCircuit as RepetitionCode
from qiskit_qec.decoders.graph_decoder import GraphDecoder

sys.path.append('../../')

def get_syndrome(code, noise_model, shots=1024):
"""Runs a code to get required results."""
Expand All @@ -49,7 +50,6 @@ def get_syndrome(code, noise_model, shots=1024):

def get_noise(p_meas, p_gate):
"""Define a noise model."""
error_meas = pauli_error([("X", p_meas), ("I", 1 - p_meas)])
error_gate1 = depolarizing_error(p_gate, 1)
error_gate2 = error_gate1.tensor(error_gate1)

Expand Down Expand Up @@ -140,10 +140,11 @@ def test_graph_construction(self):
for xbasis in [False, True]:
for resets in [False, True]:
for delay in [0, 16]:
codes[d,T,xbasis,resets,delay] = RepetitionCode(d, T, xbasis=xbasis, resets=resets, delay=delay)
for params in codes:
codes[d,T,xbasis,resets,delay] = RepetitionCode(
d, T, xbasis=xbasis, resets=resets,
delay=delay)
for params, code in codes.items():
d,T = params[0:2]
code = codes[params]
self.single_error_test(code)
if len(params)==5:
d,T,xbasis,resets,delay = params
Expand All @@ -169,8 +170,6 @@ def test_weight(self):
def test_rep_probs(self):
"""Repetition code test."""
matching_probs = {}
lookup_probs = {}
post_probs = {}

max_dist = 5

Expand Down Expand Up @@ -219,7 +218,8 @@ def test_graph(self):
for resets in [True, False]:
error = (
"Error: The analytical SyndromeGraph does not coincide "
+ "with the brute force SyndromeGraph in d=7, T=2, resets="+str(resets)+" RepetitionCode."
+ "with the brute force SyndromeGraph in d=7, T=2, resets="\
+ str(resets)+" RepetitionCode."
)
code = RepetitionCode(7, 2, resets=resets)
graph_new = GraphDecoder(code, brute=False).S
Expand Down

0 comments on commit d68a0e8

Please sign in to comment.