diff --git a/qiskit_experiments/base_experiment.py b/qiskit_experiments/base_experiment.py index 907af62397..f05960f390 100644 --- a/qiskit_experiments/base_experiment.py +++ b/qiskit_experiments/base_experiment.py @@ -18,7 +18,7 @@ from numbers import Integral from typing import List, Optional, Iterable, Tuple, Union -from qiskit import transpile, assemble +from qiskit import transpile, assemble, QuantumCircuit from qiskit.providers.options import Options from qiskit.providers.backend import Backend from qiskit.providers.basebackend import BaseBackend as LegacyBackend @@ -85,7 +85,7 @@ def __init__(self, qubits: Iterable[int], experiment_type: Optional[str] = None, def run( self, - backend: "Backend", + backend: Backend, analysis: bool = True, experiment_data: Optional[ExperimentData] = None, **kwargs, @@ -153,14 +153,14 @@ def analysis(cls, **analysis_options) -> "BaseAnalysis": return cls.__analysis_class__(**analysis_options) @abstractmethod - def circuits(self, backend=None) -> List["QuantumCircuit"]: + def circuits(self, backend: Optional[Backend] = None) -> List[QuantumCircuit]: """Return a list of experiment circuits. Args: - backend (Backend): Optional, a backend object. + backend: Optional, a backend object. Returns: - List[QuantumCircuit]: A list of :class:`QuantumCircuit`s. + A list of :class:`QuantumCircuit`s. .. note: These circuits should be on qubits ``[0, .., N-1]`` for an @@ -173,10 +173,10 @@ def circuits(self, backend=None) -> List["QuantumCircuit"]: def _transpile( self, - circuits: Union["QuantumCircuit", List["QuantumCircuit"]], - backend: Optional["Backend"] = None, + circuits: Union[QuantumCircuit, List[QuantumCircuit]], + backend: Optional[Backend] = None, **transpile_options, - ) -> List["QuantumCircuit"]: + ) -> List[QuantumCircuit]: """Custom transpilation of circuits for running on backend. Subclasses may modify this method if they need to customize how diff --git a/qiskit_experiments/randomized_benchmarking/rb_analysis.py b/qiskit_experiments/randomized_benchmarking/rb_analysis.py index f7919cc8a2..bd5c12d2eb 100644 --- a/qiskit_experiments/randomized_benchmarking/rb_analysis.py +++ b/qiskit_experiments/randomized_benchmarking/rb_analysis.py @@ -16,6 +16,8 @@ from typing import Optional, List import numpy as np + +from qiskit.providers.options import Options from qiskit_experiments.base_analysis import BaseAnalysis from qiskit_experiments.analysis.curve_fitting import curve_fit from qiskit_experiments.analysis.data_processing import ( diff --git a/qiskit_experiments/randomized_benchmarking/rb_experiment.py b/qiskit_experiments/randomized_benchmarking/rb_experiment.py index be6163dfdf..495afb1180 100644 --- a/qiskit_experiments/randomized_benchmarking/rb_experiment.py +++ b/qiskit_experiments/randomized_benchmarking/rb_experiment.py @@ -74,23 +74,6 @@ def circuits(self, backend=None): circuits += self._sample_circuits(self._lengths, seed=self._rng) return circuits - def transpiled_circuits(self, backend=None, **kwargs): - """Return a list of transpiled RB circuits. - Args: - backend (Backend): Optional, a backend object to use as the - argument for the :func:`qiskit.transpile` - function. - kwargs: kwarg options for the :func:`qiskit.transpile` function. - Returns: - List[QuantumCircuit]: A list of :class:`QuantumCircuit`s. - Raises: - QiskitError: if an initial layout is specified in the - kwarg options for transpilation. The initial - layout must be generated from the experiment. - """ - circuits = super().transpiled_circuits(backend=backend, **kwargs) - return circuits - def _sample_circuits( self, lengths: Iterable[int], seed: Optional[Union[int, Generator]] = None ):