From dc8e17cbb8311d7b71636ae36e5608fbd5e92e57 Mon Sep 17 00:00:00 2001
From: sldesnoo-Delft <s.l.desnoo@tudelft.nl>
Date: Mon, 18 Mar 2024 17:34:59 +0100
Subject: [PATCH] Improved test with plunger driving on QS

---
 pulse_lib/tests/configurations/test_configuration.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/pulse_lib/tests/configurations/test_configuration.py b/pulse_lib/tests/configurations/test_configuration.py
index 532d2883..590edf10 100644
--- a/pulse_lib/tests/configurations/test_configuration.py
+++ b/pulse_lib/tests/configurations/test_configuration.py
@@ -204,9 +204,10 @@ class Context:
                 qubit = i+1
                 if backend == 'Keysight_QS':
                     # Use a new awg channel on the same output to drive the qubit.
-                    drive_channel_name = f"P{qubit}_drive"
                     awg_channel = pulse.awg_channels[f"P{qubit}"]
-                    pulse.define_channel(drive_channel_name, awg_channel.awg_name, awg_channel.channel_number)
+                    drive_channel_name = f"P{qubit}_drive"
+                    if drive_channel_name not in pulse.awg_channels:
+                        pulse.define_channel(drive_channel_name, awg_channel.awg_name, awg_channel.channel_number)
                 else:
                     drive_channel_name = f"P{qubit}"
                 iq_channel_name = f"drive_q{qubit}"
@@ -334,6 +335,13 @@ class Context:
 
         return pulse
 
+    def copy_attenuation_to_drive(self):
+        pulse = self.pulse
+        for channel_name, awg_channel in pulse.awg_channels.items():
+            if channel_name.endswith("_drive"):
+                base_channel = pulse.awg_channels[channel_name[:-6]]
+                awg_channel.attenuation = base_channel.attenuation
+
     def _add_marker(self, name, setup_ns=0, hold_ns=0):
         cfg = self._configuration
         pulse = self.pulse
-- 
GitLab