Skip to content

Commit

Permalink
Update T1 test to use Target instead of instruction_durations
Browse files Browse the repository at this point in the history
  • Loading branch information
wshanks committed Nov 5, 2024
1 parent d1f2618 commit 93b86eb
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions test/library/characterization/test_t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

from test.base import QiskitExperimentsTestCase
import numpy as np
from qiskit.circuit import Delay, Parameter
from qiskit.circuit.library import CXGate, Measure, RXGate
from qiskit.qobj.utils import MeasLevel
from qiskit.transpiler import InstructionProperties, Target
from qiskit_ibm_runtime.fake_provider import FakeAthensV2
from qiskit_experiments.test.noisy_delay_aer_simulator import NoisyDelayAerBackend
from qiskit_experiments.framework import ExperimentData, ParallelExperiment
Expand Down Expand Up @@ -249,22 +252,33 @@ def test_t1_low_quality(self):
def test_t1_parallel_exp_transpile(self):
"""Test parallel transpile options for T1 experiment"""
num_qubits = 5
instruction_durations = []
for i in range(num_qubits):
instruction_durations += [
("rx", [i], (i + 1) * 10, "ns"),
("measure", [i], (i + 1) * 1000, "ns"),
]
coupling_map = [[i - 1, i] for i in range(1, num_qubits)]
basis_gates = ["rx", "delay"]
target = Target(num_qubits=num_qubits)
target.add_instruction(
RXGate(Parameter("t")),
properties={
(i,): InstructionProperties(duration=(i + 1) * 10e-9) for i in range(num_qubits)
},
)
target.add_instruction(
Measure(),
properties={
(i,): InstructionProperties(duration=(i + 1) * 1e-6) for i in range(num_qubits)
},
)
target.add_instruction(
Delay(Parameter("t")),
properties={(i,): None for i in range(num_qubits)},
)
target.add_instruction(
CXGate(),
properties={(i - 1, i): None for i in range(1, num_qubits)},
)

exp1 = T1([1], delays=[50e-9, 100e-9, 160e-9])
exp2 = T1([3], delays=[40e-9, 80e-9, 190e-9])
parexp = ParallelExperiment([exp1, exp2], flatten_results=False)
parexp.set_transpile_options(
basis_gates=basis_gates,
instruction_durations=instruction_durations,
coupling_map=coupling_map,
target=target,
scheduling_method="alap",
)

Expand Down

0 comments on commit 93b86eb

Please sign in to comment.