Skip to content

Commit

Permalink
Replace qiskit.providers.basicaer test usage with qiskit-aer
Browse files Browse the repository at this point in the history
qiskit.providers.basicaer was removed in Qiskit 1.0. See
Qiskit/qiskit#11422
  • Loading branch information
wshanks committed Feb 1, 2024
1 parent a7a3112 commit e45c348
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/curve_analysis/test_curve_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy as np

from qiskit import QuantumCircuit, transpile
from qiskit.providers.basicaer import QasmSimulatorPy
from qiskit_aer import AerSimulator
from qiskit_experiments.curve_analysis import process_curve_data
from qiskit_experiments.curve_analysis.utils import (
level2_probability,
Expand All @@ -36,7 +36,7 @@ def simulate_experiment_data(self, thetas, shots=1024):
qc.measure_all()
circuits.append(qc)

sim = QasmSimulatorPy()
sim = AerSimulator()
circuits = transpile(circuits, sim)
job = sim.run(circuits, shots=shots, seed_simulator=10)
result = job.result()
Expand Down
10 changes: 7 additions & 3 deletions test/library/calibration/test_rabi.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
from qiskit import QuantumCircuit, pulse, transpile
from qiskit.exceptions import QiskitError
from qiskit.circuit import Parameter
from qiskit.providers.basicaer import QasmSimulatorPy
from qiskit.qobj.utils import MeasLevel
from qiskit.providers.basic_provider import BasicSimulator
from qiskit_aer import AerSimulator

from qiskit_experiments.framework import ExperimentData, ParallelExperiment
from qiskit_experiments.library import Rabi, EFRabi
Expand Down Expand Up @@ -223,7 +224,7 @@ def simulate_experiment_data(self, thetas, amplitudes, shots=1024):
qc.measure_all()
circuits.append(qc)

sim = QasmSimulatorPy()
sim = AerSimulator()
circuits = transpile(circuits, sim)
job = sim.run(circuits, shots=shots, seed_simulator=10)
result = job.result()
Expand Down Expand Up @@ -272,7 +273,10 @@ def test_bad_analysis(self):
"""Test the Rabi analysis."""
experiment_data = ExperimentData()

thetas = np.linspace(0.0, np.pi / 4, 31)
# Change rotation angle with square root of amplitude so that
# population versus amplitude will not be sinusoidal and the fit will
# be bad.
thetas = np.sqrt(np.linspace(0.0, 4 * np.pi**2, 31))
amplitudes = np.linspace(0.0, 0.95, 31)

experiment_data.add_data(self.simulate_experiment_data(thetas, amplitudes, shots=200))
Expand Down

0 comments on commit e45c348

Please sign in to comment.