Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix legacy accesses of CircuitInstruction in tests #2191

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions test/terra/backends/aer_simulator/test_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,13 @@ def _test_kraus_gate_noise_on_QFT(self, **options):

# manaully build noise circuit
noise_circuit = QuantumCircuit(3)
for inst, qargs, cargs in ideal_circuit.data:
noise_circuit.append(inst, qargs, cargs)
if inst.name == "h":
noise_circuit.append(error1, qargs)
elif inst.name in ["cp", "swap"]:
noise_circuit.append(error2, qargs)
for inst in ideal_circuit.data:
noise_circuit.append(inst)
name = inst.operation.name
if name == "h":
noise_circuit.append(error1, inst.qubits)
elif name in ["cp", "swap"]:
noise_circuit.append(error2, inst.qubits)
# compute target counts
noise_state = DensityMatrix(noise_circuit)
ref_target = {i: shots * p for i, p in noise_state.probabilities_dict().items()}
Expand Down
13 changes: 7 additions & 6 deletions test/terra/backends/aer_simulator/test_shot_branching.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,13 @@ def test_shot_branching_kraus_gate_noise_on_QFT(self, method, device):

# manaully build noise circuit
noise_circuit = QuantumCircuit(3)
for inst, qargs, cargs in ideal_circuit.data:
noise_circuit.append(inst, qargs, cargs)
if inst.name == "h":
noise_circuit.append(error1, qargs)
elif inst.name in ["cp", "swap"]:
noise_circuit.append(error2, qargs)
for inst in ideal_circuit.data:
noise_circuit.append(inst)
name = inst.operation.name
if name == "h":
noise_circuit.append(error1, inst.qubits)
elif name in ["cp", "swap"]:
noise_circuit.append(error2, inst.qubits)
# compute target counts
noise_state = DensityMatrix(noise_circuit)
ref_target = {i: shots * p for i, p in noise_state.probabilities_dict().items()}
Expand Down
Loading