I am trying to do some state tomography to generate GHZ states and calculate fidelity. For running the code, I want to execute my code with the qubits with the lowest readout error using initial layout in the transpilation process. However, I arrive at this error and I can not specify the qubits .
Traceback (most recent call last):
Cell In[28], line 2
best_qc = transpile(st, backend, initial_layout=[90,94,95])
File /opt/conda/lib/python3.10/site-packages/qiskit/compiler/transpiler.py:338 in transpile
output_name = _parse_output_name(output_name, circuits)
File /opt/conda/lib/python3.10/site-packages/qiskit/compiler/transpiler.py:593 in _parse_output_name
return [circuit.name for circuit in circuits]
File /opt/conda/lib/python3.10/site-packages/qiskit/compiler/transpiler.py:593 in <listcomp>
return [circuit.name for circuit in circuits]
AttributeError: 'StateTomography' object has no attribute 'name'
from qiskit import *
from qiskit.visualization import array_to_latex
from qiskit_experiments.library import StateTomography
q1 = QuantumRegister(1)
q2 = QuantumRegister(1)
q3 = QuantumRegister(1)
c = ClassicalRegister(3)
qc = QuantumCircuit(q1, q2, q3, c)
qc.h(q1)
qc.cx(q1, q2)
qc.ccx(q1, q2, q3)
st = StateTomography(qc)
best_qc = transpile(st, backend, initial_layout=[90,94,95])
stdata = st.run(backend).block_for_results()
state_result = stdata.analysis_results("state")
array_to_latex(state_result.value)
fid_result = stdata.analysis_results("state_fidelity")
print(f"state Fidelity = {fid_result.value}")