From 395ae2fce6e1b472f1ff3c5c5f0e6f0d233d5678 Mon Sep 17 00:00:00 2001
From: Sander de Snoo <59472150+sldesnoo-Delft@users.noreply.github.com>
Date: Tue, 12 Jul 2022 09:20:13 +0200
Subject: [PATCH] Default channel offset is None to allow configuration outside
 of pulselib

---
 pulse_lib/configuration/physical_channels.py  | 4 ++--
 pulse_lib/keysight/qs_uploader.py             | 9 +++++----
 pulse_lib/tektronix/tektronix5014_uploader.py | 3 ++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/pulse_lib/configuration/physical_channels.py b/pulse_lib/configuration/physical_channels.py
index ece401f1..a5f1e48e 100644
--- a/pulse_lib/configuration/physical_channels.py
+++ b/pulse_lib/configuration/physical_channels.py
@@ -11,7 +11,7 @@ class awg_channel:
     attenuation: float = 1.0
     compensation_limits: Tuple[float, float] = (0,0)
     bias_T_RC_time: Optional[float] = None
-    offset: float = 0.0 # mV
+    offset: Optional[float] = None # mV
 
 @dataclass
 class marker_channel:
@@ -28,7 +28,7 @@ class marker_channel:
     amplitude: float = 1000
     invert: bool = False
     delay: float = 0 # ns
-    sequencer_name : str = None
+    sequencer_name : Optional[str] = None
     '''
     Qblox only: name of qubit, awg or digitizer channel to use for sequencing
     '''
diff --git a/pulse_lib/keysight/qs_uploader.py b/pulse_lib/keysight/qs_uploader.py
index 8e85b79c..cfeae370 100644
--- a/pulse_lib/keysight/qs_uploader.py
+++ b/pulse_lib/keysight/qs_uploader.py
@@ -38,6 +38,7 @@ class QsUploader:
         self.digitizer_channels = digitizer_channels
 
         self.jobs = []
+        self.acq_description = None
 
         add_sequencers(self, awg_devices, awg_channels, IQ_channels)
 
@@ -195,7 +196,7 @@ class QsUploader:
                     awg_name = channel.awg_name
                     channel_number = channel.channel_number
                     amplitude = channel.amplitude if channel.amplitude is not None else AwgConfig.MAX_AMPLITUDE
-                    offset = channel.offset
+                    offset = channel.offset if channel.offset is not None else 0
                 elif channel_name in self.marker_channels:
                     channel = self.marker_channels[channel_name]
                     awg_name = channel.module_name
@@ -1047,7 +1048,7 @@ class UploadAggregator:
             for iseg, (seg, seg_render) in enumerate(zip(job.sequence, segments)):
                 if isinstance(seg, conditional_segment):
                     logging.debug(f'conditional for {channel_name}')
-                    # TODO @@@@ lookup acquisitions and set pxi trigger.
+                    # TODO @@@ lookup acquisitions and set pxi trigger.
                     seg_ch = get_conditional_channel(seg, channel_name)
                 else:
                     seg_ch = seg[channel_name]
@@ -1059,8 +1060,8 @@ class UploadAggregator:
                         t_measure = acquisition.t_measure
                     else:
                         t_measure = job.acquisition_conf.t_measure
-                    if job.acquisition_conf.downsample_rate is not None:
-                        period_ns = iround(1e8/job.acquisition_conf.downsample_rate) * 10
+                    if job.acquisition_conf.sample_rate is not None:
+                        period_ns = iround(1e8/job.acquisition_conf.sample_rate) * 10
                         n_cycles = int(t_measure / period_ns)
                         t_integrate = period_ns
                     else:
diff --git a/pulse_lib/tektronix/tektronix5014_uploader.py b/pulse_lib/tektronix/tektronix5014_uploader.py
index c93a7e21..6a0b3b26 100644
--- a/pulse_lib/tektronix/tektronix5014_uploader.py
+++ b/pulse_lib/tektronix/tektronix5014_uploader.py
@@ -79,7 +79,8 @@ class Tektronix5014_Uploader:
             ch_num = channel.channel_number
             # NOTE: Tektronix setting is Vpp, not amplitude.
             awg.set(f'ch{ch_num}_amp', channel.amplitude/1000*2)
-            awg.set(f'ch{ch_num}_offset', channel.offset/1000)
+            offset = channel.offset if channel.offset is not None else 0
+            awg.set(f'ch{ch_num}_offset', offset/1000)
 
         for channel in self.marker_channels.values():
             awg = self.awgs[channel.module_name]
-- 
GitLab