diff --git a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py index 09abd35814..d3d78bd159 100644 --- a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py +++ b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py @@ -229,6 +229,14 @@ def circuits(self) -> List[QuantumCircuit]: Returns: A list of :class:`QuantumCircuit`. """ + return list(self.circuits_generator()) + + def circuits_generator(self) -> Iterable[QuantumCircuit]: + """Generate physical circuits to measure layer fidelity. + + Returns: + A generator of :class:`QuantumCircuit`s. + """ opts = self.experiment_options residal_qubits_by_layer = [self.__residual_qubits(layer) for layer in opts.two_qubit_layers] rng = default_rng(seed=opts.seed) @@ -325,9 +333,7 @@ def circuits(self) -> List[QuantumCircuit]: ], "composite_index": [i_set], } - circuits.append(circ) - - return circuits + yield circ @staticmethod def __circuit_body(