From 4555b4e726ed8c6bc4ed879de45fda81b2be3b3a Mon Sep 17 00:00:00 2001 From: sldesnoo-Delft <s.l.desnoo@tudelft.nl> Date: Wed, 30 Aug 2023 12:03:12 +0200 Subject: [PATCH] Improved test to work on Qblox and Keysight --- .../tests/segments/conditional_segments.py | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/pulse_lib/tests/segments/conditional_segments.py b/pulse_lib/tests/segments/conditional_segments.py index 6c4989d1..3b5a1fb3 100644 --- a/pulse_lib/tests/segments/conditional_segments.py +++ b/pulse_lib/tests/segments/conditional_segments.py @@ -6,9 +6,24 @@ from pulse_lib.tests.configurations.test_configuration import context from pulse_lib.segments.conditional_segment import conditional_segment from pulse_lib.segments.utility.measurement_ref import MeasurementRef +def get_feedback_latency(backend): + if backend in ['Tektronix_5014', 'Keysight']: + print(f'feedback not supported for {backend}') + return None + elif backend == 'Keysight_QS': + feedback_latency = 700 + else: + feedback_latency = 300 + return feedback_latency + + def test1(): pulse = context.init_pulselib(n_gates=2, n_qubits=2, n_sensors=2) + feedback_latency = get_feedback_latency(pulse._backend) + if feedback_latency is None: + return + t_measure = 500 s = pulse.mk_segment('seg1') @@ -17,7 +32,7 @@ def test1(): s.P1.add_block(10, 20, -10) s.wait(30, reset_time=True) s.SD1.acquire(0, t_measure, 'm1', threshold=0.0015, zero_on_high=True, wait=True) - s.wait(300, reset_time=True) + s.wait(feedback_latency, reset_time=True) s_true = pulse.mk_segment() s_false = pulse.mk_segment() @@ -40,6 +55,10 @@ def test1(): def test2(): pulse = context.init_pulselib(n_gates=2, n_qubits=2, n_sensors=2) + feedback_latency = get_feedback_latency(pulse._backend) + if feedback_latency is None: + return + t_measure = 500 s = pulse.mk_segment('seg1') @@ -47,10 +66,10 @@ def test2(): s.P1.add_block(10, 20, -10) s.wait(30, reset_time=True) - s.SD1.acquire(0, t_measure, 'm0', threshold=0.0025, zero_on_high=True, wait=True) - s.wait(300, reset_time=True) - s.SD1.acquire(0, t_measure, 'm1', threshold=0.0025, zero_on_high=True, wait=True) - s.wait(300, reset_time=True) + s.SD1.acquire(0, t_measure, 'm0', threshold=0.0024, zero_on_high=True, wait=True) + s.wait(200, reset_time=True) + s.SD1.acquire(0, t_measure, 'm1', threshold=0.0024, zero_on_high=True, wait=True) + s.wait(feedback_latency, reset_time=True) s_true = pulse.mk_segment() s_false = pulse.mk_segment() @@ -58,7 +77,7 @@ def test2(): s_false.q1.add_MW_pulse(10, 20, 80.0, 2.450e9) s_false.wait(10, reset_time=True) - cond_seg1 = conditional_segment(MeasurementRef('m0'), [s_false, s_true], name='cond') + cond_seg1 = conditional_segment(MeasurementRef('m1'), [s_false, s_true], name='cond') sequence = pulse.mk_sequence([s1, cond_seg1]) sequence.n_rep = 3 @@ -75,4 +94,4 @@ if __name__ == '__main__': context.init_coretools() # ds1 = test1() ds2 = test2() - + ds2.m1_1(), ds2.m1_2(), ds2.m1_3(), ds2.m1_4() -- GitLab