diff --git a/src/qiskit_qec/analysis/faultenumerator.py b/src/qiskit_qec/analysis/faultenumerator.py index 4df31677..910ace1e 100644 --- a/src/qiskit_qec/analysis/faultenumerator.py +++ b/src/qiskit_qec/analysis/faultenumerator.py @@ -18,7 +18,7 @@ from qiskit import QuantumCircuit from qiskit.converters import circuit_to_dag from qiskit.circuit.library import IGate, XGate, YGate, ZGate -from qiskit import execute, Aer +from qiskit_aer import Aer from qiskit_qec.analysis.extensions import C_FAULT_ENUMERATOR @@ -185,14 +185,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])) diff --git a/src/qiskit_qec/analysis/faultsampler.py b/src/qiskit_qec/analysis/faultsampler.py index c7db629e..99e7d040 100644 --- a/src/qiskit_qec/analysis/faultsampler.py +++ b/src/qiskit_qec/analysis/faultsampler.py @@ -7,7 +7,7 @@ from qiskit.dagcircuit.dagnode import DAGNode from qiskit.converters import circuit_to_dag from qiskit.circuit.library import IGate, XGate, YGate, ZGate -from qiskit import execute, Aer +from qiskit_aer import Aer from qiskit_qec.utils.dag import node_name_label @@ -150,14 +150,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])) diff --git a/test/heavy_hex_codes/test_heavy_hex_decoder.py b/test/heavy_hex_codes/test_heavy_hex_decoder.py index 7d7a9da7..a02bebf8 100644 --- a/test/heavy_hex_codes/test_heavy_hex_decoder.py +++ b/test/heavy_hex_codes/test_heavy_hex_decoder.py @@ -1,7 +1,7 @@ """Test a heavy-hexagon code decoder""" import unittest -from qiskit import execute, Aer +from qiskit_aer import Aer from qiskit_qec.codes.hhc import HHC from qiskit_qec.circuits.hhc_circuit import HHCCircuit @@ -82,14 +82,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 diff --git a/test/matching/test_circuitmatcher.py b/test/matching/test_circuitmatcher.py index 61de1252..d15c7a8e 100644 --- a/test/matching/test_circuitmatcher.py +++ b/test/matching/test_circuitmatcher.py @@ -1,7 +1,8 @@ """Tests for the subsystem CSS circuit-level matching decoder.""" import unittest -from qiskit import execute, QuantumCircuit, Aer +from qiskit import QuantumCircuit +from qiskit_aer import Aer from qiskit_qec.analysis.faultenumerator import FaultEnumerator from qiskit_qec.decoders.circuit_matching_decoder import temp_syndrome @@ -82,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 @@ -120,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 diff --git a/test/matching/test_repetitionmatcher.py b/test/matching/test_repetitionmatcher.py index 0f0642e9..6de89203 100644 --- a/test/matching/test_repetitionmatcher.py +++ b/test/matching/test_repetitionmatcher.py @@ -1,7 +1,7 @@ """Tests for the subsystem CSS circuit-level matching decoder.""" import unittest -from qiskit import execute, Aer +from qiskit_aer import Aer from qiskit_qec.analysis.faultenumerator import FaultEnumerator from qiskit_qec.decoders.circuit_matching_decoder import temp_syndrome @@ -52,14 +52,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