Skip to content

Commit

Permalink
Merge branch 'main' into bugfix-migration-from-qasmsimulator
Browse files Browse the repository at this point in the history
  • Loading branch information
grace-harper authored Sep 19, 2023
2 parents fd18da9 + df2d2b0 commit 9482b6f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 48 deletions.
11 changes: 3 additions & 8 deletions src/qiskit_qec/analysis/faultenumerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,9 @@ def gint(c):
else:
return c

result = execute(
circ,
Aer.get_backend("aer_simulator"),
method="stabilizer",
shots=1,
optimization_level=0,
seed_simulator=self.sim_seed,
).result()
backend = Aer.get_backend("aer_simulator")
options = {"method": "stabilizer", "shots": 1, "seed_simulator": self.sim_seed}
result = backend.run(circ, **options).result()
outcomes = result.get_counts(circ)
raw_outcome = list(outcomes.keys())[0]
outcome = list(map(gint, raw_outcome[::-1]))
Expand Down
11 changes: 3 additions & 8 deletions src/qiskit_qec/analysis/faultsampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,9 @@ def gint(c):
else:
return c

result = execute(
circ,
Aer.get_backend("aer_simulator"),
method="stabilizer",
shots=1,
optimization_level=0,
seed_simulator=self.sim_seed,
).result()
backend = Aer.get_backend("aer_simulator")
options = {"method": "stabilizer", "shots": 1, "seed_simulator": self.sim_seed}
result = backend.run(circ, **options).result()
outcomes = result.get_counts(circ)
raw_outcome = list(outcomes.keys())[0]
outcome = list(map(gint, raw_outcome[::-1]))
Expand Down
11 changes: 3 additions & 8 deletions test/heavy_hex_codes/test_heavy_hex_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,9 @@ def no_faults_success(self, code, circ, dec, model, good=0, xbasis=False):
"""Test for correct behavior without faults."""
shots = 10
seed = 100
result = execute(
circ,
Aer.get_backend("aer_simulator"),
method="stabilizer",
shots=shots,
optimization_level=0,
seed_simulator=seed,
).result()
backend = Aer.get_backend("aer_simulator")
options = {"method": "stabilizer", "shots": shots, "seed_simulator": seed}
result = backend.run(circ, **options).result()
counts = result.get_counts(circ)
dec.update_edge_weights(model)
failures = 0
Expand Down
22 changes: 6 additions & 16 deletions test/matching/test_circuitmatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,9 @@ def test_no_errors(self):
"rustworkx",
False,
)
result = execute(
self.qc,
Aer.get_backend("aer_simulator"),
method="stabilizer",
shots=shots,
optimization_level=0,
seed_simulator=seed,
).result()
backend = Aer.get_backend("aer_simulator")
options = {"method": "stabilizer", "shots": shots, "seed_simulator": seed}
result = backend.run(self.qc, **options).result()
counts = result.get_counts(self.qc)
dec.update_edge_weights(self.pnm)
failures = 0
Expand Down Expand Up @@ -121,14 +116,9 @@ def test_no_errors_pymatching(self):
"pymatching",
False,
)
result = execute(
self.qc,
Aer.get_backend("aer_simulator"),
method="stabilizer",
shots=shots,
optimization_level=0,
seed_simulator=seed,
).result()
backend = Aer.get_backend("aer_simulator")
options = {"method": "stabilizer", "shots": shots, "seed_simulator": seed}
result = backend.run(self.qc, **options).result()
counts = result.get_counts(self.qc)
dec.update_edge_weights(self.pnm)
failures = 0
Expand Down
11 changes: 3 additions & 8 deletions test/matching/test_repetitionmatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,9 @@ def gint(c):
for logical in ["0", "1"]:
dec = RepetitionDecoder(self.code_circuit, self.pnm, method, False, logical)
qc = self.code_circuit.circuit[logical]
result = execute(
qc,
Aer.get_backend("aer_simulator"),
method="stabilizer",
shots=shots,
optimization_level=0,
seed_simulator=seed,
).result()
backend = Aer.get_backend("aer_simulator")
options = {"method": "stabilizer", "shots": shots, "seed_simulator": seed}
result = backend.run(qc, **options).result()
counts = result.get_counts(qc)
dec.update_edge_weights(self.pnm)
failures = 0
Expand Down

0 comments on commit 9482b6f

Please sign in to comment.