You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set up a now environment with qiskit, qiskit-experiment and want to run the 1Q RB code. The import is godd, but the expdata1 = exp1.run(backend).block_for_results() raise up an AttributeError:
Code
import numpy as np
from qiskit_experiments.library import StandardRB, InterleavedRB
from qiskit_experiments.framework import ParallelExperiment, BatchExperiment
import qiskit.circuit.library as circuits
# For simulation
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime.fake_provider import FakePerth
backend = AerSimulator.from_backend(FakePerth())
lengths = np.arange(1, 800, 200)
num_samples = 10
seed = 1010
qubits = [0]
# Run an RB experiment on qubit 0
exp1 = StandardRB(qubits, lengths, num_samples=num_samples, seed=seed)
expdata1 = exp1.run(backend).block_for_results()
results1 = expdata1.analysis_results()
# View result data
print("Gate error ratio: %s" % expdata1.experiment.analysis.options.gate_error_ratio)
display(expdata1.figure(0))
for result in results1:
print(result)
Errors
{
"name": "AttributeError",
"message": "'QuantumCircuit' object has no attribute '_parameter_table'",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 8
6 # Run an RB experiment on qubit 0
7 exp1 = StandardRB(qubits, lengths, num_samples=num_samples, seed=seed)
----> 8 expdata1 = exp1.run(backend).block_for_results()
9 results1 = expdata1.analysis_results()
11 # View result data
File e:\\conda\\envs\\qiskit_prac\\lib\\site-packages\\qiskit_experiments\\framework\\base_experiment.py:245, in BaseExperiment.run(self, backend, analysis, timeout, **run_options)
242 experiment._finalize()
244 # Generate and transpile circuits
--> 245 transpiled_circuits = experiment._transpiled_circuits()
247 # Initialize result container
248 experiment_data = experiment._initialize_experiment_data()
File e:\\conda\\envs\\qiskit_prac\\lib\\site-packages\\qiskit_experiments\\library\\randomized_benchmarking\\standard_rb.py:381, in StandardRB._transpiled_circuits(self)
379 transpiled = super()._transpiled_circuits()
380 else:
--> 381 transpiled = [
382 _transpile_clifford_circuit(circ, physical_qubits=self.physical_qubits)
383 for circ in self.circuits()
384 ]
385 # Set custom calibrations provided in backend (excluding simulators)
386 if isinstance(self.backend, BackendV2) and \"simulator\" not in self.backend.name:
File e:\\conda\\envs\\qiskit_prac\\lib\\site-packages\\qiskit_experiments\\library\\randomized_benchmarking\\standard_rb.py:382, in <listcomp>(.0)
379 transpiled = super()._transpiled_circuits()
380 else:
381 transpiled = [
--> 382 _transpile_clifford_circuit(circ, physical_qubits=self.physical_qubits)
383 for circ in self.circuits()
384 ]
385 # Set custom calibrations provided in backend (excluding simulators)
386 if isinstance(self.backend, BackendV2) and \"simulator\" not in self.backend.name:
File e:\\conda\\envs\\qiskit_prac\\lib\\site-packages\\qiskit_experiments\\library\\randomized_benchmarking\\clifford_utils.py:55, in _transpile_clifford_circuit(circuit, physical_qubits)
51 def _transpile_clifford_circuit(
52 circuit: QuantumCircuit, physical_qubits: Sequence[int]
53 ) -> QuantumCircuit:
54 # Simplified transpile that only decomposes Clifford circuits and creates the layout.
---> 55 return _apply_qubit_layout(_decompose_clifford_ops(circuit), physical_qubits=physical_qubits)
File e:\\conda\\envs\\qiskit_prac\\lib\\site-packages\\qiskit_experiments\\library\\randomized_benchmarking\\clifford_utils.py:64, in _decompose_clifford_ops(circuit)
58 def _decompose_clifford_ops(circuit: QuantumCircuit) -> QuantumCircuit:
59 # Simplified QuantumCircuit.decompose, which decomposes only Clifford ops
60 # Note that the resulting circuit depends on the input circuit,
61 # that means the changes on the input circuit may affect the resulting circuit.
62 # For example, the resulting circuit shares the parameter_table of the input circuit,
63 res = circuit.copy_empty_like()
---> 64 res._parameter_table = circuit._parameter_table
65 for inst in circuit:
66 if inst.operation.name.startswith(\"Clifford\"): # Decompose
AttributeError: 'QuantumCircuit' object has no attribute '_parameter_table'"
}
Steps to reproduce the problem
With the same environment, run
import numpy as np
from qiskit_experiments.library import StandardRB, InterleavedRB
from qiskit_experiments.framework import ParallelExperiment, BatchExperiment
import qiskit.circuit.library as circuits
# For simulation
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime.fake_provider import FakePerth
backend = AerSimulator.from_backend(FakePerth())
lengths = np.arange(1, 800, 200)
num_samples = 10
seed = 1010
qubits = [0]
# Run an RB experiment on qubit 0
exp1 = StandardRB(qubits, lengths, num_samples=num_samples, seed=seed)
expdata1 = exp1.run(backend).block_for_results()
results1 = expdata1.analysis_results()
# View result data
print("Gate error ratio: %s" % expdata1.experiment.analysis.options.gate_error_ratio)
display(expdata1.figure(0))
for result in results1:
print(result)
Informations
What is the current behavior?
I set up a now environment with
qiskit
,qiskit-experiment
and want to run the 1Q RB code. The import is godd, but theexpdata1 = exp1.run(backend).block_for_results()
raise up anAttributeError
:Code
Errors
Steps to reproduce the problem
With the same environment, run
What is the expected behavior?
Same as https://qiskit-community.github.io/qiskit-experiments/manuals/verification/randomized_benchmarking.html shows.
Suggested solutions
No idea.
Appendix I: All packages
The text was updated successfully, but these errors were encountered: