From 11ba3cb2f5d73993b5df4cc5639527fe3221f6e3 Mon Sep 17 00:00:00 2001 From: Paul Tan Date: Wed, 23 Oct 2024 10:15:22 +0800 Subject: [PATCH] refactor: define supported sweepers as top level constant --- src/qibolab/_core/instruments/keysight/sweep.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/qibolab/_core/instruments/keysight/sweep.py b/src/qibolab/_core/instruments/keysight/sweep.py index 9988b9c9a..f8bcbaac3 100644 --- a/src/qibolab/_core/instruments/keysight/sweep.py +++ b/src/qibolab/_core/instruments/keysight/sweep.py @@ -9,6 +9,12 @@ from qibolab._core.sweeper import ParallelSweepers, Parameter NS_TO_S = 1e-9 +SUPPORTED_CHANNEL_SWEEPERS = [Parameter.frequency] +SUPPORTED_PULSE_SWEEPERS = [ + Parameter.amplitude, + Parameter.duration, + Parameter.relative_phase, +] def process_sweepers( @@ -50,18 +56,14 @@ def process_sweepers( name=f"V{idx}_{idx2}", value=sweeper.values[0], dtype=float ) - if sweeper.parameter is Parameter.frequency: + if sweeper.parameter in SUPPORTED_CHANNEL_SWEEPERS: sweeper_channel_map.update( {channel_id: qcs_variable for channel_id in sweeper.channels} ) # Readout frequency is not supported with hardware sweeping if not probe_channel_ids.isdisjoint(sweeper.channels): hardware_sweeping = False - elif sweeper.parameter in [ - Parameter.amplitude, - Parameter.duration, - Parameter.relative_phase, - ]: + elif sweeper.parameter in SUPPORTED_PULSE_SWEEPERS: # Duration is not supported with hardware sweeping if sweeper.parameter is Parameter.duration: hardware_sweeping = False